Skip to content

Commit

Permalink
feat: use libCST's native parser
Browse files Browse the repository at this point in the history
  • Loading branch information
browniebroke committed Apr 11, 2022
1 parent a26184b commit d16eb50
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions pyproject.toml
Expand Up @@ -47,16 +47,16 @@ docs = [
]

[tool.poetry.dev-dependencies]
pytest = "^7.0"
black = "^22.1"
pytest-cov = "^3.0"
pytest-mock = "^3.3"
tox = "^3.20"
parameterized = "^0.8.0"
flake8 = "^4.0"
pyupgrade = "^2.31"
isort = "^5.10"
mypy = "^0.942"
parameterized = "^0.8.0"
pytest = "^7.0"
pytest-cov = "^3.0"
pytest-mock = "^3.3"
pyupgrade = "^2.31"
tox = "^3.20"

[tool.semantic_release]
branch = "main"
Expand Down
3 changes: 3 additions & 0 deletions src/django_codemod/cli.py
@@ -1,4 +1,5 @@
import inspect
import os
from collections import defaultdict
from operator import attrgetter
from pathlib import Path
Expand All @@ -15,6 +16,8 @@
from django_codemod.path_utils import get_sources
from django_codemod.visitors.base import BaseDjCodemodTransformer

os.environ["LIBCST_PARSER_TYPE"] = "native"


def index_codemodders(version_getter: Callable) -> Dict[Tuple[int, int], List]:
"""
Expand Down
6 changes: 6 additions & 0 deletions tests/test_cli.py
Expand Up @@ -27,6 +27,12 @@ def command_instance():
return BaseCodemodCommand([], CodemodContext())


def test_use_native_parser():
from libcst._parser.entrypoints import is_native

assert is_native() is True


def test_missing_argument(cli_runner):
"""Should explain missing arguments."""
result = cli_runner.invoke(cli.djcodemod, ["run"])
Expand Down

0 comments on commit d16eb50

Please sign in to comment.