mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-20 11:38:05 +00:00
feat: sync Sonar rule suppressions across SonarCloud, Codacy, and local builds
This commit is contained in:
@@ -32,21 +32,39 @@ resharper_generic_enumerator_not_disposed_highlighting = hint
|
|||||||
# Sonar rule suppressions (synced from sonar-suppressions.json)
|
# Sonar rule suppressions (synced from sonar-suppressions.json)
|
||||||
# See sonar-suppressions.json for detailed justifications
|
# See sonar-suppressions.json for detailed justifications
|
||||||
dotnet_diagnostic.S107.severity = none
|
dotnet_diagnostic.S107.severity = none
|
||||||
|
dotnet_diagnostic.S109.severity = none
|
||||||
|
dotnet_diagnostic.S122.severity = none
|
||||||
|
dotnet_diagnostic.S134.severity = none
|
||||||
|
dotnet_diagnostic.S138.severity = none
|
||||||
|
dotnet_diagnostic.S1067.severity = none
|
||||||
dotnet_diagnostic.S1144.severity = none
|
dotnet_diagnostic.S1144.severity = none
|
||||||
|
dotnet_diagnostic.S1227.severity = none
|
||||||
dotnet_diagnostic.S1244.severity = none
|
dotnet_diagnostic.S1244.severity = none
|
||||||
|
dotnet_diagnostic.S1309.severity = none
|
||||||
|
dotnet_diagnostic.S1451.severity = none
|
||||||
|
dotnet_diagnostic.S1541.severity = none
|
||||||
|
dotnet_diagnostic.S1659.severity = none
|
||||||
dotnet_diagnostic.S1944.severity = none
|
dotnet_diagnostic.S1944.severity = none
|
||||||
dotnet_diagnostic.S2053.severity = none
|
dotnet_diagnostic.S2053.severity = none
|
||||||
dotnet_diagnostic.S2245.severity = none
|
dotnet_diagnostic.S2245.severity = none
|
||||||
dotnet_diagnostic.S2259.severity = none
|
dotnet_diagnostic.S2259.severity = none
|
||||||
|
dotnet_diagnostic.S2360.severity = none
|
||||||
dotnet_diagnostic.S2583.severity = none
|
dotnet_diagnostic.S2583.severity = none
|
||||||
dotnet_diagnostic.S2589.severity = none
|
dotnet_diagnostic.S2589.severity = none
|
||||||
dotnet_diagnostic.S3236.severity = none
|
dotnet_diagnostic.S3236.severity = none
|
||||||
|
dotnet_diagnostic.S3254.severity = none
|
||||||
|
dotnet_diagnostic.S3264.severity = none
|
||||||
dotnet_diagnostic.S3329.severity = none
|
dotnet_diagnostic.S3329.severity = none
|
||||||
dotnet_diagnostic.S3604.severity = none
|
dotnet_diagnostic.S3604.severity = none
|
||||||
dotnet_diagnostic.S3655.severity = none
|
dotnet_diagnostic.S3655.severity = none
|
||||||
dotnet_diagnostic.S3776.severity = none
|
dotnet_diagnostic.S3776.severity = none
|
||||||
|
dotnet_diagnostic.S3904.severity = none
|
||||||
|
dotnet_diagnostic.S3906.severity = none
|
||||||
|
dotnet_diagnostic.S3908.severity = none
|
||||||
dotnet_diagnostic.S3949.severity = none
|
dotnet_diagnostic.S3949.severity = none
|
||||||
dotnet_diagnostic.S3966.severity = none
|
dotnet_diagnostic.S3966.severity = none
|
||||||
|
dotnet_diagnostic.S3990.severity = none
|
||||||
|
dotnet_diagnostic.S3992.severity = none
|
||||||
dotnet_diagnostic.S4158.severity = none
|
dotnet_diagnostic.S4158.severity = none
|
||||||
dotnet_diagnostic.S4347.severity = none
|
dotnet_diagnostic.S4347.severity = none
|
||||||
dotnet_diagnostic.S5773.severity = none
|
dotnet_diagnostic.S5773.severity = none
|
||||||
|
|||||||
@@ -817,103 +817,3 @@ jobs:
|
|||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
Codacy_Upload:
|
Codacy_Upload:
|
||||||
needs: [ReSharper_Analysis, Snyk_Scan, Semgrep_Scan, Sonar_Analysis, Codacy_Rule_Sync]
|
needs: [ReSharper_Analysis, Snyk_Scan, Semgrep_Scan, Sonar_Analysis, Codacy_Rule_Sync]
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 10
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
actions: read
|
|
||||||
if: always()
|
|
||||||
steps:
|
|
||||||
- name: Check for Codacy token
|
|
||||||
id: check_token
|
|
||||||
env:
|
|
||||||
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
|
||||||
run: |
|
|
||||||
if [ -z "${CODACY_PROJECT_TOKEN:-}" ]; then
|
|
||||||
echo "CODACY_PROJECT_TOKEN not set. Skipping Codacy uploads."
|
|
||||||
echo "skip=true" >> "$GITHUB_OUTPUT"
|
|
||||||
else
|
|
||||||
echo "skip=false" >> "$GITHUB_OUTPUT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Download SARIF artifacts
|
|
||||||
if: steps.check_token.outputs.skip != 'true'
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
pattern: sarif-*
|
|
||||||
path: sarif
|
|
||||||
|
|
||||||
- name: Download Coverage Reports
|
|
||||||
if: steps.check_token.outputs.skip != 'true'
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: coverage-reports
|
|
||||||
path: coverage-merged
|
|
||||||
|
|
||||||
- name: List artifacts
|
|
||||||
if: steps.check_token.outputs.skip != 'true'
|
|
||||||
run: |
|
|
||||||
echo "SARIF files:"
|
|
||||||
find sarif -name "*.sarif" -type f -maxdepth 4 -print -exec ls -lh {} \; || true
|
|
||||||
echo ""
|
|
||||||
echo "Coverage files:"
|
|
||||||
ls -la coverage-merged || true
|
|
||||||
|
|
||||||
- name: Install Codacy CLI v2
|
|
||||||
if: steps.check_token.outputs.skip != 'true'
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# Install Codacy CLI using official bootstrap script
|
|
||||||
echo "Installing Codacy CLI v2..."
|
|
||||||
|
|
||||||
sudo curl -Ls https://raw.githubusercontent.com/codacy/codacy-cli-v2/main/codacy-cli.sh -o /usr/local/bin/codacy-cli
|
|
||||||
sudo chmod +x /usr/local/bin/codacy-cli
|
|
||||||
|
|
||||||
# Script will fetch binary if needed
|
|
||||||
codacy-cli version
|
|
||||||
|
|
||||||
- name: Upload SARIF files to Codacy
|
|
||||||
if: steps.check_token.outputs.skip != 'true'
|
|
||||||
env:
|
|
||||||
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
shopt -s nullglob globstar
|
|
||||||
files=(sarif/**/*.sarif)
|
|
||||||
|
|
||||||
if [ ${#files[@]} -eq 0 ]; then
|
|
||||||
echo "No SARIF files found. Nothing to upload."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Uploading ${#files[@]} SARIF file(s) to Codacy with commit: ${COMMIT_UUID}"
|
|
||||||
for sarif_file in "${files[@]}"; do
|
|
||||||
echo "--- Uploading: $sarif_file ---"
|
|
||||||
# Using short flags per codacy-cli-v2 docs:
|
|
||||||
# -s: SARIF file path
|
|
||||||
# -c: commit UUID
|
|
||||||
# -t: project token
|
|
||||||
codacy-cli upload \
|
|
||||||
-s "$sarif_file" \
|
|
||||||
-c "$COMMIT_UUID" \
|
|
||||||
-t "$CODACY_PROJECT_TOKEN" \
|
|
||||||
|| echo "WARNING: failed to upload $sarif_file"
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Upload Coverage to Codacy
|
|
||||||
if: steps.check_token.outputs.skip != 'true'
|
|
||||||
env:
|
|
||||||
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
curl -Ls https://coverage.codacy.com/get.sh -o codacy-coverage.sh
|
|
||||||
chmod +x codacy-coverage.sh
|
|
||||||
|
|
||||||
if [ -f "coverage-merged/Cobertura.xml" ]; then
|
|
||||||
./codacy-coverage.sh report -r "coverage-merged/Cobertura.xml"
|
|
||||||
else
|
|
||||||
echo "Cobertura.xml not found. Skipping coverage upload."
|
|
||||||
fi
|
|
||||||
|
|||||||
+73
-1
@@ -81,6 +81,78 @@
|
|||||||
{
|
{
|
||||||
"id": "S6781",
|
"id": "S6781",
|
||||||
"reason": "JWT tokens should not be created using insecure secrets - not applicable to this codebase"
|
"reason": "JWT tokens should not be created using insecure secrets - not applicable to this codebase"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "S109",
|
||||||
|
"reason": "Magic numbers should be replaced with named constants - numeric literals in SIMD/math algorithms are intentional and self-documenting"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "S122",
|
||||||
|
"reason": "Statements should be on separate lines - compact initialization patterns improve readability in coefficient setup"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "S134",
|
||||||
|
"reason": "Control flow statements should not be nested too deeply - complex algorithms require nested loops"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "S138",
|
||||||
|
"reason": "Methods should not have too many lines - SIMD batch calculations are intentionally monolithic for performance"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "S1067",
|
||||||
|
"reason": "Expressions should not be too complex - validation guard clauses benefit from compound conditions"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "S1227",
|
||||||
|
"reason": "Break statements should not be used - early exit patterns improve performance in search loops"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "S1309",
|
||||||
|
"reason": "Track uses of in-source issue suppressions - intentional suppressions are documented"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "S1451",
|
||||||
|
"reason": "File headers should match a defined format - no file header requirement for this project"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "S1541",
|
||||||
|
"reason": "Cyclomatic complexity should not be too high - optimized algorithms require complex control flow"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "S1659",
|
||||||
|
"reason": "Multiple variables should not be declared on the same line - SIMD register declarations benefit from grouping"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "S2360",
|
||||||
|
"reason": "Optional parameters should not be used - optional parameters are idiomatic for indicator constructors"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "S3254",
|
||||||
|
"reason": "Default parameter values should not be passed as arguments - explicit defaults improve clarity"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "S3264",
|
||||||
|
"reason": "Events should be invoked - events may be conditionally invoked or used for chaining"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "S3904",
|
||||||
|
"reason": "Assemblies should have version information - version is set via Directory.Build.props"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "S3906",
|
||||||
|
"reason": "Event handlers should have the correct signature - custom delegates are used for performance"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "S3908",
|
||||||
|
"reason": "Generic event handlers should be used - TValuePublishedHandler is a performance-optimized custom delegate"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "S3990",
|
||||||
|
"reason": "Assemblies should be marked CLSCompliant - CLS compliance not required for internal library"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "S3992",
|
||||||
|
"reason": "Assemblies should have ComVisible attribute - COM interop not required"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user