Skip to content

Commit

Permalink
i #313 Update Config File
Browse files Browse the repository at this point in the history
- Remove unused settings
- Change ../ to ../../
- Update notebook to reflect changes

Signed-off-by: Dao McGill <dmcgill@hawaii.edu>
  • Loading branch information
daomcgill committed Oct 18, 2024
1 parent 1b1c95e commit 3b84b8e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 34 deletions.
26 changes: 6 additions & 20 deletions conf/maven.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
29 changes: 15 additions & 14 deletions vignettes/syntax_extractor.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
)
```
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 3b84b8e

Please sign in to comment.