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

Bump versions of coding style to 1.3.0, and parent pom to 1.3.1 #492

Merged
merged 8 commits into from
Aug 23, 2020
Merged
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Static Analysis Model and Parsers Library

[![Join the chat at https://gitter.im/jenkinsci/warnings-plugin](https://badges.gitter.im/jenkinsci/warnings-plugin.svg)](https://gitter.im/jenkinsci/warnings-plugin?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Jenkins Plugin](https://img.shields.io/github/release/jenkinsci/analysis-model.svg?label=changelog)](https://github.com/jenkinsci/analysis-model/releases/latest)
[![ChangeLog](https://img.shields.io/github/release/jenkinsci/analysis-model.svg?label=changelog)](https://github.com/jenkinsci/analysis-model/releases/latest)
[![Jenkins](https://ci.jenkins.io/job/Plugins/job/analysis-model/job/master/badge/icon?subject=Jenkins%20CI)](https://ci.jenkins.io/job/Plugins/job/analysis-model/job/master/)
[![CI on all platforms](https://github.com/jenkinsci/analysis-model/workflows/GitHub%20CI/badge.svg?branch=master)](https://github.com/jenkinsci/analysis-model/actions)
[![Codacy](https://api.codacy.com/project/badge/Grade/1b96405c72db49eeb0d67486f77f8f75)](https://app.codacy.com/app/uhafner/analysis-model?utm_source=github.com&utm_medium=referral&utm_content=jenkinsci/analysis-model&utm_campaign=Badge_Grade_Dashboard)
Expand Down
22 changes: 9 additions & 13 deletions codacy/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Checkstyle-Configuration: Ullrich Hafner
Description: Ullrich Hafner's Checkstyle Rules.
-->
<!-- ${project.groupId}:${project.artifactId}:${project.version} -->
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="Checker">
Expand All @@ -26,25 +27,21 @@
<module name="PackageAnnotation"/>
<module name="EqualsAvoidNull"/>
<module name="GenericWhitespace"/>
<module name="JavadocStyle">
<property name="severity" value="warning"/>
<property name="checkEmptyJavadoc" value="true"/>
</module>
<module name="JavadocType"/>
<module name="JavadocMethod">
<module name="JavadocMethod"/>
<module name="JavadocVariable">
<property name="scope" value="protected"/>
<property name="tokens" value="VARIABLE_DEF"/>
</module>
<module name="MissingJavadocMethodCheck">
<property name="allowMissingPropertyJavadoc" value="true"/>
</module>
<module name="MissingJavadocTypeCheck"/>
<module name="MissingJavadocPackageCheck"/>
<module name="JavadocVariable">
<property name="scope" value="protected"/>
<property name="tokens" value="VARIABLE_DEF"/>
</module>
<module name="JavadocStyle">
<property name="severity" value="warning"/>
</module>
<module name="JavadocStyle">
<property name="checkEmptyJavadoc" value="true"/>
</module>
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
Expand Down Expand Up @@ -122,7 +119,6 @@
<module name="SuperClone"/>
<module name="SuperFinalize"/>
<module name="UnnecessaryParentheses"/>
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
<module name="InterfaceIsType"/>
<module name="MutableException"/>
Expand All @@ -143,7 +139,7 @@
<module name="IllegalCatch"/>
<module name="IllegalImport">
<property name="illegalPkgs" value="net.jcip.annotations, javax.annotation"/>
<property name="illegalClasses" value="edu.umd.cs.findbugs.annotations.CheckForNull"/>
<property name="illegalClasses" value="edu.umd.cs.findbugs.annotations.Nullable"/>
<property name="severity" value="error"/>
</module>
</module>
Expand Down
18 changes: 14 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>edu.hm.hafner</groupId>
<artifactId>codingstyle-pom</artifactId>
<version>1.1.1</version>
<version>1.3.1</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -54,7 +54,7 @@

<properties>
<scmTag>HEAD</scmTag>
<revision>8.2.2</revision>
<revision>8.3.0</revision>
<changelist>-SNAPSHOT</changelist>
<source.encoding>UTF-8</source.encoding>
<project.build.sourceEncoding>${source.encoding}</project.build.sourceEncoding>
Expand All @@ -65,7 +65,7 @@
<incrementals.url>https://repo.jenkins-ci.org/incrementals/</incrementals.url>

<!-- Project Dependencies Configuration -->
<codingstyle.library.version>1.1.0</codingstyle.library.version>
<codingstyle.library.version>1.3.0</codingstyle.library.version>
<jmh.version>1.25</jmh.version>
<commons.lang.version>3.11</commons.lang.version>
<commons.io.version>2.7</commons.io.version>
Expand Down Expand Up @@ -286,6 +286,16 @@
<classQualifiedName>se.bjurr.violations.lib.reports.Parser</classQualifiedName>
<justification>Nobody should rely on these constants.</justification>
</item>
<item>
<code>java.annotation.removed</code>
<annotation>@edu.umd.cs.findbugs.annotations.Nullable</annotation>
<justification>Annotation should be save to change.</justification>
</item>
<item>
<code>java.annotation.added</code>
<annotation>@edu.umd.cs.findbugs.annotations.CheckForNull</annotation>
<justification>Annotation should be save to change.</justification>
</item>
</revapi.ignore>
</analysisConfiguration>
</configuration>
Expand Down Expand Up @@ -512,4 +522,4 @@
</snapshotRepository>
</distributionManagement>

</project>
</project>
6 changes: 3 additions & 3 deletions src/main/java/edu/hm/hafner/analysis/Categories.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.apache.commons.lang3.StringUtils;

import edu.umd.cs.findbugs.annotations.Nullable;
import edu.umd.cs.findbugs.annotations.CheckForNull;

/**
* Provides convenience methods to detect categories.
Expand All @@ -27,7 +27,7 @@ public final class Categories {
*
* @return warning category, empty string if unknown
*/
public static String guessCategory(@Nullable final String message) {
public static String guessCategory(@CheckForNull final String message) {
if (StringUtils.contains(message, "proprietary")) {
return PROPRIETARY_API;
}
Expand All @@ -48,7 +48,7 @@ public static String guessCategory(@Nullable final String message) {
*
* @return the actual category
*/
public static String guessCategoryIfEmpty(@Nullable final String category, @Nullable final String message) {
public static String guessCategoryIfEmpty(@CheckForNull final String category, @CheckForNull final String message) {
String capitalized = StringUtils.capitalize(category);
if (StringUtils.isEmpty(capitalized)) {
capitalized = guessCategory(message);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/edu/hm/hafner/analysis/DuplicationGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import org.apache.commons.lang3.StringUtils;

import edu.umd.cs.findbugs.annotations.Nullable;
import edu.umd.cs.findbugs.annotations.CheckForNull;

/**
* Links all affected files of a duplicated code fragment. A code duplication could be reported by a code duplication
Expand All @@ -24,7 +24,7 @@ public final class DuplicationGroup implements Serializable {
* @param codeFragment
* the copied code fragment
*/
public DuplicationGroup(@Nullable final String codeFragment) {
public DuplicationGroup(@CheckForNull final String codeFragment) {
setCodeFragment(codeFragment);
}

Expand All @@ -43,7 +43,7 @@ public DuplicationGroup() {
* the copied code fragment
*/
@SuppressWarnings("InstanceVariableUsedBeforeInitialized")
public void setCodeFragment(@Nullable final String codeFragment) {
public void setCodeFragment(@CheckForNull final String codeFragment) {
if (StringUtils.isBlank(this.codeFragment)) {
this.codeFragment = StringUtils.defaultString(codeFragment);
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/edu/hm/hafner/analysis/FileReaderFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import com.google.errorprone.annotations.MustBeClosed;

import edu.umd.cs.findbugs.annotations.Nullable;
import edu.umd.cs.findbugs.annotations.CheckForNull;

/**
* Provides a {@link ReaderFactory} that returns readers for a given file.
Expand All @@ -27,7 +27,7 @@
public class FileReaderFactory extends ReaderFactory {
private final Path file;
private final String fileName;
@Nullable
@CheckForNull
private Charset charset;
private final boolean isCharsetUndetected;

Expand All @@ -39,7 +39,7 @@ public class FileReaderFactory extends ReaderFactory {
* @param charset
* the charset to use when reading the file (or {@code null} if the charset should be detected)
*/
public FileReaderFactory(final Path file, final @Nullable Charset charset) {
public FileReaderFactory(final Path file, final @CheckForNull Charset charset) {
super(StandardCharsets.UTF_8);

this.file = file;
Expand Down Expand Up @@ -76,7 +76,7 @@ public Reader create() {
}
}

@Nullable
@CheckForNull
private Charset detectCharset(final InputStream inputStream) throws IOException {
try (Reader reader = new InputStreamReader(inputStream, StandardCharsets.US_ASCII)) {
XMLStreamReader xmlStreamReader = new SecureXmlParserFactory().createXmlStreamReader(reader);
Expand Down
44 changes: 22 additions & 22 deletions src/main/java/edu/hm/hafner/analysis/Issue.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import edu.hm.hafner.util.Ensure;
import edu.hm.hafner.util.PathUtil;
import edu.hm.hafner.util.TreeString;
import edu.umd.cs.findbugs.annotations.Nullable;
import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
Expand Down Expand Up @@ -171,7 +171,7 @@ public static Predicate<Issue> byType(final String type) {

private final UUID id; // fixed

@Nullable
@CheckForNull
private final Serializable additionalProperties; // fixed

private String reference; // mutable, not part of equals
Expand Down Expand Up @@ -248,13 +248,13 @@ public static Predicate<Issue> byType(final String type) {
@SuppressWarnings("ParameterNumber")
Issue(final String pathName, final TreeString fileName,
final int lineStart, final int lineEnd, final int columnStart, final int columnEnd,
@Nullable final Iterable<? extends LineRange> lineRanges,
@Nullable final String category, @Nullable final String type,
final TreeString packageName, @Nullable final String moduleName,
@Nullable final Severity severity,
@CheckForNull final Iterable<? extends LineRange> lineRanges,
@CheckForNull final String category, @CheckForNull final String type,
final TreeString packageName, @CheckForNull final String moduleName,
@CheckForNull final Severity severity,
final TreeString message, final String description,
@Nullable final String origin, @Nullable final String reference,
@Nullable final String fingerprint, @Nullable final Serializable additionalProperties) {
@CheckForNull final String origin, @CheckForNull final String reference,
@CheckForNull final String fingerprint, @CheckForNull final Serializable additionalProperties) {
this(pathName, fileName, lineStart, lineEnd, columnStart, columnEnd, lineRanges, category, type, packageName,
moduleName,
severity, message, description, origin, reference, fingerprint, additionalProperties,
Expand Down Expand Up @@ -304,15 +304,15 @@ public static Predicate<Issue> byType(final String type) {
* the ID of this issue
*/
@SuppressWarnings("ParameterNumber")
Issue(@Nullable final String pathName, final TreeString fileName, final int lineStart, final int lineEnd,
Issue(@CheckForNull final String pathName, final TreeString fileName, final int lineStart, final int lineEnd,
final int columnStart,
final int columnEnd, @Nullable final Iterable<? extends LineRange> lineRanges,
@Nullable final String category,
@Nullable final String type, final TreeString packageName,
@Nullable final String moduleName, @Nullable final Severity severity,
final int columnEnd, @CheckForNull final Iterable<? extends LineRange> lineRanges,
@CheckForNull final String category,
@CheckForNull final String type, final TreeString packageName,
@CheckForNull final String moduleName, @CheckForNull final Severity severity,
final TreeString message, final String description,
@Nullable final String origin, @Nullable final String reference,
@Nullable final String fingerprint, @Nullable final Serializable additionalProperties,
@CheckForNull final String origin, @CheckForNull final String reference,
@CheckForNull final String fingerprint, @CheckForNull final Serializable additionalProperties,
final UUID id) {

this.pathName = normalizeFileName(pathName);
Expand Down Expand Up @@ -390,7 +390,7 @@ protected Object readResolve() {
return this;
}

private String normalizeFileName(@Nullable final String platformFileName) {
private String normalizeFileName(@CheckForNull final String platformFileName) {
if (platformFileName == null || UNDEFINED.equals(platformFileName) || StringUtils.isBlank(platformFileName)) {
return UNDEFINED;
}
Expand All @@ -417,7 +417,7 @@ private int defaultInteger(final int integer) {
*
* @return the valid string or a default string if the specified string is not valid
*/
private String defaultString(@Nullable final String string) {
private String defaultString(@CheckForNull final String string) {
return StringUtils.defaultIfEmpty(string, UNDEFINED).intern();
}

Expand All @@ -429,7 +429,7 @@ private String defaultString(@Nullable final String string) {
*
* @return the stripped string or the empty string if the specified string is {@code null}
*/
private String stripToEmpty(@Nullable final String string) {
private String stripToEmpty(@CheckForNull final String string) {
return StringUtils.stripToEmpty(string).intern();
}

Expand Down Expand Up @@ -704,7 +704,7 @@ public String getModuleName() {
* @param moduleName
* the module name to set
*/
void setModuleName(@Nullable final String moduleName) {
void setModuleName(@CheckForNull final String moduleName) {
this.moduleName = stripToEmpty(moduleName);
}

Expand Down Expand Up @@ -754,7 +754,7 @@ public String getReference() {
* @param reference
* the reference
*/
public void setReference(@Nullable final String reference) {
public void setReference(@CheckForNull final String reference) {
this.reference = stripToEmpty(reference);
}

Expand All @@ -781,7 +781,7 @@ public String getFingerprint() {
*
* @see #getFingerprint()
*/
void setFingerprint(@Nullable final String fingerprint) {
void setFingerprint(@CheckForNull final String fingerprint) {
this.fingerprint = StringUtils.stripToEmpty(fingerprint);
}

Expand All @@ -800,7 +800,7 @@ public boolean hasFingerprint() {
*
* @return the additional properties
*/
@Nullable
@CheckForNull
public Serializable getAdditionalProperties() {
return additionalProperties;
}
Expand Down
Loading