Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.

[BUG] No error code returned for technical-debt metric #770

Open
NickBalnaves opened this issue Mar 27, 2022 · 7 comments
Open

[BUG] No error code returned for technical-debt metric #770

NickBalnaves opened this issue Mar 27, 2022 · 7 comments
Assignees
Labels
area-metrics type: bug Something isn't working

Comments

@NickBalnaves
Copy link

NickBalnaves commented Mar 27, 2022

  • Dart code metrics version: 4.13.0
  • Dart sdk version: 2.16.1

Please show your full configuration:

Configuration
dart_code_metrics:
  metrics:
    technical-debt:
      threshold: 0
      todo-cost: 0
      deprecated-annotations-cost: 0
      ignore-cost: 1
      ignore-for-file-cost: 0
      as-dynamic-cost: 0
      file-nullsafety-migration-cost: 0

What did you do? Please include the source code example causing the issue.

dart run dart_code_metrics:metrics analyze lib --fatal-style --fatal-performance --fatal-warnings

What did you expect to happen?
The above command to return an error code when using an ignore rule comment.

What actually happened?
There was an alarm raised for technical debt but no error code was returned. Even when setting --set-exit-on-violation-level there is no error code returned.

Are you willing to submit a pull request to fix this bug?
No

@dkrutskikh
Copy link
Member

@NickBalnaves can you provide full cli command with --set-exit-on-violation-level ?

@dkrutskikh dkrutskikh added type: bug Something isn't working area-metrics awaiting info Requires more information from the customer to progress labels Mar 27, 2022
@NickBalnaves
Copy link
Author

@dkrutskikh
dart run dart_code_metrics:metrics analyze lib --fatal-style --fatal-performance --fatal-warnings --set-exit-on-violation-level=warning
and
dart run dart_code_metrics:metrics analyze lib --fatal-style --fatal-performance --fatal-warnings --set-exit-on-violation-level=alarm

Just noticed using the noted level returns an error code when there is an alarm:
dart run dart_code_metrics:metrics analyze lib --fatal-style --fatal-performance --fatal-warnings --set-exit-on-violation-level=noted

@github-actions github-actions bot removed the awaiting info Requires more information from the customer to progress label Mar 27, 2022
@NickBalnaves
Copy link
Author

On further inspection dart run dart_code_metrics:metrics analyze lib --fatal-style --fatal-performance --fatal-warnings --set-exit-on-violation-level=noted returns an error code even when there are no issues

@NickBalnaves
Copy link
Author

@dkrutskikh @incendial any idea? Bit annoying since it avoids enforcing these rules during CI checks

@dkrutskikh
Copy link
Member

@NickBalnaves sorry for long response. I think set --set-exit-on-violation-level=noted not a good idea. Please look at this:

  if (value > warningLevel * 2) {
    return MetricValueLevel.alarm;
  } else if (value > warningLevel) {
    return MetricValueLevel.warning;
  } else if (value > warningLevel * 0.8) {
    return MetricValueLevel.noted;
  }

You can faced noted level in html report. We mark method or class by noted level if that now close to warning level.

@NickBalnaves
Copy link
Author

@dkrutskikh thanks for that information, there is still a problem with the warning level not returning an error code though?

@BrutalCoding
Copy link

BrutalCoding commented May 1, 2022

Facing the same issue. I've got a threshold set for tech debt and no error is returned even though its being exceeded.

I've got the following turned as well, so I expect that if treshhold is being exceeded that my commit has failed the checks but it shows me a green check every time 😢:

fatal_warnings: true
fatal_style: true
fatal_performance: true

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-metrics type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants