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 support for 'checkstyle' output #209

Merged
merged 8 commits into from
Jul 28, 2022

Conversation

sebastien-rosset
Copy link
Contributor

@sebastien-rosset sebastien-rosset commented Jun 27, 2022

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features) see docs/README.md

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

Add support for the checkstyle output format. Checkstyle is a static code analysis tool used in software development.

What is the current behavior? (You can also link to an open issue here)

Currently, woke supports the following output formats: text, simple, github-actions, json and sonarqube.

What is the new behavior (if this is a feature change)?

Adding new output format (checkstyle).

Does this PR introduce a breaking change? (What changes might users need to make due to this PR?)

No

Other information:

Checkstyle is a static code analysis tool used in software development. While checkstyle was originally designed for Java static analysis, multiple CICD tools support the checkstyle XML format. The checkstyle format can be used to report generic static analysis issues, not just Java. A list of supported tools is available at https://checkstyle.org/index.html#Related_Tools_Active_Tools

For example:

  1. golangci-lint can produce output of golang static analysis in checkstyle format.
  2. The Jenkins warning NG plug-in can show the results of static analysis using checkstyle format.

Though the checkstyle format is very simple, there is no formal XSD. See checkstyle/checkstyle#5166

@sebastien-rosset sebastien-rosset force-pushed the checkstyle branch 5 times, most recently from e48f030 to 3ef25f4 Compare June 27, 2022 22:03
@sebastien-rosset sebastien-rosset changed the title Add support for checkstyle output Add support for 'checkstyle' output Jun 27, 2022
@codecov
Copy link

codecov bot commented Jul 19, 2022

Codecov Report

Merging #209 (da19863) into main (a6470c4) will decrease coverage by 0.72%.
The diff coverage is 78.37%.

❗ Current head da19863 differs from pull request most recent head 1623e27. Consider uploading reports for the commit 1623e27 to get more accurate results

@@            Coverage Diff             @@
##             main     #209      +/-   ##
==========================================
- Coverage   94.49%   93.76%   -0.73%     
==========================================
  Files          22       23       +1     
  Lines         781      818      +37     
==========================================
+ Hits          738      767      +29     
- Misses         25       30       +5     
- Partials       18       21       +3     
Impacted Files Coverage Δ
pkg/printer/checkstyle.go 77.14% <77.14%> (ø)
pkg/printer/printer.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9d4a722...1623e27. Read the comment docs.

Copy link
Member

@caitlinelfring caitlinelfring left a comment

Choose a reason for hiding this comment

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

One last comment, otherwise LGTM

{Name: xml.Name{Local: "version"}, Value: "5.0"},
},
}); err != nil {
panic(err)
Copy link
Member

Choose a reason for hiding this comment

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

I'm not a fan of using panic as it's not the best user experience, but Start doesn't return an error so that's more of an issue for the interface and not for what implements it. Nothing for you to do here but just felt like commenting on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I agree. I wanted to be able to return an error and not silently ignore the problem. Maybe in a future PR the signature of the function can change to return an error.

@caitlinelfring caitlinelfring merged commit e588a3e into get-woke:main Jul 28, 2022
@sebastien-rosset
Copy link
Contributor Author

Thanks!

@caitlinelfring
Copy link
Member

Released in v0.19.0

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