By students from around the world.
Licence is GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
Description
Main idea of
Checkstyle project is to automate and to ease code-review process; to assist developers in complying with the company's Code-standard, and allow them to fix and eliminate any minor problem upon just saving the file.
We are strongly convinced that it is much more easier and convenient to catch minor traps in code during writing than after committing/pushing. This project contains a number of Checks that can help program engineers to write code in a uniform style, which makes it easier for the whole team of programmers to review the code, also significantly improves the low threshold of understanding for new developers.
This project is additional(non-standard) checks for Checkstyle that are compiled as extension to maven-checkstyle-plugin, Sonar Checkstyle Plugin, CheckStyle-IDEA, Checkstyle Eclipse plugin, see
Distribution chapter for more details.
See
Javadoc pages for documentation of Check option.
This project is incubator for Checkstyle checks that are not present in main stream of Checkstyle project.
If you have a check and need place to be build-in, let us know.
If you want to study Java(with mentoring) and help us develop some Checks let us know,
we are looking for new maintainers and level of Java experience does not matter.
We offer diversity of nonstandard Checks and each developer's group chooses what to use to satisfy their code-standard needs.
Contact
Roman Ivanov: ivanov-jr[*]mail[*]ru
Discussion group
Homepage: discussion group
Group email: sevntu-checkstyle[ a ]googlegroups.com
IRC
#sevntu.checkstyle on Freenode
Distribution
We do deployment to Maven central -
https://repo1.maven.org/maven2/com/github/sevntu-checkstyle/ for following artifacts:
- sevntu-checks
- sevntu-checkstyle-idea-extension
- sevntu-checkstyle-sonar-plugin
- extension to maven-checkstyle-plugin (how to use: in general, maven example, ant example).
- extension to Sonar Checkstyle Plugin (how to use: in general).
- extension to CheckStyle-IDEA (how to use: in general).
- extension to Checkstyle Eclipse plugin (how to use: install from EclipseCS “update site” or use our update site https://sevntu-checkstyle.github.io/sevntu.checkstyle/update-site/ (do not use this link in Browser, it will return 404 code, it is expected, but it will work well through Eclipse menu "Help"->"Install New Software ...")
Examples of usage
Full list of Checks and examples of usage could be found at
config
that checkstyle project use.
New and noteworthy
Release 1.44.1 (25.12.2022)
Notes:
-
Issue #943: 'Bump CS version in REPO' is not working.
Author: stoyanK7
#954
-
'Bump CS version in REPO' is not working.
Author: stoyanK7
#943
Release 1.44.0 (2/Dec/2022)
New:
-
Upgrade eclipse-cs version to 10.4.0.
Author: rnveach
#930
Notes:
-
bunch of improvments for codebase. Done by stoyan7, rnveach.
Release 1.43.0 (17/Nov/2022)
New:
-
Upgrade eclipse-cs version to 10.4.0.
Author: rnveach
#930
Bug fixes:
-
LogicConditionNeedOptimizationCheck: NPE on Java 17 file.
Author: rnveach
#922
-
PreferMethodReference fails with Java 14 switch expression.
Author: rnveach
#918
Notes:
-
bunch of improvments for codebase. Done by rnveach.
Release 1.42.0 (1/May/2022)
New:
-
Issue 883: update to eclipse-cs 10.0.0 and jdk 11.
Author: Pavel Bludov
Release 1.41.0 (15/January/2022)
Notes:
-
config: update eclipse-cs dependency to 9.1.0
-
bunch of internal updates from numerous contributors
(Pavel Bludov, Aleksei Grigorov, Nick Mancuso, Nas Kavian)
Release 1.40.0 (26/June/2021)
Bug fixes:
-
Support assertWithMessage("...").fail() in RequireFailForTryCatchInJunitCheck
Author: Pavel Bludov
#847
Notes:
-
config: update eclipse-cs dependency to 8.40.0
-
bunch of internal updates from numerous contributors
Release 1.39.0 (2/Apr/2021)
New:
-
Add PreferMethodReferenceCheck.
Author: Akash Mondal and Andrei Paikin
#825
Bug fixes:
-
Support AssertJ's and Google Truth's fail() methods.
Author: Sebastian Thomschke
#826
Notes:
-
config: update eclipse-cs dependency to 8.37.0
-
bunch of internal updates from rnveach
Release 1.38.0 (1/Nov/2020)
Bug fixes:
-
RequireFailForTryCatchInJUnitCheck: Support static wildcard import of junit's
fail method in
Author: Sebastian Thomschke
#817
Notes:
-
replace cobertura with jacoco for coverage. Done by Pavel Bludov.
-
Introduction of YML metadata for eclipse-cs integration. Done by Gaurab Dasgupta.
-
Bunch of other updates. Done by Tan Wei Liang, Joseph Mate, Gaurav Punjabi,
Wilfried L. Bounsi, Nick Mancuso.
Release 1.37.1 (31/Jan/2020)
Misc:
-
config: update to eclipse-cs 8.29.0
Author: Roman Ivanov
-
remove usages of DetailAST::getNumberOfChildren
Autor: Pavel Bludov
#793
Release 1.37.0 (2/Jan/2020)
New:
-
upgrade sonar-plugin-api to 7.9
Author: Ruslan Diachnko
#763
Bug fixes:
-
Support Junit5 in RequireFailForTryCatchInJunit
Autor: Pavel Bludov
#789
Release 1.36.0 (19/Nov/2019)
Breacking compatibility:
-
sevntu-checkstyle-maven-plugin is removed as it is not requied
Author: Ruslan Diachenko
#766
Notes:
-
upgrade to checksyle and eclipse-cs 8.26
Author: Roman Ivanov
#782
-
several updates for code
Author: Piotrek Żygieło, rnveach, Pavel Bludov
Release 1.35.0 (16/Jul/2019)
Breacking compatibility:
-
sevntu-checks should not bundle checkstyle library.
Author: Ruslan Diachenko
#758
Bugs:
-
SevNTU Checkstyle Sonar plugin should not bundle Checkstyle library.
Author: Ruslan Diachenko
#746
Notes:
-
Shade latest guava library to sentu sonar plugin.
Author: Ruslan Diachenko
#440
-
doc: Fix usage of its/it's.
Author: Piotrek Żygieło
-
config: bump version for few dependecies.
Author: rnveach
Release 1.34.1 (22/Jun/2019)
Bug:
-
Jsr305AnnotationsCheck is crashing on checkstyle sources
Author: Martin Dietze
#751
Release 1.34.0 (18/Jun/2019)
New:
-
Jsr305AnnotationsCheck: Checks method parameters and return values for the
presence of @Nonnull, @Nullable, or @CheckForNull annotations.
Author: Martin Dietze
#734
Notes:
-
bunch of improvments for codebase. Done by rnveach.
Release 1.33.0 (25/March/2019)
upgrade to eclipse-cs 8.18. Done by Roman Ivanov.
More
Handle lambdas in ForbidCertainMethodCheck. Done by Stephen Kitt.
More
fixed regression line length for dynamic modules added. Done by rnveach.
More
Release 1.32.0 (17/August/2018)
upgrade to eclipse-cs 8.12. Done by Roman Ivanov.
More
Release 1.31.0 (17/August/2018)
upgrade to eclipse-cs 8.11. Done by Valery Yatsynovich.
More
restore sevntu-checks validation by sonarqube. Done by Roman Ivanov.
More
Release 1.30.0
New:
-
AvoidConstantAsFirstOperandInConditionCheck: doesn't validate comparisons other then equals and not equals.
Author: rnveach
#672
Bug fixes:
-
RedundantReturn: false positive in anonymous class.
Author: rnveach
#650
-
RedundantReturnCheck: NPE on method with no body.
Author: rnveach
#687
-
LogicConditionNeedOptimization: false positive when many conditions are wrapped in parenthesis.
Author: rnveach
#683
-
LogicConditionNeedOptimization: ignore instanceof.
Author: rnveach
#661
-
OverridableMethodInConstructorCheck: can't run regression on openjdk9.
Author: rnveach
#572
-
AvoidNotShortCircuitOperatorsForBoolean: reports multi catch case.
Author: rnveach
#659
Notes:
-
Fixes for release.
Author: rnveach
#638
-
Add since tag to all module javadocs.
Author: rnveach
#701
-
Resolve sevntu-checks violations in its own code (old code).
Author: rnveach
#525
-
upgrade to 8.10 eclipse-cs.
Author: rnveach
#658
-
Add no-exceptions testing lauches to CI.
Author: rnveach
#644
-
Verify all modules are listed in contribution checks-sevntu-error.xml.
Author: rnveach
#691
-
Update all AbstractChecks to log DetailAST.
Author: rnveach
#662
-
Remove usage of DetailAST.branchContains.
Author: rnveach
#669
Release 1.29.0 (6/Apr/2018)
breaking compatibility changes for CustomDeclarationOrderCheck - CustomDeclarationOrderCheck: Correct spelling of DeclareAnonClassField. Done by Josh Soref.
More
a lot spelling fixes - Done by rnveach and Josh Soref.
bug - Updating sevntu-checks.xml to refer to new dtd. Done by Raghav Kumar Gautam.
More
Release 1.28.0 (26/Feb/2018)
new ForbidCertainMethodCheck - Check that forbidden method is not used. We can forbid a method by method name and number of arguments. Done by Raghav Kumar Gautam.
More
Release 1.27.0 (14/January/2018)
internal updates update to use eclipse-cs 8.7.0. Done by rnveach.
Release 1.26.0 (1/January/2017)
internal updates update to use eclipse-cs 8.5.1. Done by Roman Ivanov.
Release 1.25.0 (25/Nov/2017)
new RequireFailForTryCatchInJunitCheck - Checks if a try/catch block has a junit fail assertion inside the try for a junit method. Done by rnveach.
More
new CheckstyleTestMakeupCheck - Custom check to ensure Checkstyle tests are designed correctly. Done by rnveach.
More
a lot of other internal updates - Done by rnveach and Roman Ivanov.
Release 1.24.2 (20/July/2017)
internal updates update to IllegalCatchExtendedCheck and NestedSwitchCheck to avoid usage of deprecated parent class. Done by rnveach.
Release 1.24.1 (2/July/2017)
bug - added get acceptable and required tokens in all checks. Done by rnveach.
More
internal updates update to use eclipse-cs 7.6.0 . More upadates for maven central deploy. Done by Roman Ivanov.
Release 1.24.0 (27/May/2017)
NEW - groupId is changed to 'com.github.sevntu-checkstyle' , maven artifacts deployed to maven central. Done by Roman Ivanov.
More
bug - changed issue template to specify command based on OS. Done by rnveach.
More
bug - ignore object blocks for ShortCircuitOperator check. Done by rnveach.
More
bug - fixed NPE in non-classes for ShortCircuitOperators check. Done by rnveach.
More
bug - fixed NPE in MapIterationInForEachLoopCheck for map classes. Done by rnveach.
More
bug - fixed NPE in NoNullForCollectionReturnCheck for constructors. Done by rnveach.
More
bug - fixed NPE in ForbidWildcardAsReturnTypeCheck. Done by rnveach.
More
bug - fixed NPE in MapIterationInForEachLoop for maps without this. Done by rnveach.
More
bug - fixed NPE in FinalizeImplementationCheck. Done by rnveach.
More
bug - fixed NPE in AvoidHidingCauseException on wrapping. Done by rnveach.
More
bug - added new check MoveVariableInsideIfCheck. Done by rnveach.
More
bug - rewrote EnumValueNameCheck to follow naming check pattern. Done by rnveach.
More
bug - fixed OutOfBoundsException in CauseParameterInException. Done by rnveach.
More
bug - bump version of eclipse-cs. Done by rnveach.
More
minor: change name for UniformEnumConstantNameCheck in eclipse plugin. Done by Roman Ivanov.
Release 1.23.1 (25/Feb/2017)
internal updates config: define license version in pom.xml as LGPL-2.1+;
Issue #520: 100% coverage for EnumValueNameCheck;
Issue #520: 100% coverage for ChildBlockLengthCheck;
Done by rnveach and Roman Ivanov.
Release 1.23.0 (10/Dec/2016)
bug - ForbidCertainImportsCheck: null excludes gives no violations. Done by rnveach.
More
bug - ConfusingConditionCheck: NPE from CS. Done by rnveach.
More
bug - ReturnCountExtendedCheck takes into account 'returns' in lambdas . Done by rnveach.
More
bug - Checkstyle Package XML should be in core library JAR . Done by rnveach.
More
internal updates - added dynamic checkstyle regression;
Wiki to CI: Messages, Inputs, and JUnit;
partial Sevntu-Checks: 100% code coverage;
enforce usage of all sevntu Check over sevntu-checks code.
added commit validation test
added missing checks to config
enable checkstyle over all sources in sevntu-checks
fixed test failures in sonar extension
started automated testing of sonar and eclipsecs files
Done by rnveach.
internal updates - minor: sevntu-checkstyle-sonar-plugin build with maven-checkstyle-plugin
Convert \t TAB char to 4 spaces in sevntu-checkstyle-sonar-plugin
dos2unix x14
... a lot of other updates
. Done by vorburger.
Release 1.22.0 (19/Nov/2016)
new ForbidAnnotationElementValueCheck - Forbids specific element value for specific annotation. Done by rnveach.
More
update for project code style - removed some legacy violations from sevntu. Done by rnveach.
More
jdk update - changed java 7 compile to java 8. Done by rnveach.
eclipse-cs update - update to eclipse-cs 7.2 version. Done by rnveach.
minor - few minor updates. Done by vorburger.
Release 1.21.1 (15/Oct/2016)
update for sevntu-checkstyle-idea-extension - Idea Extension is incorrectly build by maven. Done by KTannenberg.
More
update for ForbidCertainImportsCheck - Fix violation message of ForbidCertainImportsCheck. Done by MEZk.
More
Release 1.21.0 (08/June/2016)
new UniformEnumValueCheck - Check forces enum values to match one of the specified patterns and forces all the values to follow only one of the specified patterns.
. Done by Pavel Baranchikov.
More
new javadoc for all Checks - Fix all javadoc problems in sevntu-checks project.
JAVADOC IS HERE. Done by Daniil Yaroslavtsev and Roman Ivanov.
More
update for ConstructorWithoutParamsCheck - Udpdate the default config in ConstructorWithoutParamsCheck. Done by zerg-junior.
More
Release 1.20.0 (25/March/2016)
new ConstructorWithoutParamsCheck - This check prohibits usage of parameterless constructors, including the default ones. Rationale: constructors of certain classes must always take arguments to properly instantiate objects. Done by Sergey Dudoladov.
More
new properties for AvoidModifiersForTypes - New options: forbiddenClassesRegexpAnnotation, forbiddenClassesRegexpPrivate, forbiddenClassesRegexpPackagePrivate, forbiddenClassesRegexpProtected, forbiddenClassesRegexpPublic. Done by Yasser Aziza.
More
Release 1.19.2 (20/March/2016)
bug - False positive in DiamondOperatorForVariableDefinitionCheck . Done by Vladislav Lisetskiy.
More
Release 1.19.1 (10/March/2016)
bug - Sevntu Sonar plugin 1.19.0 does not work with Sonar 5.3. Done by Charlie Pai.
More
bug - NumericLiteralNeedsUnderscore fails sonar project analysis. Done by Charlie Pai.
More
Release 1.19.0 (8/March/2016)
bug - NumericLiteralNeedsUnderscore: New option to skip fields by regexp. Done by Charlie Pai.
More
version update - Eclispe-cs version is 1.16.0, checkstyle 1.16.1. Done by Roman Ivanov.
Release 1.18.0 (17/January/2016)
new SingleBreakOrContinue - This check restricts the number of break and continue statements inside cycle body (only one is allowed). Done by Yasser Aziza.
More
new NumericLiteralNeedsUnderscore - This check verifies that large numeric literals are spaced by underscores. Done by Charlie Pai.
More
bug - Rename checks to follow Checkstyle convention for check names. Checks AvoidDefaultSerializableInInnerClasses, ForbidCCommentsInMethods, ReturnBooleanFromTernary, ReturnNullInsteadOfBoolean renamed to have "Check" as suffix in name. Done by Andrei Selkin.
More
Release 1.17.1 (14/December/2015)
bug - Fix false-positive on methods called from 'super' at StaticMethodCandidateCheck. Done by Vladislav Lisetskiy.
More
bug - Fix false-positive on methods with varargs at StaticMethodCandidateCheck. Done by Vladislav Lisetskiy.
More
bug - Shade Guava in sonar-plugin . Done by Vladislav Lisetskiy.
More
Release 1.17.0 (8/November/2015)
new StaticMethodCandidateCheck - Checks whether private methods can be declared as static. Done by Vladislav Lisetskiy.
More
bug - Fix WhitespaceBeforeArrayInitializer for jagged arrays . Done by Michal Kordas.
More
Release 1.16.1 (28/October/2015)
bug - Cannot initialize module SingleSpaceSeparator. Done by Roman Ivanov.
More
Release 1.16.0 (25/October/2015)
new SingleSpaceSeparatorCheck - Checks that if tokens are separated by whitespaces, it has to be a single space. Done by Robert Whitebit.
version bump - Update Maven Checkstyle Plugin to 2.17 . Done by Michal Kordas.
Release 1.15.0 (8/October/2015)
version bump - Version bump to Eclipse-CS 6.11.0 . Done by David Ignjić.
version bump - Version bump to checkstyle 6.11.2 . Done by David Ignjić.
bug - CauseParameterInExceptionCheck: NullPointerException occurred during the analysis. Done by David Ignjić.
More
Release 1.14.0 (26/September/2015)
version bump - Version bump to Eclipse-CS 6.9.0 . Done by Roman Ivanov.
Release 1.13.6 (7/September/2015)
bug - LogicConditionNeedOptimizationCheck doesn't give violation when it is expected. Done by Vadim Panasiuk.
More
bug - AvoidNotShortCircuitOperatorsForBooleanCheck: NullPointerException occurred during the analysis. Done by Christian Oyarzun.
More
bug - Cannot set property 'blockTypes' in module ChildBlockLength. Done by Christian Oyarzun.
More
Release 1.13.5 (23/June/2015)
bug - sevntu-checks are failed within Sonar because of the outdated checkstyle-extensions.xml. Done by Ruslan Diachenko.
More
Release 1.13.4 (21/June/2015)
bug - Sonar fails to start with 'Extension to Sonar Checkstyle Plugin 1.13.3'. Done by Ruslan Diachenko.
More
Release 1.13.3 (7/June/2015)
bug - ReturnNullInsteadOfBoolean: Remove FastStack reference that was removed from checkstyle 6.7. Done by Roman Ivanov.
More
Release 1.13.2 (7/June/2015)
bug - DiamondOperatorForVariableDefinitionCheck throws NullPointerException. Done by Roman Ivanov.
More
Release 1.13.1 (6/June/2015)
bug - PublicReferenceToPrivateTypeCheck fails on all files in eclipse-cs. Done by Roman Ivanov.
More
Release 1.13.0 (16/May/2015)
VariableDeclarationUsageDistanceCheck - was moved to Checkstyle library. Done by Roamn Ivanov.
AbbreviationAsWordInNameCheck - was moved to Checkstyle library. Done by Roamn Ivanov.
NEW RequiredParameterForAnnotationCheck - Check that annotation is used with all required parameters. Done by Andrew Uljanenko.
More
NEW UselessSuperCtorCallCheck - Checks for useless "super()" calls in ctors. Done by Zuy Alexey.
More
NEW EmptyPublicCtorInClassCheck - This Check looks for useless empty public constructors. Class constructor is considered useless by this Check if and only if class has exactly one ctor, which is public, empty (one that has no statements) and default. Done by Zuy Alexey.
More
NEW NameConventionForJunit4TestClassesCheck - This check verifies the name of JUnit4 test class for compliance with user defined naming convention. Done by Zuy Alexey.
More
NEW UselessSingleCatchCheck - Checks for the presence of useless single catch blocks. Catch block can be considered useless if it is the only catch block for try, contains only one statement which rethrows catched exception. Done by Zuy Alexey.
More
NEW AvoidConditionInversion - This Check helps to catch condition inversion cases which could be rewritten in a more readable manner. Done by Alexey Kravin.
More
NEW NestedSwitchCheck - Checking if there is no switch block inside other switch block. Done by Damian Szczepanik.
More
Bug - fix for NPE in ConfusingConditionCheck. Done by melodicwing.
Bug - Fixed false positive in check ForbidReturnInFinallyBlockChech. Done by Andrew Uljanenko.
More
Bug - Diamond operator - fixed violations on anonymous classes. Done by Alexey Kravin.
More
Release 1.12.0 (9/Oct/2014)
Update in Redundant Return Check - Redundant Return Check was retested and fixed. Done by Alexey Nesterenko.
More
Update in ForbidThrowAnonymousExceptionsCheck - Reduced ForbidThrowAnonymousExceptionsCheck's limitation. Now this Check puts violation on throwing anonymous exception even in case if it is defined before throwing. Done by Alexey Nesterenko.
More
Update in LineLengthCheck - Updated LineLengthCheck to print the current line length in it's warnings. Done by Alexey Nesterenko.
More
DiamondOperatorForVariableDefinitionCheck - This Check highlights variable definition statements where diamond operator could be used. Done by Alexey Nesterenko.
More
PublicReferenceToPrivateTypeCheck - This Check warns on propagation of inner private types to outer classes:
- Externally accessible method if it returns private inner type.
- Externally accessible field if it's type is a private inner type.
These types could be
private inner classes, interfaces or enumerations. Done by Alexey Nesterenko.
More
TernaryPerExpressionCountCheck - Replaced existing NestedTernaryCheck with more general TernaryPerExpressionCountCheck.
New Check provides options to ignore ternary sequences with explicitly set priority level (expressions in braces) and also to force Check to ignore ternary operators which are isolated inside a single line.
Done by Alexey Nesterenko.
More
Update in CustomDeclarationOrderCheck - Updated Check to treat more king of methods as setters. E.g., now Check treats 'set' method as setter, in cases like:
public void setWorkMode(String workMode) {
this.workMode = WorkMode.valueOf(workMode);
}
public void setUserCache(UserCache userCache) {
super.setUserCache(userCache);
}
public void setY(Integer y) { // setter
this.y = Integer.parseInt(y + "");
}
Done by Alexey Nesterenko.
More
Release 1.11.0 (7/May/2014)
Update for CustomDeclarationOrderCheck - New macros for Fields with assigning to Anonymous classes, macros for Setter/Geter, macros for nested interfaces and nested enumarations
macros for "main()" method. Done by Baratali Izmailov.
More
EnumValueNameCheck - Check forces enum values to match the specific pattern. Done by Pavel Baranchikov.
More
CheckFinalizeImplementation - This Check detects 3 most common cases of incorrect finalize() method implementation. Done by Max Vetrenko.
More
ForbidThrowAnonymousExceptions - Forbid throwing anonymous exception. limitation: This Check does not validate cases then Exception object is created before it is thrown. Done by Max Vetrenko.
More
MapIterationInForEachLoopCheck - This check can help you to write the whole for-each map iteration more correctly. Done by Max Vetrenko.
More
update in deployment scipt - Fixed -all mode in deploy.sh. Done by Ashutosh Agarwal.
More
Release 1.10.0 (24/Nov/2013)
New project! sevntu-checkstyle-sonar-plugin - Project was created as extension to
Sonar Checkstyle Plugin for
SonarQube™, How to use it is described
here in detail and pictures, Done by Ruslan Diachenko.
More.
New project! sevntu-checkstyle-idea-extension - Project was created as extension for
Checkstyle IDEA plugin for
IntelliJ IDEA, How to use it is described
here in details and pictures, Done by Vadim Panasiuk.
More.
Update for CustomDeclarationOrderCheck - Inner Classes in methods are ignored. Done by Baratali Izmailov.
More
Updates in messages - Done by Baratali Izmailov, Ilja Dubinin, Vadim Panasiuk.
More
Update in VariableDeclarationUsageDistanceCheck - Update to support block constructions/builders and methods with long list arguments,Done by Baratali Izmailov.
More
Update in ConfusingConditionCheck - Update to skip alarming on sequentional IF, Done by Vadim Panasiuk.
More
Update in NoNullForCollectionReturnCheck - Fix for NullPointerException,Done by Ilja Dubinin.
More
Update in ForbidCertainImportsCheck - additional field as Regexp for excluding imports from checking,Done by Daniil Yaroslavtsev.
More
Release 1.9.0 (18/Sept/2013)
AvoidConstantAsFirstOperandInConditionCheck - Avoid Constant As First Operand In Condition. If comparing values, C(C++) developers prefer to put the constant first in the equality check, to prevent situations of assignment rather than equality checking. But in Java, in IF condition it is impossible to use assignment, so that habit become unnecessary and do damage readability of code.
Example:
if (null == varialble)"
should be
if (varialble == null)"
Done by Sergey Burtsev.
More
EitherLogOrThrowException - Either log the exception, or throw it, but never do both. Logging and throwing results in multiple log messages for a single problem in the code, and makes problems for the support engineer who is trying to dig through the logs. This is one of the most annoying error-handling antipatterns.
Example:
catch (NoSuchMethodException e) {
LOG.error("Blah", e);
throw e;
}
Done by Baratali Izmailov.
More
ForbidWildcardAsReturnTypeCheck - Do not use wildcard types as return
types. Rather than providing additional flexibility for your users, it would force
them to use wildcard types in client code.
Properly used, wildcard types are nearly invisible to users of a class. They
cause methods to accept the parameters they should accept and reject those they
should reject. If the user of a class has to think about wildcard types, there is
probably something wrong with the class’s API.
Example:
public <T> List<? extends T> getValues()
Done by Baratali Izmailov.
More
NoNullForCollectionReturnCheck - Check detect when method, that must return array or collection, return null value instead of empty collection or empty array.
Example:
public List<String> metValues() { return null; }
Done by Ilja Dubinin.
More
ConfusingConditionCheck - This check prevents negation within an "if" expression if "else" is present.
For example, rephrase:
if (x != y) smth1(); else smth2();
as:
if (x == y) smth2(); else smth1();
Done by Vadim Panasiuk.
More.
Examples of usage and all options description is
here.
NoMainMethodInAbstractClassCheck - Forbids main methods in abstract classes. Rationale: existance of 'main' method can mislead a developer to consider this class as a ready-to-use implementation.
Example:
abstract class AbstractUiJob {... public static void main(String args[]){ ... } ... }
Done by Baratali Izmailov.
More
SimpleAccessorNameNotationCheck - Check only direct fields and setter and getter. Options: 1) member prefix "m_" 2) check only simple getter/setter XXXType getXXXName(); void setXXXName(XXXType).
Example:
private String value;
void setValue(String val) { this.value = val;}
Reimplemented and fixed by Ilja Dubinin.
More
AbbreviationAsWordInNameCheck - problem detection of 2 char abbreviation with length limit 1 was fixed.
Example:
int scaleX;
Done by Baratali Izmailov.
More
Release 1.8.0 (16/Apr/2012)
NestedTernaryCheck - This check forbids nested ternary operators (with option to ignore final variable initializations except initializations inside C-tors).
Done by Daniil Yaroslavtsev.
(
issue)
ForbidReturnInFinallyBlockCheck - This check reports if the finally block contains a return statement.
Done by Vadim Panasiuk.
(
issue).
Update for ChildBlockLengthCheck to show current sizes of 'bad' blocks, not only allowed sizes for it.
Done by Daniil Yaroslavtsev.
More
Fixed bugs in AvoidHidingCauseExceptionCheck - More information:
issue.
Done by Ilja Dubinin.
Fixed bugs in OverridableMethodInConstructorCheck - More information:
issue. Also added new option
that allow compare methods by number of their parameters.
Done by Ilja Dubinin.
Update for ReturnCountCheckExtended - Now RegExp is used in ignored list of methods.
Done by Alexey Grigorov.
Release 1.7.0 (15/Nov/2012)
AvoidConstantsInInterfacesCheck - has been removed as it has been already implemented in standart Checkstyle. Done by Vadym Chekrii.
Release 1.6.2 (12/Nov/2012)
AbbreviationAsWordInNameCheck - problem with constants in interfaces was fixed. Done by Roman Ivanov.
issue
Release 1.6.1 (29/Oct/2012)
Changes for descriptions for Eclipse plugin for checks that appear in 1.6.0. Done by Ilja Dubinin and Roman Ivanov.
Release 1.6.0 (21/Oct/2012)
LogicConditionNeedOptimizationCheck - This check prevents the placement of local variables and fields after calling
methods in '&&' and '||' conditions. Done by Ilja Dubinin.
Patch.
ForbidCCommentsInMetods - Check prevents usage of C-style (/* ... */) comments inside method body. If you have class declaration inside method body with JavaDoc you will get error too. Done by Ilja Dubinin.
Patch.
InterfaceTypeParameterNameCheck - Checks that interface type parameter(for template) names conform to a format specified
by the format property. Default format is ^[A-Z]$. Done by Dmitry Gridyushko.
Patch.
Release 1.5.3 (4/Sept/2012)
Internal release for site generation automation, refactoring of projects structure to be more independend from
main project and ease code managment and ease new developers unserstanding of project, extension for maven plugin was introduced. Done By Ivan Sopov with help of Ilia Dubinin, Dmitry Gridyushko.
Release 1.5.0 (12/Jun/2012)
AvoidDefaultSerializableInInnerClasses - This check prevents the default implementation Serializable interface in
inner classes (Serializable interface are default if methods readObject() or writeObject() are not override in class). Check has option, that allow
implementation only one method, if it true, but if it false - class must implement both methods. For more information read
"Effective Java (2nd edition)" chapter 11, item 74, page 294. Done by Ilia Dubinin.
issue
IllegalCatchCheck - Minor fix for default values. Done by Daniil Yaroslavtsev.
Release 1.0.5 (14/Apr/2012)
ChildBlockLengthCheck - Length of child block that is more then 90% of parent block is hard to read
in case child block is long(few display screens). Done by Daniil Yaroslavtsev.
issue
AvoidModifiersForTypesCheck - Disallow some set of modifiers (Only 4 types according to Java Spec:static,final, transient, volatile)
for specified types, caused by static for ULCComponents. Done by Daniil Yaroslavtsev.
issue
CauseParameterInExceptionCheck - Exception Design Best Practices : Cause now needed as one the parameter in any custom Exception constructor.
Done by Daniil Yaroslavtsev.
issue
ForbidsCertainImportsCheck - Forbids certain imports usage. Is similar to the useful check in Sonar project.
Done by Daniil Yaroslavtsev.
issue
ForbidInstantiationCheck - Forbids instantiation of certain object types by their full classname.
For example: "java.lang.NullPointerException" will forbid the NPE instantiation.
Done by Daniil Yaroslavtsev.
issue
ReturnCountExtendedCheck - Checks that method/ctor "return" literal count is not greater than
the given value ("maxReturnCount" property). has many useful ignore options.
Done by Daniil Yaroslavtsev.
issue
AbbreviationAsWordInNameCheck - XMLReader should be names like XmlReader.
Issue for ignoring methods with annotation @Override was fixed. Done by Daniil Yaroslavtsev.
issue
Release 1.0.4 (11/Oct/2011)
ForbidAnnotationCheck - Forbid specific annotation for field/method, e.g. forbid @Autowired
annotation for private field. Done by Victor Hidoyatov.
issue
AvoidConstantsInInterfacesCheck - avoid declaration of constants in interfaces. Done by Vladimir Svikhunov.
issue.
AvoidHidingCauseExceptionCheck - hiding Cause exception in throwing new exception. Done by Daniil Yaroslavtsev.
issue.
AvoidNotShortCircuitOperatorsForBooleanCheck - Forbid to use "|", "|=", "&" for boolean/Boolean variables,
and force to use "||", .... , explanation link. Example: "boolean b |= returnBoolean()".
Done by Daniil Yaroslavtsev.
issue.
IllegalCatchCheck - Options to ignore 1) exact re-throw after logging
2) creation and throw of other Exception base on current exception. Done by Daniil Yaroslavtsev.
issue.
OverridableMethodInConstructorCheck - Do not use protected/public method in C-tor.
Use only private and final. Check all call hierarchy from c-tor to avoid: c-tor -> private -> public/protected.
Done by Daniil Yaroslavtsev. (
issue.
ReturnBooleanFromTernary - It is a bad practice to return boolean values from ternary operations.
Just use the value inside branch instead. Done by Ivan Sopov.
ReturnNullInsteadOfBoolean - Arguably it is the matter of style to use Boolean for ternary logic or enum.
And since all the information is in the single file and even in the single method,
I think that checkstyle is capable of doing this. Done by Ivan Sopov.
(
issue)
VariableDeclarationUsageDistanceCheck - check distance between declaration of variable
and its first usage of it. Options: Allowed distance (in rows); Ignore variable names (regexp).
Done by Ruslan Diachenko.
issue
AbbreviationAsWordInNameCheck - XMLReader should be names like XmlReader.
Checks names for fields, methods , ....... . Few ignore options. Done by Roman Ivanov.
(
issue).
Release 1.0.2 (15/Mar/2011)
AvoidNotShortCircuitOperatorsForBooleanCheck - check to force user not to use ShortCircuit operators ("|", "&" for boolean calculations)
. Done by Daniil Yaroslavtsev.
patch
MultipleStringLiteralsExtendedCheck - extension of the standart check, newoption was added to highlight all duplicated. Done by Yury Balahonov.
patch
MultipleVariableDeclarationsExtendedCheck - stndard check + option to ignore while/for. Done by Daniil Yaroslavtsev.
patch
UnnecessaryParenthesesExtendedCheck - standart check + option to ignore some arguable cases. Dmitriy Antonenko.
patch
Release 1.0.1 (21/Sept/2010)
CustomDeclarationOrderCheck - check to adjust class structure to make it more predictable.
Done by Danil Lopatin.
acticle in russian
patch and example of config
InnerClassCheck - force user to place inner classes at the bottom ofthe class. Done by Ruslan Dyachenko.
patch
AbstractClassNameExtendedCheck - extension to check if you named class AbstractXXXXXX then force user to keep it "abstract". Done by Danil Lopatin.
patch
LineLengthExtendedCheck - extension of standard check with a lot of ignore option. Done by Ruslan Dyachenko.
patch
Examples and ideas
Examples of how to use SevNTU-Checkstyle with Maven, Ant or Gradle you can find at
checkstyle-samples repo.
GSOC 2013 ideas
Download
You can download this project in either
zip or
tar formats.
You can also clone the project with Git
by running:
$ git clone git://github.com/sevntu-checkstyle/sevntu.checkstyle