From 3b84b8e7112741aa25e8c6a87480bbd57556d4e2 Mon Sep 17 00:00:00 2001 From: daomcgill <77309217+daomcgill@users.noreply.github.com> Date: Thu, 17 Oct 2024 16:26:48 -1000 Subject: [PATCH] i #313 Update Config File - Remove unused settings - Change ../ to ../../ - Update notebook to reflect changes Signed-off-by: Dao McGill --- conf/maven.yml | 26 ++++++-------------------- vignettes/syntax_extractor.Rmd | 29 +++++++++++++++-------------- 2 files changed, 21 insertions(+), 34 deletions(-) diff --git a/conf/maven.yml b/conf/maven.yml index a74ea62a..6cdf8bf6 100644 --- a/conf/maven.yml +++ b/conf/maven.yml @@ -1,14 +1,7 @@ -# Project Configuration File for Maven Project # +# Project Configuration File for Maven Project project: website: https://github.com/apache/maven -version_control: - # Path to the .git directory of the Maven project - log: ../maven/maven-artifact/src/main/java/org/apache/maven/artifact/ - # List of branches to analyze - branch: - - main - filter: # File extensions to include in the analysis keep_filepaths_ending_with: @@ -19,16 +12,9 @@ filter: - test - example -tool: - # srcML binary path +srcml: + # path to tool binary (change this location later) srcml_path: /usr/local/bin/srcml - # Path to output the XML annotation file generated by srcML - srcml_output_path: ../analysis/maven/srcml_output.xml - -# Analysis Configuration # -analysis: - # A list of topics (keywords) for focused analysis - topics: - - class - - method - - documentation + # path to the folder to analyze + src_folder: ../../maven/maven-artifact/src/main/java/org/apache/maven/artifact/ + srcml_filepath: ../../analysis/maven/srcml_output.xml diff --git a/vignettes/syntax_extractor.Rmd b/vignettes/syntax_extractor.Rmd index 7daa858f..1ad216e6 100644 --- a/vignettes/syntax_extractor.Rmd +++ b/vignettes/syntax_extractor.Rmd @@ -91,24 +91,25 @@ Here’s how you can set up the configuration: ``` {r eval=FALSE} # Load the project configuration tool <- yaml::read_yaml("tools.yml") -conf <- yaml::read_yaml("conf/syntax.yml") +conf <- yaml::read_yaml("conf/maven.yml") # Path to srcML binary srcml_path <- tool[["srcml"]] -# Git repository and folder path (using Maven as an example) -git_repo_path <- conf[["version_control"]][["log"]] -folder_path <- stri_replace_last(git_repo_path, replacement="", regex=".git") +# Paths from config +srcml_path <- conf[["tool"]][["srcml_path"]] +src_folder <- conf[["version_control"]][["log"]] +srcml_output_path <- conf[["tool"]][["srcml_output_path"]] +srcml_filepath <- conf[["tool"]][["srcml_output_path"]] -# Tool Parameters -srcml_filepath <- conf[["tool"]][["srcml"]][["srcml_path"]] -# Filters for file extensions and substrings in file paths +# Filters file_extensions <- conf[["filter"]][["keep_filepaths_ending_with"]] -substring_filepath <- conf[["filter"]][["remove_filepaths_containing"]] +exclude_paths <- conf[["filter"]][["remove_filepaths_containing"]] -# Analysis topics (optional) +# Analysis topics topics <- conf[["analysis"]][["topics"]] + ``` # Running the Syntax Extractor @@ -137,7 +138,7 @@ Here’s how you might use it: # Creating annotated XML from source code annotated_file <- annotate_src_text( srcml_path = srcml_path, - src_folder = folder_path, + src_folder = src_folder, srcml_filepath = srcml_filepath ) ``` @@ -276,8 +277,8 @@ It calls query_src_text() with a specific query that looks for class names: ``` {r eval=FALSE} # Extracting class names from the XML class_names <- query_src_text_class_names( - srcml_path = "path/to/srcML", - srcml_filepath = "path/to/output.xml" + srcml_path = srcml_path, + srcml_filepath = srcml_filepath ) # Display the result as a table @@ -302,8 +303,8 @@ Here’s how you might use it: ``` {r eval=FALSE} # Extracting namespaces from the XML namespaces <- query_src_text_namespace( - srcml_path = "path/to/srcML", - srcml_filepath = "path/to/output.xml" + srcml_path = srcml_path, + srcml_filepath = srcml_filepath ) # Display the namespaces