Generate a suppressions.xml file from the errors list #102

Open
daniilyar opened this Issue Feb 9, 2014 · 10 comments

Comments

8 participants
Contributor

daniilyar commented Feb 9, 2014

Contributor

ychulovskyy commented Dec 24, 2014

@romani I like the idea. Nobody wants to use Checkstyle when he runs it for the first time and see 20K violations.
If you are OK about the feature I can prepare PR based on the patch.
Let's discuss requirements:

  • Generate suppressions.xml that doesn't contains line numbers (or it should be an option)
  • Update tests to avoid Internet connection and so on
    Anything else?

I like it!

Owner

romani commented Dec 26, 2014

@ychulovskyy , I always tried to postpone that issue till we introduce more precise and stable way of suppressions rather than line numbers. But we could start with line numbers for now or suppressing whole Check on file where violation more then threshold.

Is there presently a solution to this problem?
I'm only facing 1.6k errors (down from the original 10k I had this morning) but there are still a lot of things that need to be fixed.

Member

rnveach commented Oct 25, 2016

@JLLeitschuh
There is currently no implementation of this issue yet in Checkstyle.

An easy way to do this is to write an AuditListener that outputs the errors (when addError is called) to a file in the suppression format and add that to your configuration file. I don't recommend keeping it in your configuration after one run.
See: http://checkstyle.sourceforge.net/writinglisteners.html#Writing_Listeners

This is what the original poster did but the link to the source patch doesn't work anymore.

@MEZk MEZk added the GSoC2017 label May 6, 2017

@MEZk MEZk added the approved label May 25, 2017

Contributor

MEZk commented Aug 22, 2017

@rnveach @romani
I propose to split this issue into two parts:

  1. Implementation for the old line-based suppression model as it is stable and most commonly used now;
  2. Implementation for the new xpath-based suppression model;

An easy way to do this is to write an AuditListener that outputs the errors (when addError is called) to a file in the suppression format and add that to your configuration file

No need to add the listener to the configuration file. We can add the new CLI options. If one of the options is set we should add the new listener to the root module (checker) here.

In summary, CLI should have 2 options:

  1. gos - generate old suppression file.
  2. gxs - generate new suppression file.

The listener should have the field (possibly enum) to decide whether it should generate the suppression file for the old model, or for the new one.

If you are ok with the proposal, let me know in order to start the implementation.

Owner

romani commented Aug 23, 2017

@MEZk ,

Implementation for the old line-based suppression model as it is stable and most commonly used now;

It is not practical for active projects- one new line will deactivate a lot suppressions and result in a lot new to user violations. User can do suppressions by folders/files if he need to suppress legacy code.

Please proceed only with xpath suppressions.

@MEZk MEZk moved this from To Do to In Progress in Flexible Suppression Model Aug 24, 2017

Contributor

MEZk commented Aug 27, 2017

@timurt
Ping

Contributor

MEZk commented Aug 30, 2017

@timurt
You can work on this issue.

Collaborator

timurt commented Sep 4, 2017

@romani @rnveach
I Started working on this issue

@MEZk MEZk moved this from In Progress to To Do in Flexible Suppression Model Sep 10, 2017

timurt added a commit to timurt/checkstyle that referenced this issue Nov 1, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment