dart-code-checker / dart-code-metrics

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

[BUG] metrics stopped working at version 4.12.0 #737

Closed GabrielCR99 closed 2 years ago

GabrielCR99 commented 2 years ago

Please show your full configuration:

Configuration ```yaml include: package:flutter_lints/flutter.yaml analyzer: plugins: - dart_code_metrics exclude: - lib/generated/** - lib/app/modules/**/*.g.dart - lib/app/modules/**/**/*.g.dart - lib/generated_plugin_registrant.dart - "**/*.freezed.dart" errors: prefer_relative_imports: warning constant_identifier_names: warning non_constant_identifier_names: warning unused_import: warning avoid_redundant_argument_values: warning require_trailing_commas: warning always_put_required_named_parameters_first: warning prefer_single_quotes: warning linter: rules: avoid_print: true always_declare_return_types: true always_put_control_body_on_new_line: true cascade_invocations: true prefer_const_constructors: true prefer_relative_imports: true prefer_single_quotes: true prefer_conditional_assignment: true prefer_const_declarations: true avoid_redundant_argument_values: true avoid_types_on_closure_parameters: true require_trailing_commas: true always_put_required_named_parameters_first: true overridden_fields: false unawaited_futures: false eol_at_end_of_file: true join_return_with_assignment: true dart_code_metrics: anti-patterns: - long-method - long-parameter-list metrics: cyclomatic-complexity: 20 maximum-nesting-level: 5 number-of-parameters: 6 source-lines-of-code: 50 halstead-volume: 150 lines-of-code: 100 number-of-methods: 10 weight-of-class: 0.33 metrics-exclude: - test/** rules: - newline-before-return - no-boolean-literal-compare - no-empty-block - prefer-trailing-comma - prefer-conditional-expressions - no-equal-then-else - double-literal-format - prefer-first - prefer-conditional-expressions - prefer-const-border-radius ```

What did you expect to happen? Linter should show warn/info about code, but doesn't show anything even after restarting IDE/PC several times.

What actually happened? The package stopped working at version 4.12.0, but what I actually think is that randomly, it's pointing to pub-cache directory, and not the right directory which is the project one. I don't know how to fix this, I've tried to delete the project and clone it again but it didn't work, unfortunately.

Here's the print for the error:

image

dkrutskikh commented 2 years ago

@GabrielCR99 thank you for report issue. Can you provide analyzer log file ? (for VsCode you can turn on collecting log by set target filename in settings.json)

image
GabrielCR99 commented 2 years ago

Yeah, for sure. Here's my analyzer_log. If you need anything more, I'll have the pleasure to help!

analyzer_log.txt

incendial commented 2 years ago

@GabrielCR99 have you tried downgrading to 4.11?

GabrielCR99 commented 2 years ago

Yeah, I tried to downgrade, but still, it shows error in Analyzer Diagnostics. Actually, the error doesn't make any sense to me, since it's still showing dart_code_metrics version 4.12.0, but in my pubspec it's 4.11.0

image image

What I do suspect is that it's running on my cached pubspec, maybe, but I don't know how to change it's location

dkrutskikh commented 2 years ago

@GabrielCR99 for downgrade you need define version without ^ symbol or use command flutter pub downgrade.

dkrutskikh commented 2 years ago

@GabrielCR99 sorry but I can't find any details about dart code metrics crash. Can you provide analyzer instrumentation log file ?

GabrielCR99 commented 2 years ago

Hey guys, so sorry for the delay in answering. So, what I did was to actually format my PC (not because of the bug, but actually because of my Flutter directory pointing to pub cached). This solved, since as I mentioned, Flutter was pointing to a random directory (which I couldn't find a way to solve, so the solution was format the PC). Anyway, thanks in advance, will continue to use this awesome package!!

incendial commented 2 years ago

@GabrielCR99 great to hear that the problem resolved and thanks for the kind words!