From 70e7b80e756155fbbb09843da9313d07e6b8d6b5 Mon Sep 17 00:00:00 2001 From: Finley8 Date: Mon, 2 Oct 2023 16:29:44 -0400 Subject: [PATCH 1/4] update --- chasten-test | 1 + debuggingbook | 1 + fuzzingbook | 1 + 3 files changed, 3 insertions(+) create mode 160000 chasten-test create mode 160000 debuggingbook create mode 160000 fuzzingbook diff --git a/chasten-test b/chasten-test new file mode 160000 index 00000000..2d8478da --- /dev/null +++ b/chasten-test @@ -0,0 +1 @@ +Subproject commit 2d8478da0234a1425f5e767e0d1a69d17ec26aa4 diff --git a/debuggingbook b/debuggingbook new file mode 160000 index 00000000..b492ac6e --- /dev/null +++ b/debuggingbook @@ -0,0 +1 @@ +Subproject commit b492ac6e09367ce124f15593664a7b6bc9d7475c diff --git a/fuzzingbook b/fuzzingbook new file mode 160000 index 00000000..5cbdedd0 --- /dev/null +++ b/fuzzingbook @@ -0,0 +1 @@ +Subproject commit 5cbdedd02abee0aab9341afcf518b290217b8309 From b50d54d86289e385853a0547bfe63274a02ce0ed Mon Sep 17 00:00:00 2001 From: Finley8 Date: Mon, 2 Oct 2023 16:31:11 -0400 Subject: [PATCH 2/4] removing books --- debuggingbook | 1 - fuzzingbook | 1 - 2 files changed, 2 deletions(-) delete mode 160000 debuggingbook delete mode 160000 fuzzingbook diff --git a/debuggingbook b/debuggingbook deleted file mode 160000 index b492ac6e..00000000 --- a/debuggingbook +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b492ac6e09367ce124f15593664a7b6bc9d7475c diff --git a/fuzzingbook b/fuzzingbook deleted file mode 160000 index 5cbdedd0..00000000 --- a/fuzzingbook +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5cbdedd02abee0aab9341afcf518b290217b8309 From c69898feded600aabd211c5eda556680a7bea61d Mon Sep 17 00:00:00 2001 From: VitalJoseph Date: Mon, 2 Oct 2023 16:40:58 -0400 Subject: [PATCH 3/4] added first implementation of xpath command line option --- chasten/main.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/chasten/main.py b/chasten/main.py index 7f5cbae6..35b41542 100644 --- a/chasten/main.py +++ b/chasten/main.py @@ -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( + None, + "--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", From 2767ffa31d9e40e4358c99f2e5a9bb461a49206a Mon Sep 17 00:00:00 2001 From: VitalJoseph Date: Mon, 2 Oct 2023 19:37:12 -0400 Subject: [PATCH 4/4] added condition --- chasten/main.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/chasten/main.py b/chasten/main.py index 35b41542..bedc21ee 100644 --- a/chasten/main.py +++ b/chasten/main.py @@ -385,9 +385,9 @@ def configure( # noqa: PLR0913 def analyze( # noqa: PLR0913, PLR0915 project: str = typer.Argument(help="Name of the project."), xpath: str = typer.Option( - None, + "2.0", "--xpath", - help="Version of xpath specified by user. (1.0 or 2.0)", + help="Version of xpath specified by user. (1.0 or 2.0).", ), check_include: Tuple[enumerations.FilterableAttribute, str, int] = typer.Option( (None, None, 0), @@ -547,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