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

Add Gitlab / Code Climate Output Format Support #210

Merged
merged 11 commits into from
May 28, 2024
Merged

Add Gitlab / Code Climate Output Format Support #210

merged 11 commits into from
May 28, 2024

Conversation

Kenneth-Sills
Copy link
Contributor

This adds the ability to generate Gitlab code quality reports (as well as the parent Code Climate format) for discovered ECS errors and unapplied fixes.

I've made sure to document this class extensively so both end users and future maintainers can understand any possible nuances, but please do let me know if it's too much for your tastes. The tests cover the major basis, though I wouldn't call this "fully covered".

While here, I also:

  1. Added a section to the README describing this feature and the output formats we support.
  2. Did a minor refactor for the output formatter interface. See the message for 2b7f692 for more info on that.

I did perform some testing and it seems to be working correctly from a small demo:

See Example Image

image

However, this did highlight the existence of a major Gitlab issue... That's not our problem, so if anyone opens a ticket about "Code Quality hasn't changed" relating to this feature, we can safely send them over there instead.

…properties

Whether or not a formatter supports progress bars is now encapsulated
in the formatter class itself, as opposed to being scattered in a couple places
and relying on maintainers remembering.

Both this progress bar support and the formatter names are also
implemented as static methods now, whose inclusion can be
promised by their shared interface.

The console output retains its `::NAME` constant because it needs to be used
in the default parameters of a configuration constructor (being a default
setting).

Finally, there remains one hard-coded reference to the `json` output format,
but only over in the `ListCheckersCommand`. I've left this alone since this
is not the same type of formatter. Don't want to step on any toes. :)
I, personally, didn't realize this tool supported output formatting at first,
and the existing issues seemed to have been closed without mentioning
the addition of them. I'd just like to make it more obvious for new users!
My initial line of thinking about setting to 'blocker' was flawed. Not everyone
uses this tooling the same way and they may want it to show up in the MR
widget/diffs without _actually_ blocking. Since ECS focuses on code style
standards instead of correctness issues, this seems an appropriate level.
This just makes testing easier, as seen in the existing test classes.
This is by no means comprehensive, but it at least confirms it respects
configurations as expected, formatting is right for trivial cases, and that
fingerprints are deterministic.
- Uncommenting an attribute I disabled for debugging.
- Added an important clarifying comment.
…ormatter

These should have been relative, but they were absolute. There's no correctness
issue in the formatter itself, it just repeats the paths it's given. But test
cases should generally be correct regardless.
public function getName(): string;
public static function getName(): string;

public static function hasSupportForProgressBars(): bool;
Copy link
Contributor

Choose a reason for hiding this comment

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

Pretty neat 👏


return [$simulatedErrors, $simulatedFixes];
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Well done 👏

@TomasVotruba TomasVotruba enabled auto-merge (squash) May 28, 2024 01:10
@TomasVotruba TomasVotruba merged commit ed749cd into easy-coding-standard:main May 28, 2024
7 checks passed
@TomasVotruba
Copy link
Contributor

Thank you for refactoring of the progress bar on formatter and feature with propper test 👏

This is joy to read, lets ship it

@Kenneth-Sills Kenneth-Sills deleted the kesills-gitlab-formatter branch May 28, 2024 04:19
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.

2 participants