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

Issue #734: Integrate 'Jsr305Annotations' plugin #728

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions eclipsecs-sevntu-plugin/src/checkstyle_packages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<package name="annotation"/>
<package name="coding"/>
<package name="design"/>
<package name="jsr305"/>
<package name="naming"/>
<package name="sizes"/>
</package>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Jsr305AnnotationsCheck.name=Jsr305AnnotationsCheck
Jsr305AnnotationsCheck.desc=Checks method parameters and return values for the presence of @Nonnull, @Nullable, or @CheckForNull annotations.
Jsr305AnnotationsCheck.packages=Packages to be checked.
Jsr305AnnotationsCheck.excludePackages=Packages excluded from checking.
Jsr305AnnotationsCheck.allowOverridingReturnValue=Allow Overriding return values, useful for upgrading.
Jsr305AnnotationsCheck.allowOverridingParameter=Allow Overriding paramaters, useful for upgrading.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE checkstyle-metadata PUBLIC
"-//eclipse-cs//DTD Check Metadata 1.1//EN"
"http://checkstyle.org/eclipse-cs/dtds/checkstyle-metadata_1_1.dtd">
<checkstyle-metadata>
<rule-group-metadata name="SevNTU checks" priority="1450">

<rule-metadata name="%Jsr305AnnotationsCheck.name" internal-name="Jsr305AnnotationsCheck" parent="TreeWalker">
<alternative-name internal-name="com.github.sevntu.checkstyle.checks.jsr305.Jsr305AnnotationsCheck"/>
<description>%Jsr305AnnotationsCheck.desc</description>
<property-metadata name="packages" datatype="String">
<description>%Jsr305AnnotationsCheck.packages</description>
</property-metadata>
<property-metadata name="excludePackages" datatype="String">
<description>%Jsr305AnnotationsCheck.excludePackages</description>
</property-metadata>
<property-metadata name="allowOverridingReturnValue" datatype="Boolean" default-value="false">
<description>%Jsr305AnnotationsCheck.allowOverridingReturnValue</description>
</property-metadata>
<property-metadata name="allowOverridingParameter" datatype="Boolean" default-value="false">
<description>%Jsr305AnnotationsCheck.allowOverridingParameter</description>
</property-metadata>

<message-key key="illegal.class.level.annotation" />
<message-key key="contradicting.class.level.annotations" />
<message-key key="param.definitions.with.check.annotation" />
<message-key key="param.definition.with.override.annotation" />
<message-key key="param.definition.with.nonnull.by.default.annotation" />
<message-key key="param.definition.with.nullable.by.default.annotation" />
<message-key key="param.definition.with.return.values.default.annotation" />
<message-key key="param.nonnull.and.nullable.annotation" />
<message-key key="primitives.with.nullness.annotation" />
<message-key key="overridden.definitions.with.increased.param.constraint" />
<message-key key="redundant.nonnull.param.annotation" />
<message-key key="redundant.nullable.param.annotation" />
<message-key key="parameter.without.nullness.annotation" />
<message-key key="return.value.with.nonnull.by.default.annotation" />
<message-key key="return.value.with.nullable.annotation" />
<message-key key="contradicting.return.value.annotations" />
<message-key key="overridden.method.with.check.return.value.annotation" />
<message-key key="redundant.nonnull.by.default.annotation" />
<message-key key="redundant.nullable.by.default.annotation" />
<message-key key="void.with.check.return.value.annotation" />
<message-key key="redundant.nonnull.return.annotation" />
<message-key key="return.without.nullness.annotation" />
<message-key key="overridden.methods.allow.only.nonnull" />
<message-key key="need.to.inherit.param.annotations" />
<message-key key="constructor.with.return.annotation" />
</rule-metadata>

</rule-group-metadata>
</checkstyle-metadata>
11 changes: 11 additions & 0 deletions sevntu-checks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@
<scope>test</scope>
<version>${checkstyle.eclipse-cs.version}</version>
</dependency>
<!-- required for package/jsr305 -->
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>annotations</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
8 changes: 8 additions & 0 deletions sevntu-checks/sevntu-checks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,14 @@
<property name="ignoreMethod" value="false"/>
</module>

<!-- Jsr305 -->
<module name="com.github.sevntu.checkstyle.checks.jsr305.Jsr305AnnotationsCheck">
<property name="packages" value="your.package.path.to.check,another.package.path.to.check"/>
<property name="excludePackages" value="your.package.path.not.to.check,another.package.path.not.to.check"/>
<property name="allowOverridingReturnValue" value="false"/>
<property name="allowOverridingParameter" value="false"/>
</module>

<!-- moved to checkstyle project since 1.21.0 -->
<!--
<module name="com.github.sevntu.checkstyle.checks.whitespace.SingleSpaceSeparatorCheck">
Expand Down
Loading