[
https://issues.apache.org/jira/browse/MCHECKSTYLE-396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17146109#comment-17146109
]
Linus Fernandes commented on MCHECKSTYLE-396:
---------------------------------------------
I'd say it's a new goal even though the command line switch -g is used in
conjunction with the -o switch which specifying the output file.
There are no violations printed in this case; this could be confusing to
the user if made part of existing goals.
My usage is to generate the file and manually modify an existing
suppressions file (cut and paste) with the newly generated suppressions.
This is because suppressions are generated for fresh violations only
(uncorrected or unfixed) and not existing ones previously suppressed by the
suppressions file.
The suppression file (used by the Xpath filter) is specified in the
Checkstyle configuration file.
https://checkstyle.sourceforge.io/config_filters.html#SuppressionXpathFilter
I think it's entirely up to the user if he or she wishes to overwrite it
via the output file name but practically overwrite makes sense only if the
code has no existing suppressions or the file is generated for the first
time.
The CLI does not permit ignoring existing suppressions to regenerate all
suppressions.
Maybe, that's something the plugin could do and the CLI can provide an
option as well to do the same.
For examples of my usage:
https://github.com/Fernal73/LearnJava/blob/master/checkstyleg
https://github.com/Fernal73/LearnJava/blob/master/Hello/build.xml
https://github.com/Fernal73/LearnJava/blob/master/csrules.xml
https://github.com/Fernal73/LearnJava/blob/master/ChainOfResponsibility/suppressions-xpath.xml
> Add feature to generate Xpath suppressions as a goal
> ----------------------------------------------------
>
> Key: MCHECKSTYLE-396
> URL: https://issues.apache.org/jira/browse/MCHECKSTYLE-396
> Project: Maven Checkstyle Plugin
> Issue Type: New Feature
> Affects Versions: 3.1.1
> Reporter: Linus Fernandes
> Priority: Major
> Labels: XPath, checkstyle, suppress
>
> It would be nice to have an additional goal added to
> the plugin to generate Xpath suppressions as currently possible through the
> CLI using the -g switch.
>
> https://checkstyle.sourceforge.io/cmdline.html#Command_line_usage
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)