diff --git a/.env b/.env index acc037f..27b4da3 100644 --- a/.env +++ b/.env @@ -1 +1 @@ -SCANNER_VERSION=v0.1 \ No newline at end of file +SCANNER_VERSION=v0.2 \ No newline at end of file diff --git a/README.md b/README.md index 6ec4102..2613f19 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ # SFDX Scanner Wrapper This is a set of scanner commands for Salesforce development -## Version: 0.1 +## Version: 0.2 ## Usage ``` -wget https://github.com/Ko-Sit/salesforce-code-review/releases/download/0.1/scanner-v0.1.zip # release zip url +wget https://github.com/Ko-Sit/salesforce-code-review/releases/download/0.2/scanner-v0.2.zip # release zip url -unzip scanner-v0.1.zip +unzip scanner-v0.2.zip chmod +x ./scanner/run.sh # optional diff --git a/scripts/scanner/apex/scan_pmd_apex.sh b/scripts/scanner/apex/scan_pmd_apex.sh index 2e0f4c6..6608e62 100644 --- a/scripts/scanner/apex/scan_pmd_apex.sh +++ b/scripts/scanner/apex/scan_pmd_apex.sh @@ -1,17 +1,10 @@ #!/bin/bash source ./scanner/pre/variables.sh -REPORT_NAME="scan-pmd-apex" -REPORT_PATH="$REPORT_FOLDER/$REPORT_NAME" -REPORT_CSV="$REPORT_PATH.csv" -REPORT_XML="$REPORT_PATH.xml" +REPORT_NAME="scan-pmd-apex.html" +REPORT_HTML="$REPORT_FOLDER/$REPORT_NAME" PMD_CONFIG_APEX="./scanner/rules/pmd-ruleset-apex.xml" -sfdx scanner:run --format csv \ +sfdx scanner:run --format html \ --target $TARGET_SOURCE \ --pmdconfig $PMD_CONFIG_APEX \ --engine pmd \ - --outfile $REPORT_CSV -sfdx scanner:run --format junit \ - --target $TARGET_SOURCE \ - --pmdconfig $PMD_CONFIG_APEX \ - --engine pmd \ - --outfile $REPORT_XML + --outfile $REPORT_HTML diff --git a/scripts/scanner/cpd/scan_copy_paste.sh b/scripts/scanner/cpd/scan_copy_paste.sh index 2d8e6ad..2072df2 100755 --- a/scripts/scanner/cpd/scan_copy_paste.sh +++ b/scripts/scanner/cpd/scan_copy_paste.sh @@ -1,8 +1,11 @@ #!/bin/bash source ./scanner/pre/variables.sh -REPORT_NAME="scan-duplicate-code.csv" -REPORT_PATH="$REPORT_FOLDER/$REPORT_NAME" +REPORT_NAME="scan-duplicate-code.html" +REPORT_HTML="$REPORT_FOLDER/$REPORT_NAME" export NODE_OPTIONS=--max_old_space_size=4096 # avoid heap limit -sfdx scanner:run --target $TARGET_SOURCE_CPD --engine cpd --outfile $REPORT_PATH +sfdx scanner:run --format html \ + --target $TARGET_SOURCE_CPD \ + --engine cpd \ + --outfile $REPORT_HTML diff --git a/scripts/scanner/lwc/scan_eslint_lwc.sh b/scripts/scanner/lwc/scan_eslint_lwc.sh index ca3840d..99ec216 100755 --- a/scripts/scanner/lwc/scan_eslint_lwc.sh +++ b/scripts/scanner/lwc/scan_eslint_lwc.sh @@ -1,9 +1,9 @@ #!/bin/bash source ./scanner/pre/variables.sh -REPORT_NAME="scan-eslint-lwc.csv" -REPORT_PATH="$REPORT_FOLDER/$REPORT_NAME" +REPORT_NAME="scan-eslint-lwc.html" +REPORT_HTML="$REPORT_FOLDER/$REPORT_NAME" sfdx scanner:run --engine "eslint-lwc" \ - --format csv \ + --format html \ --category "LWC" \ - --outfile $REPORT_PATH \ + --outfile $REPORT_HTML \ --target $TARGET_SOURCE_LWC diff --git a/scripts/scanner/lwc/scan_pmd_js.sh b/scripts/scanner/lwc/scan_pmd_js.sh index 862bfa9..8612390 100755 --- a/scripts/scanner/lwc/scan_pmd_js.sh +++ b/scripts/scanner/lwc/scan_pmd_js.sh @@ -1,17 +1,10 @@ #!/bin/bash source ./scanner/pre/variables.sh -REPORT_NAME="scan-pmd-js" -REPORT_PATH="$REPORT_FOLDER/$REPORT_NAME" -REPORT_CSV="$REPORT_PATH.csv" -REPORT_XML="$REPORT_PATH.xml" +REPORT_NAME="scan-pmd-js.html" +REPORT_HTML="$REPORT_FOLDER/$REPORT_NAME" PMD_CONFIG_JS="./scanner/rules/pmd-ruleset-js.xml" -sfdx scanner:run --format csv \ +sfdx scanner:run --format html \ --target $TARGET_SOURCE \ --pmdconfig $PMD_CONFIG_JS \ --engine pmd \ - --outfile $REPORT_CSV -sfdx scanner:run --format junit \ - --target $TARGET_SOURCE \ - --pmdconfig $PMD_CONFIG_JS \ - --engine pmd \ - --outfile $REPORT_XML + --outfile $REPORT_HTML diff --git a/scripts/scanner/post/beautify_reports.sh b/scripts/scanner/post/beautify_reports.sh deleted file mode 100644 index df4c07c..0000000 --- a/scripts/scanner/post/beautify_reports.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -source ./scanner/pre/variables.sh -INITIAL_FILE_PATH="$PWD/" -REPLACE_FILE_PATH="\/" -echo "running reports beautify: trim path $INITIAL_FILE_PATH" -SEARCH_PATH="${INITIAL_FILE_PATH//\//\\/}" -# decrease file path in csv with stream editor -# sed -i '' -e "s/\/Users.*default\//\//" "reports/duplicate-code-detection.csv" -FILES="./$REPORT_FOLDER/*" -for file in $FILES; do - sed -i '' \ - -e "s/$SEARCH_PATH/$REPLACE_FILE_PATH/" \ - $file -done - - diff --git a/scripts/scanner/post/generate_html.sh b/scripts/scanner/post/generate_html.sh deleted file mode 100644 index 98738eb..0000000 --- a/scripts/scanner/post/generate_html.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -source ./scanner/pre/variables.sh - -FILES="./$REPORT_FOLDER/*.xml" -for report_file in $FILES; do - report_html=${report_file/.xml/.html} - xunit-viewer --results $report_file -o $report_html -done diff --git a/scripts/scanner/post/run.sh b/scripts/scanner/post/run.sh index 128112c..db0e1f2 100644 --- a/scripts/scanner/post/run.sh +++ b/scripts/scanner/post/run.sh @@ -1,4 +1,3 @@ #!/bin/bash echo "running post-run" -bash ./scanner/post/beautify_reports.sh -bash ./scanner/post/generate_html.sh \ No newline at end of file +# bash ./scanner/post/beautify_reports.sh \ No newline at end of file diff --git a/scripts/scanner/visualforce/scan_pmd_vf.sh b/scripts/scanner/visualforce/scan_pmd_vf.sh index 7762c2f..a2ff03d 100644 --- a/scripts/scanner/visualforce/scan_pmd_vf.sh +++ b/scripts/scanner/visualforce/scan_pmd_vf.sh @@ -1,17 +1,10 @@ #!/bin/bash source ./scanner/pre/variables.sh -REPORT_NAME="scan-pmd-visualforce" -REPORT_PATH="$REPORT_FOLDER/$REPORT_NAME" -REPORT_CSV="$REPORT_PATH.csv" -REPORT_XML="$REPORT_PATH.xml" +REPORT_NAME="scan-pmd-visualforce.html" +REPORT_HTML="$REPORT_FOLDER/$REPORT_NAME" PMD_CONFIG_VF="./scanner/rules/pmd-ruleset-vf.xml" -sfdx scanner:run --format csv \ +sfdx scanner:run --format html \ --target $TARGET_SOURCE \ --pmdconfig $PMD_CONFIG_VF \ --engine pmd \ - --outfile $REPORT_CSV -sfdx scanner:run --format junit \ - --target $TARGET_SOURCE \ - --pmdconfig $PMD_CONFIG_VF \ - --engine pmd \ - --outfile $REPORT_XML + --outfile $REPORT_HTML \ No newline at end of file