dart-code-checker / dart-code-metrics

Software analytics tool that helps developers analyse and improve software quality.
https://dcm.dev
Other
860 stars 265 forks source link

[BUG] (Can't undo exclude) #1225

Closed Nana-Kwame-bot closed 1 year ago

Nana-Kwame-bot commented 1 year ago

Environment and configuration

DCM version: 5.7.2 Dart SDK version: >=2.19.5 <3.0.0

Configuration ```yaml analyzer: language: strict-inference: true strict-raw-types: true # Dart Code Metrics uses plugins api from the analyzer # to provide issues highlight in the IDE. If you don't want the issues # to be shown and need only the CLI, you need to remove the section below. plugins: - dart_code_metrics strong-mode: implicit-casts: false implicit-dynamic: false exclude: - "build/**" - "**/*.g.dart" - "**/*.freezed.dart" - "**/*.gr.dart" dart_code_metrics: # Dart Code Metrics supports presets. The config from a preset will be merged # with the config listed in this file. The config listed here has a higher priority. # Any rule can be simply disabled by setting `- rule-name: false`. # Uncomment the section below to see how presets work. extends: - package:dart_code_metrics/presets/all.yaml # To enabled anti-patterns and metrics in the analysis report, uncomment the sections below. # Metric violations are not shown in the IDE. anti-patterns: - long-method - long-parameter-list metrics: cyclomatic-complexity: 20 maintainability-index: 50 maximum-nesting: 5 number-of-parameters: 5 source-lines-of-code: 50 technical-debt: threshold: 16 todo-cost: 4 ignore-cost: 8 ignore-for-file-cost: 16 as-dynamic-cost: 16 deprecated-annotations-cost: 2 file-nullsafety-migration-cost: 2 unit-type: "hours" # Dart Code Metics provides custom configurable rules. # The rules have a `kebab-case` naming instead of # `snake_case` intentionally in order for you to identify, # whether the rule is from Dart Code Metrics or the standard analyzer. # All rules share basic configuration like `exclude` section, # but some also have a rule-specific one. # Not all rules are listed here, the full list can be found on our website: https://dartcodemetrics.dev/docs/rules rules: - avoid-top-level-members-in-tests - avoid-collection-methods-with-unrelated-types - avoid-missing-enum-constant-in-map - avoid-unnecessary-type-assertions - avoid-unnecessary-type-casts - avoid-unused-parameters - newline-before-return - no-boolean-literal-compare - no-empty-block - no-equal-arguments: false - no-equal-then-else - no-magic-number: false - prefer-async-await - prefer-correct-type-name: max-length: 44 - prefer-match-file-name: exclude: - test/** - prefer-trailing-comma ```

What did you do?

Clicked on exclude in the pop up window

What did you expect to happen?

I expected the rule to be excluded for the particular line/file at the top or at least added to the analysis_options.yaml.

What actually happened?

I realized that the exclude button doesn't actually take away the warning and now I'm just forced to look at the squiggly lines. I can't undo the exclusion or re-exclude it, just a link to the lint page.

Participation

Additional comments

I think this is due to a plugin error but I don't know where to go to reset things.

incendial commented 1 year ago

What exclude button you're talking about?

Nana-Kwame-bot commented 1 year ago

Images showing the issues. Hopefully I'm permitted to link images. As you can see there, it's possible to exclude the lint. I'm not sure what the button does but once it's pressed, it disappears alongside the definition and docs button.

incendial commented 1 year ago

It's not our diagnostic, please see https://github.com/dart-lang/sdk

Nana-Kwame-bot commented 1 year ago

I don't get this. What should be the expected result when I click on the exclude button? That was my first time clicking it and if it's a dart sdk issue where is it coming from? I'm asking so that I could create an appropriate issue there, I need to know the expected outcome from this package.

incendial commented 1 year ago

This package has nothing to do with this button. Its presence and behaviour is provided by the IntelliJ / AS Analyzer integration. Maybe even there https://github.com/flutter/flutter-intellij/issues is a better place to ask.

Nana-Kwame-bot commented 1 year ago

Good to know, thanks.

incendial commented 1 year ago

Actually, rereading the issue and here is what happens: you have 2 different issues displayed, one of them is standard (with the buttons) and another is ours (comes from the plugin, which does not have buttons).

incendial commented 1 year ago

What IDE you use, btw? By screenshots I assumed it's IntelliJ / AS, but now I'm not sure.

incendial commented 1 year ago

And the plugin has no control what buttons are visible, only the problems in the IDE.

incendial commented 1 year ago

If you need to exclude problems that come from our plugin, you can manually type // ignore: or // ignore_for_file: with a desired rule id.

Nana-Kwame-bot commented 1 year ago

What IDE you use, btw? By screenshots I assumed it's IntelliJ / AS, but now I'm not sure.

I'm using VSCode. I just opened the app in Android studio and it looks like those buttons aren't supported. Looks like a vscode issue atm.

If you need to exclude problems that come from our plugin, you can manually type // ignore: or // ignore_for_file: with a desired rule id.

I have done that. I just thought it was a shame I no longer got access to the definition and docs buttons.

And the plugin has no control what buttons are visible, only the problems in the IDE.

Just realized that after opening it in Android studio.

incendial commented 1 year ago

I'm using VSCode.

Ah, my bad.

I have done that. I just thought it was a shame I no longer got access to the definition and docs buttons.

Yeah, that's a bit odd. Here is the repo for VS Code Dart integration https://github.com/Dart-Code/Dart-Code