Skip to content

Commit

Permalink
Merge branch 'issue-#15' of github.com:AstuteSource/chasten into issue-
Browse files Browse the repository at this point in the history
  • Loading branch information
Keven Duverglas committed Oct 3, 2023
2 parents 5180d49 + 2767ffa commit 340db5d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions chasten-test
Submodule chasten-test added at 2d8478
14 changes: 11 additions & 3 deletions chasten/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,11 @@ def configure( # noqa: PLR0913
@cli.command()
def analyze( # noqa: PLR0913, PLR0915
project: str = typer.Argument(help="Name of the project."),
xpath: str = typer.Option(
"2.0",
"--xpath",
help="Version of xpath specified by user. (1.0 or 2.0).",
),
check_include: Tuple[enumerations.FilterableAttribute, str, int] = typer.Option(
(None, None, 0),
"--check-include",
Expand Down Expand Up @@ -542,9 +547,12 @@ def analyze( # noqa: PLR0913, PLR0915
# search for the XML contents of an AST that match the provided
# XPATH query using the search_python_file in search module of pyastgrep;
# this looks for matches across all path(s) in the specified source path
match_generator = pyastgrepsearch.search_python_files(
paths=valid_directories, expression=current_xpath_pattern, xpath2=True
)

if xpath == "1.0":
match_generator = pyastgrepsearch.search_python_files(paths=valid_directories, expression=current_xpath_pattern, xpath2=False)
else:
match_generator = pyastgrepsearch.search_python_files(paths=valid_directories, expression=current_xpath_pattern, xpath2=True)

# materialize a list from the generator of (potential) matches;
# note that this list will also contain an object that will
# indicate that the analysis completed for each located file
Expand Down

0 comments on commit 340db5d

Please sign in to comment.