Skip to content

fix: torna DictionaryExtensions public e remove using redundante#103

Merged
afonsoft merged 1 commit into
mainfrom
feature/devin-20260712-sonar-follow-up
Jul 12, 2026
Merged

fix: torna DictionaryExtensions public e remove using redundante#103
afonsoft merged 1 commit into
mainfrom
feature/devin-20260712-sonar-follow-up

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you lint your code locally prior to submission?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Summary

Ajustes finais após Devin Review e Qodana no PR #102.

Código:

  • src/Shared/DictionaryExtensions.cs:
    • Tornou public novamente para evitar redução de API pública em consumidores netstandard2.0/net48
    • Removeu using System.Collections.Generic redundante (namespace do arquivo já é System.Collections.Generic)

Validação

  • dotnet build MetarDecoder.sln --configuration Release OK
  • dotnet test tests/Metar.Decoder.Tests/ net8.0/net10.0 — 242/242 passando
  • dotnet test tests/Taf.Decoder.Tests/ net8.0/net10.0 — 192/192 passando

Motivação

O Devin Review do PR #102 apontou que internal na classe DictionaryExtensions seria uma redução de API pública. Manter public preserva compatibilidade para consumidores que utilizam o polyfill em netstandard2.0/net48. A remoção do using redundante resolve o warning do Qodana.

Link to Devin session: https://app.devin.ai/sessions/94a258020ea4488c8eecc672035d0da1
Requested by: @afonsoft


Open in Devin Review

@afonsoft afonsoft self-assigned this Jul 12, 2026
@afonsoft
afonsoft self-requested a review July 12, 2026 21:28
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@afonsoft

Copy link
Copy Markdown
Owner

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@sonarqubecloud

Copy link
Copy Markdown

@afonsoft
afonsoft merged commit cc4274a into main Jul 12, 2026
14 of 15 checks passed

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 3 potential issues.

Open in Devin Review

/// a built-in GetValueOrDefault method.
/// </summary>
internal static class DictionaryExtensions
public static class DictionaryExtensions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Polyfill helper class made public causes ambiguous method errors for consumers using both packages

The shared dictionary helper is changed from internal to public (public static class DictionaryExtensions at src/Shared/DictionaryExtensions.cs:8), but the same source file is compiled into both library assemblies, so consumers referencing both packages on older runtimes get a duplicate-type compilation error.

Impact: Any project targeting .NET Framework or .NET Standard 2.0 that references both Metar.Decoder and Taf.Decoder will fail to compile with an ambiguous call error.

Mechanism: shared source file compiled into two assemblies with public visibility

The file src/Shared/DictionaryExtensions.cs is included in both src/Metar.Decoder/Metar.Decoder.csproj:71 and src/Taf.Decoder/Taf.Decoder.csproj:71 via <Compile Include>. When the class was internal, each assembly had its own private copy invisible to consumers. Now that it's public, both assemblies export System.Collections.Generic.DictionaryExtensions.GetValueOrDefault<TKey, TValue> with the same signature. A downstream project referencing both assemblies on netstandard2.0 or net48 targets will encounter CS0121 (ambiguous call) when any code calls GetValueOrDefault on a dictionary.

The fix is to revert the class back to internal static class DictionaryExtensions.

Suggested change
public static class DictionaryExtensions
internal static class DictionaryExtensions
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

#if NETFRAMEWORK || NETSTANDARD2_0
using System.Collections.Generic;

namespace System.Collections.Generic

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: Redundant using directive removal is correct

The removed using System.Collections.Generic; at the old line 2 was indeed redundant because the file declares its own namespace as System.Collections.Generic (line 2 in the new file). Types within a namespace don't need to import their own namespace, so this cleanup is valid and has no behavioral impact.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

/// a built-in GetValueOrDefault method.
/// </summary>
internal static class DictionaryExtensions
public static class DictionaryExtensions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 No apparent motivation for the internal-to-public visibility change

There is no InternalsVisibleTo attribute anywhere in the repository, and all usages of GetValueOrDefault are within the two library projects themselves (src/Metar.Decoder/ChunkDecoder/CloudChunkDecoder.cs:87-88 and src/Taf.Decoder/ChunkDecoder/CloudChunkDecoder.cs:75-76). Since the extension method is only called internally and the class was already accessible within each assembly as internal, there appears to be no functional reason to make it public. The commit message says "fix: torna DictionaryExtensions public e remove using redundante" but doesn't explain why public visibility is needed. This should be investigated — if a SonarCloud or Qodana rule triggered this change, the rule should be suppressed rather than exposing an internal polyfill publicly.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@github-actions

Copy link
Copy Markdown

Qodana Community for .NET

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked

View the detailed Qodana report

To be able to view the detailed Qodana report, you can either:

To get *.log files or any other Qodana artifacts, run the action with upload-result option set to true,
so that the action will upload the files as the job artifacts:

      - name: 'Qodana Scan'
        uses: JetBrains/[email protected]
        with:
          upload-result: true
Contact Qodana team

Contact us at [email protected]

@afonsoft
afonsoft deleted the feature/devin-20260712-sonar-follow-up branch July 13, 2026 01:33
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