Refactor event handling and improve argument validation across indicators

- Updated event handler signatures to use TValueEventArgs for consistency in Mama, Mgdi, Pwma, Rma, Sma, Ssf, Super, T3, Tema, Trima, Usf, Vidya, Wma, and Atr classes.
- Enhanced argument validation by specifying parameter names in exceptions for clarity.
- Adjusted tests to align with new event handler signatures.
- Improved code readability and maintainability by using structured records and lambda expressions.
This commit is contained in:
Miha Kralj
2025-12-27 15:46:28 -08:00
parent 4750c2b1e8
commit d7dbd7078a
73 changed files with 502 additions and 300 deletions
+49 -106
View File
@@ -1,115 +1,58 @@
#-------------------------------------------------------------------------------#
#-------------------------------------------------------------------------------#
# Qodana analysis is configured by qodana.yaml file #
# https://www.jetbrains.com/help/qodana/qodana-yaml.html #
#-------------------------------------------------------------------------------#
version: "1.0"
#Specify inspection profile for code analysis
profile:
name: qodana.starter
name: qodana.recommended
#Enable inspections
#include:
# - name: <SomeEnabledInspectionId>
#Disable inspections
exclude:
# Disable XML documentation comment validation (allows unescaped < > in comments)
- name: XmlDocAnalyzer
- name: InvalidXmlDocComment
# Library project - public API properties are intentionally unused internally
- name: UnusedAutoPropertyAccessor.Global
# Style preference - fully qualified names used intentionally for clarity
- name: RedundantNameQualifier
- name: RCS1036 # Roslyn: Remove redundant empty line
- name: IDE0001 # Simplify name
- name: IDE0002 # Simplify member access
# HIGH-PERFORMANCE LIBRARY EXCLUSIONS
# ------------------------------------
# Flat namespace structure is intentional for this library
- name: CheckNamespace
# Float comparisons are intentional in financial calculations (checking 0.0, NaN, sentinel values)
- name: CompareOfFloatsByEqualityOperator
# Explicit default args improve code clarity and self-documentation
- name: RedundantArgumentDefaultValue
# Platform-specific optimizations (SIMD, intrinsics) are intentional
- name: CA1416 # Validate platform compatibility
# Public API unused internally - this is a library
- name: UnusedMember.Global
- name: MemberCanBePrivate.Global
- name: MemberCanBePrivate.Local
- name: ClassNeverInstantiated.Global
- name: UnusedType.Global
- name: UnusedMethodReturnValue.Global
- name: AutoPropertyCanBeMadeGetOnly.Global
- name: MemberCanBeMadeStatic.Global
- name: MemberCanBeMadeStatic.Local
# Redundant using directives - managed by IDE/build, not critical for library
- name: RedundantUsingDirective
- name: IDE0005 # Remove unnecessary using directives
- name: CS8019 # Unnecessary using directive
# Nullable warning suppressions - used intentionally for null safety patterns
- name: RedundantSuppressNullableWarningExpression
# Redundant type specifications - explicit types used for clarity/documentation
- name: RedundantTypeArgumentsOfMethod
- name: RedundantCast
- name: RedundantExplicitArrayCreation
# Unused local variables - often used in test setup or placeholder code (includes false positives for tuple deconstruction)
- name: UnusedVariable
- name: UnusedVariable.Compiler # False positive for tuple deconstruction
- name: CS0219 # Variable is assigned but never used
- name: RedundantAssignment # Value assigned is not used in any execution path
- name: UnusedAssignment # Assignment is not used
- name: IDE0059 # Unnecessary assignment of a value
# Object initializer in using statement - false positive for simple property setters
- name: CA2000 # Dispose objects before losing scope (overly cautious for simple cases)
- name: UseObjectOrCollectionInitializerWhenPossible
- name: DoNotUseObjectInitializerForUsingVariable
- name: ObjectInitializerMightCauseException
- name: ObjectCreationAsStatement
- name: UseObjectOrCollectionInitializer
- name: UsingStatementResourceInitialization # "Do not use object initializer for 'using' variable"
# Private field can be local variable - test fixtures often use fields for clarity/organization
- name: PrivateFieldCanBeConvertedToLocalVariable
- name: ConvertToLocalFunction
# Code coverage checks - SonarCloud handles coverage, Qodana coverage unreliable
- name: CoverageCheck
- name: ClassCoverageCheck
- name: MethodCoverageCheck
- name: CodeCoverageCheck
# Library-specific exclusions
- name: UnusedMember.Global # Suppresses "Method/Class is never used"
- name: UnusedMethodReturnValue.Global # Suppresses "Return value is never used"
- name: AutoPropertyCanBeMadeGetOnly.Global # Optional: common in libraries
#Execute shell command before Qodana execution (Applied in CI/CD pipeline)
bootstrap: sh ./.github/prepare-qodana.sh
#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline)
#plugins:
# - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com)
#Specify Qodana linter for analysis (Applied in CI/CD pipeline)
#linter: jetbrains/qodana-dotnet:2025.3
linter: jetbrains/qodana-dotnet:2024.3
linter: jetbrains/qodana-dotnet:2025.3
dotnet:
solution: QuanTAlib.sln
coverage:
pathMappings:
- from: /home/runner/work/QuanTAlib/QuanTAlib
to: /data/project
frameworks: "net10.0"
configuration: Release
failureConditions:
severityThresholds:
critical: 0
high: 10
moderate: 50
low: 100
info: -1
exclude:
- name: All
paths:
- "**/bin/**"
- "**/obj/**"
- "**/packages/**"
- "**/TestResults/**"
- "**/.vs/**"
- "**/.vscode/**"
- "**/.idea/**"
- "**/.git/**"
- ".github/**"
- "**/.github/**"
- ".github/TradingPlatform.BusinessLayer.xml"
- "**/TradingPlatform.BusinessLayer.xml"
- "**/.agent/**"
- "**/.codacy/**"
- "**/.config/**"
- "**/.clinerules/**"
- "**/.idea/**"
- "**/.qodana/**"
- "**/.sonarlint/**"
- "**/coverage/**"
- "**/CoverageReport/**"
- "**/archive/**"
- "**/notebooks/**"
- "**/*.Designer.cs"
- "**/*.generated.cs"
- "**/results/**"
- "**/TestResults/**"
- "**/BenchmarkDotNet.Artifacts/**"
- name: InvalidXmlDocComment
- name: EnforceIfStatementBraces
- name: CheckNamespace
- name: LoopCanBeConvertedToQuery