Skip to content

fix: clear the analyzer warnings in src - #109

Merged
phmatray merged 1 commit into
devfrom
fix/src-analyzer-warnings
Jul 27, 2026
Merged

fix: clear the analyzer warnings in src#109
phmatray merged 1 commit into
devfrom
fix/src-analyzer-warnings

Conversation

@phmatray

Copy link
Copy Markdown
Owner

Clears every instance of the four warning classes CI reported. GitHub caps annotations at 10 per job, so the reported list was a subset — this covers all of them.

Warning Reported Actually present Fixed
CS1587 — XML comment not on a valid element 3 9 9
CS1573 — missing <param> tag 4 4 4
IDE0290 — use primary constructor 1 1 1
IDE0046 — if can be simplified 2 2 2

CS1587 — nine result records

Each file ended with a documentation block describing the inherited Real property, sitting after the last member with no element to attach to.

The text was useful domain detail — the range DX takes, what a dominant-cycle period means — so it moved into the class-level <remarks> rather than being deleted:

/// <remarks>
/// The <see cref="SingleOutputResult.Real"/> array holds the Directional Movement Index values.
/// Values range from 0 to 100, where higher values indicate stronger trends (either up or down).
/// Values below 20 typically indicate weak trends, while values above 40 suggest strong trends.
/// </remarks>

CorrelResult's block only restated what its existing <remarks> already said, so that one is simply removed.

CS1573 — four float[] overloads

Each takes an optional parameter the documentation never mentioned. One of them was actively misleading: MacdFix claimed "Uses fixed values: fastPeriod=12, slowPeriod=26, signalPeriod=9" while signalPeriod was in fact a settable parameter. It now says the fast and slow periods are fixed and the signal period is adjustable.

IDE0290 — CandleIndicator<T>

Converted to a primary constructor, with the parameter documentation moved onto the type. The generated constructor signature is unchanged, so this is source and binary compatible — and it's the base class for all 61 candlestick patterns, so the 673 candle tests are the real check.

IDE0046 — ValidationHelper

ValidateIndexRange becomes a conditional cascade.

ValidateSingleInputIndicator was a hand-rolled guard chain. Rather than nest three ternaries to satisfy the analyzer, it now calls the ValidateAll helper this same class already exposes and the indicators already use (see Atr/TAFunc.cs):

return ValidateAll(
    () => ValidateIndexRange(startIdx, endIdx),
    () => ValidateArrays(inReal, outReal),
    () => optInTimePeriod.HasValue
        ? ValidatePeriodRange(optInTimePeriod.Value, minPeriod, maxPeriod)
        : Success);

One expression, still short-circuiting at the first failure, and lazier than the original — each check now only runs if the previous one passed.

Verification

dotnet build TaLibStandard.sln -c Release   ->  0 errors
grep for CS1587|CS1573|IDE0290|IDE0046 in src  ->  no matches

dotnet test TaLibStandard.sln -c Release
  Candles.UnitTests              673 passed
  Functions.UnitTests            232 passed
  Samples.Backtesting.UnitTests  220 passed
  ->  1125 passed, 0 failed

One thing to know

The generated pages under docs/functions/ and docs/common/ now lag these XML comment changes. I deliberately did not regenerate them: this machine emits different character encoding than the committed output (&#129106; vs ), so regenerating would bury a 15-file change under ~175 spurious diffs — exactly what went wrong on #106.

They should be regenerated on a machine whose encoding matches, or the encoding should be pinned so this stops being a trap for contributors.

Worth noting on the IDE0046 rule specifically: .editorconfig line 83 sets dotnet_style_prefer_conditional_expression_over_return = true:silent, but AnalysisModeStyle=All in Directory.Build.props escalates it to a warning anyway. The .editorconfig's stated intent is being overridden. Worth reconciling those two if the style rules keep surfacing.

🤖 Generated with Claude Code

Four classes of warning, all real:

CS1587 in nine result records. Each file ended with a documentation block
describing the inherited Real property, sitting after the last member with no
element to attach to. The text was useful domain detail - the range DX takes,
what a dominant-cycle period means - so it moved into the class-level <remarks>
rather than being deleted. CorrelResult's block only restated what its <remarks>
already said, so that one is gone.

CS1573 in four float overloads. Each takes an optional parameter that the
documentation never mentioned. MacdFix also claimed "Uses fixed values:
fastPeriod=12, slowPeriod=26, signalPeriod=9" while signalPeriod was in fact a
parameter; it now says the fast and slow periods are fixed and the signal period
is adjustable.

IDE0290 on CandleIndicator<T>, now a primary constructor with the parameter
documentation moved onto the type. Same generated constructor signature, so it
is source and binary compatible.

IDE0046 twice in ValidationHelper. ValidateIndexRange becomes a conditional
cascade. ValidateSingleInputIndicator was a hand-rolled guard chain, so it now
calls the ValidateAll helper this class already exposes and the indicators
already use - one expression, still short-circuiting at the first failure, and
lazier than the original since each check only runs if the previous passed.

Verified: 0 errors, all four warning classes gone from src, and 1125 tests pass
including the 673 candlestick tests that exercise CandleIndicator<T> through its
new constructor.

Note: the generated pages under docs/functions and docs/common now lag these XML
comment changes. They are deliberately not regenerated here - this machine emits
different character encoding than the committed output, so regenerating would
bury a 15-file change under ~175 spurious diffs.
@phmatray
phmatray merged commit 613d250 into dev Jul 27, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant