From 9bb66eb993fa39c616b437b5c58c59bc483cfa9b Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 27 Aug 2018 13:46:21 +0100 Subject: [PATCH] [ruleset] Add rule `LambdaParameterName` --- CHANGELOG | 3 ++- README.md | 6 ++++++ builder/src/main/resources/application.yml | 7 +++++++ builder/src/main/resources/rules/LambdaParameterName.md | 4 ++++ .../src/main/resources/net/kemitix/checkstyle-2-naming.xml | 1 + .../main/resources/net/kemitix/checkstyle-3-javadoc.xml | 1 + .../src/main/resources/net/kemitix/checkstyle-4-tweaks.xml | 1 + .../main/resources/net/kemitix/checkstyle-5-complexity.xml | 1 + 8 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 builder/src/main/resources/rules/LambdaParameterName.md diff --git a/CHANGELOG b/CHANGELOG index bf3c15c..2044be1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,9 +1,10 @@ CHANGELOG ========= -4.1.2 +4.2.0 ----- +* [ruleset] Add rule `LambdaParameterName` * Upgrade checkstyle to 8.12 * Upgrade `sevntu` to 1.32.0 * Switch to trunk-based development diff --git a/README.md b/README.md index 928def4..a9d1015 100644 --- a/README.md +++ b/README.md @@ -167,6 +167,7 @@ Rule|Level|Source|Enabled|Suppressible [JavadocType](#javadoctype)|javadoc|checkstyle|Yes| [JavadocVariable](#javadocvariable)|javadoc|checkstyle|| [JavaNCSS](#javancss)|complexity|checkstyle|Yes| +[LambdaParameterName](#lambdaparametername)|naming|checkstyle|Yes| [LeftCurly](#leftcurly)|layout|checkstyle|Yes| [LineLength](#linelength)|layout|checkstyle|Yes| [LocalFinalVariableName](#localfinalvariablename)|naming|checkstyle|Yes| @@ -1159,6 +1160,11 @@ Checks the format for Javadoc for classes and enums. Javadoc must be present, no Restricts the NCSS score for methods, classes and files to 40, 1200 and 1600 respectively. The NCSS score is a measure of the number of statements within a scope. Too high an NCSS score suggests that the method or class is doing too much and should be decomposed into smaller units. +#### [LambdaParameterName](http://checkstyle.sourceforge.net/config_naming.html#LambdaParameterName) + +Checks the format of lambda parameter names. + +Identifiers must match `^[a-z][a-zA-Z0-9]*$`. #### [LeftCurly](http://checkstyle.sourceforge.net/config_blocks.html#LeftCurly) Checks that the left curly brace ('{') is placed at the end of the line. Does not check enums. diff --git a/builder/src/main/resources/application.yml b/builder/src/main/resources/application.yml index b4d99bb..447d791 100644 --- a/builder/src/main/resources/application.yml +++ b/builder/src/main/resources/application.yml @@ -1067,6 +1067,13 @@ rules: enabled: true source: SEVNTU uri: http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/design/ForbidWildcardAsReturnTypeCheck.html + - + name: LambdaParameterName + parent: TREEWALKER + level: NAMING + enabled: true + source: CHECKSTYLE + uri: http://checkstyle.sourceforge.net/config_naming.html#LambdaParameterName - name: LogicConditionNeedOptimization parent: TREEWALKER diff --git a/builder/src/main/resources/rules/LambdaParameterName.md b/builder/src/main/resources/rules/LambdaParameterName.md new file mode 100644 index 0000000..663cbb2 --- /dev/null +++ b/builder/src/main/resources/rules/LambdaParameterName.md @@ -0,0 +1,4 @@ + +Checks the format of lambda parameter names. + +Identifiers must match `^[a-z][a-zA-Z0-9]*$`. diff --git a/ruleset/src/main/resources/net/kemitix/checkstyle-2-naming.xml b/ruleset/src/main/resources/net/kemitix/checkstyle-2-naming.xml index 6140730..2106693 100644 --- a/ruleset/src/main/resources/net/kemitix/checkstyle-2-naming.xml +++ b/ruleset/src/main/resources/net/kemitix/checkstyle-2-naming.xml @@ -85,6 +85,7 @@ + diff --git a/ruleset/src/main/resources/net/kemitix/checkstyle-3-javadoc.xml b/ruleset/src/main/resources/net/kemitix/checkstyle-3-javadoc.xml index 073357f..6c924b4 100644 --- a/ruleset/src/main/resources/net/kemitix/checkstyle-3-javadoc.xml +++ b/ruleset/src/main/resources/net/kemitix/checkstyle-3-javadoc.xml @@ -109,6 +109,7 @@ + diff --git a/ruleset/src/main/resources/net/kemitix/checkstyle-4-tweaks.xml b/ruleset/src/main/resources/net/kemitix/checkstyle-4-tweaks.xml index 4507b73..72a2f89 100644 --- a/ruleset/src/main/resources/net/kemitix/checkstyle-4-tweaks.xml +++ b/ruleset/src/main/resources/net/kemitix/checkstyle-4-tweaks.xml @@ -158,6 +158,7 @@ + diff --git a/ruleset/src/main/resources/net/kemitix/checkstyle-5-complexity.xml b/ruleset/src/main/resources/net/kemitix/checkstyle-5-complexity.xml index aff64d6..d819655 100644 --- a/ruleset/src/main/resources/net/kemitix/checkstyle-5-complexity.xml +++ b/ruleset/src/main/resources/net/kemitix/checkstyle-5-complexity.xml @@ -208,6 +208,7 @@ +