Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. By default it supports the Google Java Style Guide and Sun Code Conventions, but is highly configurable. It can be invoked with an ANT task and a command line program.
pbludov on issue-4219-shadowed-imports
pbludov on issue-9149-stack-overflow2
Issue #9149: removed input caus… (compare)
pbludov on issue-9149-stack-overflow2
minor: fix sonar violation 'Ref… doc: releasenotes 8.39 [maven-release-plugin] prepare … and 4 more (compare)
pbludov on issue-9149-stack-overflow2
pbludov on issue-9149-stack-overflow2
Issue #9149: workaround for sta… (compare)
pbludov on issue-9149-stack-overflow2
Issue #9149: workaround for sta… (compare)
pbludov on issue-9149-stack-overflow2
minor: fix sonar violation 'Ref… doc: releasenotes 8.39 [maven-release-plugin] prepare … and 4 more (compare)
pbludov on master
Issue #5951: Incorrect warning … minor: update wercker.sh to use… dependency: bump org.eclipse.jg… and 18 more (compare)
pbludov on issue-8864-cmd-set
pbludov on issue-9021-fix-josm
pbludov on issue-9021-fix-josm
Issue #9021: fix josm validation (compare)
pbludov on issue-9021-fix-josm
pbludov on issue-8951-remove-buddy
pbludov on issue-6722-missing-asterisk
pbludov on issue-9124-stack-overflow-parenpad
pbludov on issue-8018-operator-wrap
pbludov on issue-9101-fix-stack-overflow
pbludov on issue-4219-shadowed-imports
Issue #4219: UnusedImports does… (compare)
github-actions[bot] on issue-4219-shadowed-imports
Issue #8651: Checkstyle fails o… Issue #4219: UnusedImports does… (compare)
pbludov on issue-8018-operator-wrap
Issue #8018: AST based operator… (compare)
Hi everyone, I have done an issue, and I had to resolve suggestion, then I did it but travis-ci is not passing all tests because my branch is 19 commits old and it requires to be at most 10 commits old. If I will rebase my branch my pull request will have additional 19 commits. What should I do? Before, I just closed pull requests and opened a new one with a new branch. Is there any other better solution?
@romani @rnveach
git checkout master
git pull upstream master
git checkout <the-PR-branch>
git rebase master
git push --force
@rnveach @romani What kind of example can be provided for this
<module name="LeftCurly">
<property name="ignoreEnums" value="false"/>
</module>
Issue: checkstyle/checkstyle#7582
Link to documentation: https://checkstyle.org/config_blocks.html#LeftCurly
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.junit.platform:junit-platform-commons:jar:1.6.2 from/to central (https://repo.maven.apache.org/maven2): Authorization failed for https://repo.maven.apache.org/maven2/org/junit/platform/junit-platform-commons/1.6.2/junit-platform-commons-1.6.2.jar 403 Forbidden
Is there any issue with the VisibilityModifer? I tried running it with allowPublicImmutableFields
as true
on the given example in the doc
public class ImmutableClass
{
public final ImmutableSet<String> includes; // No warning
public final ImmutableSet<String> excludes; // No warning
public final java.lang.String notes; // No warning
public final BigDecimal value; // No warning
public ImmutableClass(Collection<String> includes, Collection<String> excludes,
BigDecimal value, String notes)
{
this.includes = ImmutableSet.copyOf(includes);
this.excludes = ImmutableSet.copyOf(excludes);
this.value = value;
this.notes = notes;
}
}
and according to the doc it should throw no warning but it does...
$ java -jar ../checkstyle-8.30-all.jar -c config1.xml Test1.java
Starting audit...
[ERROR] C:\Users\Shrey\Desktop\Checkstyle jar\visibilityModifier\Test1.java:3:37: Variable 'includes' must be private and have accessor methods. [VisibilityModifier]
[ERROR] C:\Users\Shrey\Desktop\Checkstyle jar\visibilityModifier\Test1.java:4:37: Variable 'excludes' must be private and have accessor methods. [VisibilityModifier]
[ERROR] C:\Users\Shrey\Desktop\Checkstyle jar\visibilityModifier\Test1.java:5:33: Variable 'notes' must be private and have accessor methods. [VisibilityModifier]
[ERROR] C:\Users\Shrey\Desktop\Checkstyle jar\visibilityModifier\Test1.java:7:20: Variable 'someValue' must be private and have accessor methods. [VisibilityModifier]
Audit done.
Checkstyle ends with 4 errors.
@sulkykookie I am not sure, what is wrong here but you can check in VisibilityModifierCheckTest.java
where you can find this test:
public void testAllowPublicFinalFieldsInImmutableClass() throws Exception {
final DefaultConfiguration checkConfig =
createModuleConfig(VisibilityModifierCheck.class);
checkConfig.addAttribute("allowPublicImmutableFields", "true");
final String[] expected = {
"12:39: " + getCheckMessage(MSG_KEY, "includes"),
"13:39: " + getCheckMessage(MSG_KEY, "excludes"),
"16:23: " + getCheckMessage(MSG_KEY, "list"),
"34:20: " + getCheckMessage(MSG_KEY, "value"),
"36:24: " + getCheckMessage(MSG_KEY, "bValue"),
"37:31: " + getCheckMessage(MSG_KEY, "longValue"),
"41:19: " + getCheckMessage(MSG_KEY, "C_D_E"),
};
verify(checkConfig, getPath("InputVisibilityModifierImmutable.java"), expected);
}
I think running test case will help you to understand why your example doesn't work. InputVisibilityModifierImmutable.java
is a file with examples for this Check.