Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a Codeclimate output formatter #808

Merged
merged 5 commits into from Apr 9, 2022

Conversation

marekstodolny
Copy link

Related to: #807

I based this on the existing JSON output formatter.
Follows this spec: https://github.com/codeclimate/platform/blob/master/spec/analyzers/SPEC.md#data-types

*/
private function addUncovered(array &$violationsArray, Uncovered $violation): void
{
$violationsArray[] = $this->buildRuleArray($violation, $this->getUncoveredMessage($violation), 'info');
Copy link
Author

Choose a reason for hiding this comment

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

Not sure if you want to report uncovered dependencies as info.
Skipped violations are now set to minor and normal violations are set to major.

Codeclimate spec defines following options: info, minor, major, critical, or blocker and we can choose something different

Copy link
Collaborator

Choose a reason for hiding this comment

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

If you are unsure about the level, deptrac allows you to define a config for your output formatter. Look at the GrapvizOutputFormatter for reference. You could let the user decide what should be reporting level for any type of dependencies (skipped, normal, uncovered) with some reasonable default.

Copy link
Author

Choose a reason for hiding this comment

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

Added this to config

@marekstodolny
Copy link
Author

marekstodolny commented Jan 27, 2022

Ready for review
Need to add a few things that were optional in the spec to make this fully work with gitlab

Copy link
Collaborator

@patrickkusebauch patrickkusebauch left a comment

Choose a reason for hiding this comment

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

This looks really good. I especially like how much effort you put into testing,

For it to move forward, we definitely need to update the documentation with the new formatter.

@marekstodolny
Copy link
Author

  • Added docs
  • Added severity config
  • Added a fingerprint sha1 hash for every violation
  • Removed end line number (begin alone should work)

Copy link
Collaborator

@patrickkusebauch patrickkusebauch left a comment

Choose a reason for hiding this comment

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

👍 LGTM


#### `severity`

You can change how a severity of `failure`, `skipped`, `uncovered` violations will be treated.
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 nice touch. I like that

@dbrumann dbrumann merged commit 365d270 into qossmic:main Apr 9, 2022
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.

None yet

3 participants