Files
QuanTAlib/.github/sonarscanner.sh
T
Miha Kralj b26d5d7751 Enhance code quality and stability across various modules
- Updated .coderabbit.yaml to exclude additional file types from reviews, improving the focus on relevant code changes.
- Modified scanner.sh to handle test failures more gracefully, ensuring that analysis stops on test failures and improving logging.
- Improved sonarscanner.sh to ensure build and test failures are properly reported, enhancing CI reliability.
- Refined SimdExtensions.cs documentation for clarity on variance calculation methods.
- Cleaned up TSeries.Tests.cs by simplifying the test structure and ensuring proper namespace usage.
- Fixed potential issues in tseries.cs by ensuring correct handling of DateTime values.
- Enhanced CsvFeed.cs to improve error handling during CSV parsing, ensuring robustness against malformed data.
- Updated GBM.cs to correctly calculate volume in the current bar, ensuring accurate simulation.
- Adjusted index.html to use globalThis for better compatibility across environments.
- Refined quantalib.csproj to exclude unnecessary files from compilation, streamlining the build process.
- Added comprehensive tests for the Mama class to ensure correct behavior during updates and state management.
- Improved error handling in various trend classes (Kama, Dema, Ema, T3, Tema, Wma) to ensure NaN values are managed correctly.
- Removed redundant Mama.Repro.Tests.cs file and consolidated tests into Mama.Tests.cs for better organization.
- Enhanced T3 and Tema classes to maintain state integrity during updates, particularly with NaN values.
2025-12-10 14:51:58 -05:00

61 lines
1.5 KiB
Bash

#!/bin/bash
set -euo pipefail
# Static Analysis Scanner for QuanTAlib
# Runs SonarCloud and Qodana with code coverage
# Tokens must be set as environment variables
if [[ -z "${SONAR_TOKEN:-}" ]]; then
echo "Error: SONAR_TOKEN environment variable not set"
exit 1
fi
if [[ -z "${QODANA_TOKEN:-}" ]]; then
echo "Error: QODANA_TOKEN environment variable not set"
exit 1
fi
# Coverage output directory for Qodana
COVERAGE_DIR=".qodana/code-coverage"
# Run SonarCloud
echo "==> Starting SonarScanner analysis..."
dotnet sonarscanner begin \
/o:"mihakralj-quantalib" \
/k:"mihakralj_QuanTAlib" \
/d:sonar.token="$SONAR_TOKEN" \
/d:sonar.cs.opencover.reportsPaths="**/coverage.opencover.xml"
echo "==> Building solution..."
dotnet build --no-incremental
if [ $? -ne 0 ]; then
echo "Error: Build failed"
exit 1
fi
echo "==> Running tests with coverage..."
mkdir -p "$COVERAGE_DIR"
dotnet test --no-build --collect:"XPlat Code Coverage" \
-- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=lcov,opencover
if [ $? -ne 0 ]; then
echo "Error: Tests failed"
exit 1
fi
# Copy coverage to Qodana directory
find . -name "coverage.info" -exec cp {} "$COVERAGE_DIR/" \;
dotnet sonarscanner end /d:sonar.token="$SONAR_TOKEN"
echo "==> SonarCloud: https://sonarcloud.io/project/overview?id=mihakralj_QuanTAlib"
# Run Qodana
echo "==> Starting Qodana analysis..."
QODANA_TOKEN="$QODANA_TOKEN" qodana scan \
--coverage-dir "$COVERAGE_DIR"
echo "==> Qodana analysis complete"
echo "==> Done!"