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

Define severity for google style config by variable #15053

Closed
romani opened this issue Jun 20, 2024 · 2 comments
Closed

Define severity for google style config by variable #15053

romani opened this issue Jun 20, 2024 · 2 comments

Comments

@romani
Copy link
Member

romani commented Jun 20, 2024

$ cat Test.java 
import java.util.Arrays;

public class Test {
}

$ java -jar checkstyle-10.17.0-all.jar -c /google_checks.xml Test.java
Starting audit...
[WARN] /var/tmp/Test.java:3:1: Missing a Javadoc comment. [MissingJavadocType]
Audit done.

<property name="severity" value="warning"/>

this severity was big question for many years some people like it was warn, some prefer error.

Expected:

$ java -Dorg.checkstyle.google.severity=error -jar checkstyle-10.XX.0-all.jar \
        -c /google_checks.xml Test.java
Starting audit...
[ERROR] /var/tmp/Test.java:3:1: Missing a Javadoc comment. [MissingJavadocType]
Audit done

for Windows:
java -D"org.checkstyle.google.severity=error" -jar checkstyle-10.XX.0-all.jar -c /google_checks.xml Test.java

new section above https://checkstyle.org/google_style.html#Google_Suppressions "Overrides" that mention what variable to use to get new severity.

If system properly is not working.
should use -p propertiesFile - Sets the property files to load. where it is just property.

@romani
Copy link
Member Author

romani commented Jun 20, 2024

this becomes an issue at #15028 (comment)

@romani romani changed the title Allow defining severity for google style config throught system variable Define severity for google style config throught system variable Jun 20, 2024
@romani romani changed the title Define severity for google style config throught system variable Define severity for google style config by system variable Jun 20, 2024
@romani
Copy link
Member Author

romani commented Jun 20, 2024

@Zopsss , in PR please prove by CLI that it is working or better please make junit test , here is examples

assertMainReturnCode(-1, "-c", "/google_checks.xml", filePath, "-e", filePath);

and
assertMainReturnCode(0, "-c", getPath("InputMainConfig-custom-root-module.xml"),

Zopsss added a commit to Zopsss/checkstyle that referenced this issue Jun 20, 2024
@Zopsss Zopsss moved this to In Progress in Refine Google Style Guide Jun 21, 2024
romani pushed a commit to Zopsss/checkstyle that referenced this issue Jun 21, 2024
Zopsss added a commit to Zopsss/checkstyle that referenced this issue Jun 21, 2024
Zopsss added a commit to Zopsss/checkstyle that referenced this issue Jun 21, 2024
@romani romani changed the title Define severity for google style config by system variable Define severity for google style config by variable Jun 21, 2024
Zopsss added a commit to Zopsss/checkstyle that referenced this issue Jun 21, 2024
Zopsss added a commit to Zopsss/checkstyle that referenced this issue Jun 22, 2024
Zopsss added a commit to Zopsss/checkstyle that referenced this issue Jun 22, 2024
Zopsss added a commit to Zopsss/checkstyle that referenced this issue Jun 22, 2024
Zopsss added a commit to Zopsss/checkstyle that referenced this issue Jun 23, 2024
rnveach pushed a commit that referenced this issue Jun 23, 2024
@github-actions github-actions bot added this to the 10.18.0 milestone Jun 23, 2024
@rnveach rnveach closed this as completed Jun 23, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Refine Google Style Guide Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

No branches or pull requests

2 participants