Feature/devin 20260712 sonar cleanup simples#97
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
0037993
into
feature/devin-20260712-sonar-complexidade-metar-chunks-fix
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
| /// </summary> | ||
| /// <param name="rawMetar"></param> | ||
| /// <returns></returns> | ||
| public DecodedMetar ParseNotStrict(string rawMetar) | ||
| public static DecodedMetar ParseNotStrict(string rawMetar) | ||
| { |
There was a problem hiding this comment.
🔍 Breaking public API change: ParseStrict and ParseNotStrict are now static
Converting ParseStrict and ParseNotStrict from instance methods to static methods on both MetarDecoder (src/Metar.Decoder/MetarDecoder.cs:75,87) and TafDecoder (src/Taf.Decoder/TafDecoder.cs:69,81) is a breaking change for any external consumers who call these methods on an instance (e.g., decoder.ParseStrict(...)). While the tests have been updated, any downstream NuGet package consumers would get a compile error after upgrading. This is intentional given the test updates, but should be noted in a CHANGELOG or release notes since this library is published as a NuGet package.
(Refers to lines 75-88)
Was this helpful? React with 👍 or 👎 to provide feedback.
| } | ||
|
|
||
| remaining = ParseEntitiesChunk(evolution, remaining, decodedTaf); | ||
| ParseEntitiesChunk(evolution, remaining, decodedTaf); |
There was a problem hiding this comment.
🔍 EvolutionChunkDecoder.Remaining is never set on the success path
The Remaining property (src/Taf.Decoder/ChunkDecoder/EvolutionChunkDecoder.cs:38) is only set in the early-return path at line 65 when the regex doesn't match. On the success path (line 95), ParseEntitiesChunk is called but its return value is discarded — and Remaining is never assigned. The caller at src/Taf.Decoder/TafDecoder.cs:165 reads evolutionDecoder.Remaining to advance the while loop. When parsing succeeds, Remaining stays null, causing string.IsNullOrEmpty(null) to be true, which terminates the loop. This means only ONE evolution block is parsed per Parse call, and the loop relies on the Consume regex removing the matched evolution from the input so that newRemainingTaf (which is NOT stored in Remaining) advances. This is a pre-existing design issue not introduced by this PR, but the PR's removal of remaining = ParseEntitiesChunk(...) makes it more visible that the return value was always unused.
Was this helpful? React with 👍 or 👎 to provide feedback.
| entityName = VisibilityChunkDecoder.VisibilityParameterName; | ||
| } | ||
| var entity = result.Count > 0 ? result[entityName] : null; | ||
| var entity = result[entityName]; |
There was a problem hiding this comment.
📝 Info: Subtle behavioral change when result dictionary is empty in evolution parsing
The change from var entity = result.Count > 0 ? result[entityName] : null to var entity = result[entityName] at src/Taf.Decoder/ChunkDecoder/EvolutionChunkDecoder.cs:138 changes the exception type thrown when result is empty. Previously, entity would be null and the code would throw a TafChunkDecoderException at line 143. Now, if result is empty, entityName would be null (from FirstOrDefault()) and result[null] would throw a KeyNotFoundException. Both are caught by the generic catch (Exception) at line 158, so the end behavior is similar. In practice, chunk decoders always return non-empty result dictionaries, so this path is unlikely to be reached.
Was this helpful? React with 👍 or 👎 to provide feedback.


All Submissions:
New Feature Submissions:
Changes to Core Features: