mirror of
https://github.com/Graylog2/graylog2-server.git
synced 2026-03-13 09:32:21 +08:00
Adding more code quality metrics. (#16240)
This commit is contained in:
37
.github/scripts/web-code-quality.sh
vendored
Executable file
37
.github/scripts/web-code-quality.sh
vendored
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
|
||||
PROBLEM_COUNT=`jq '. | map(.errorCount + .warningCount)|add' /tmp/report.json`
|
||||
PROBLEM_COUNT_STYLELINT=`jq '. | map(.warnings | length)|add' /tmp/report-stylelint.json`
|
||||
CURRENT_REF=`git rev-parse HEAD`
|
||||
TIMESTAMP=`git show --format=%at $CURRENT_REF|head -1`
|
||||
CRC_USAGES=`grep -lr createReactClass src|wc -l`
|
||||
REFLUX_USAGES=`grep -lr Reflux src|wc -l`
|
||||
|
||||
JS_FILES=`find src -name \*.js -o -name \*.jsx|wc -l`
|
||||
TS_FILES=`find src -name \*.ts -o -name \*.tsx|wc -l`
|
||||
|
||||
ENZYME_TESTS=`grep -lr wrappedEnzyme src|wc -l`
|
||||
TESTING_LIBRARY_TESTS=`grep -lr wrappedTestingLibrary src|wc -l`
|
||||
|
||||
PAYLOAD=$(cat <<- EOF
|
||||
{
|
||||
"version": "1.1",
|
||||
"host": "developermetrics",
|
||||
"job": "fix-linter-hints",
|
||||
"short_message": "Found ${PROBLEM_COUNT} ESLint and ${PROBLEM_COUNT_STYLELINT} Stylelint problems in commit ${CURRENT_REF}",
|
||||
"_problems": ${PROBLEM_COUNT},
|
||||
"_problems_stylelint": ${PROBLEM_COUNT_STYLELINT},
|
||||
"_reflux_usages": ${REFLUX_USAGES},
|
||||
"_create_react_class_usages": ${CRC_USAGES},
|
||||
"_current_ref": "${CURRENT_REF}",
|
||||
"_js_files": ${JS_FILES},
|
||||
"_ts_files": ${TS_FILES},
|
||||
"_enzyme_tests": ${ENZYME_TESTS},
|
||||
"_testing_library_tests": ${TESTING_LIBRARY_TESTS},
|
||||
"timestamp": ${TIMESTAMP}
|
||||
}
|
||||
EOF
|
||||
)
|
||||
|
||||
echo $PAYLOAD|jq .
|
||||
|
||||
19
.github/workflows/fix-linter-hints.yml
vendored
19
.github/workflows/fix-linter-hints.yml
vendored
@@ -51,24 +51,7 @@ jobs:
|
||||
continue-on-error: true
|
||||
working-directory: graylog2-web-interface
|
||||
run: |
|
||||
PROBLEM_COUNT=`jq '. | map(.errorCount + .warningCount)|add' /tmp/report.json`
|
||||
PROBLEM_COUNT_STYLELINT=`jq '. | map(.warnings | length)|add' /tmp/report-stylelint.json`
|
||||
CURRENT_REF=`git rev-parse HEAD`
|
||||
TIMESTAMP=`git show --format=%at $CURRENT_REF|head -1`
|
||||
PAYLOAD=$(cat <<- EOF
|
||||
{
|
||||
"version": "1.1",
|
||||
"host": "developermetrics",
|
||||
"job": "fix-linter-hints",
|
||||
"short_message": "Found ${PROBLEM_COUNT} ESLint and ${PROBLEM_COUNT_STYLELINT} Stylelint problems in commit ${CURRENT_REF}",
|
||||
"_problems": ${PROBLEM_COUNT},
|
||||
"_problems_stylelint": ${PROBLEM_COUNT_STYLELINT},
|
||||
"_current_ref": "${CURRENT_REF}",
|
||||
"timestamp": ${TIMESTAMP}
|
||||
}
|
||||
EOF
|
||||
)
|
||||
curl -X POST -H 'Content-Type: application/json' -d "$PAYLOAD" ${{ secrets.DEV_METRICS_URL }}
|
||||
/bin/sh ../.github/scripts/web-code-quality.sh | curl -X POST -H 'Content-Type: application/json' -d "$PAYLOAD" ${{ secrets.DEV_METRICS_URL }}
|
||||
- name: Create/Update Pull Request
|
||||
uses: Graylog2/create-pull-request@7380612b49221684fefa025244f2ef4008ae50ad
|
||||
with:
|
||||
|
||||
Reference in New Issue
Block a user