3939import com .fasterxml .jackson .databind .ObjectMapper ;
4040import com .fasterxml .jackson .dataformat .yaml .YAMLFactory ;
4141import com .google .common .collect .ImmutableList ;
42+ import com .google .common .collect .ImmutableMap ;
4243import com .puppycrawl .tools .checkstyle .meta .ModuleDetails ;
4344import com .puppycrawl .tools .checkstyle .meta .ModulePropertyDetails ;
4445import com .puppycrawl .tools .checkstyle .meta .ModuleType ;
4546import com .puppycrawl .tools .checkstyle .meta .XmlMetaReader ;
4647
4748public class CheckstyleMetadata {
48- private static final String OPTION_STRING = "Option" ;
49- private static final String COMMA_STRING = "," ;
5049 private static final List <String > NO_SQALE = ImmutableList .of (
5150 "com.puppycrawl.tools.checkstyle.checks.TranslationCheck" ,
5251 "com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck" ,
@@ -60,7 +59,16 @@ public class CheckstyleMetadata {
6059 "com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationLocationCheck" ,
6160 "com.puppycrawl.tools.checkstyle.checks.SuppressWarningsHolder"
6261 );
62+
63+ private static final Map <String , String > MODULE_NAME_EXCEPTIONS = ImmutableMap .of (
64+ "JavaNCSS" , "Java NCSS" ,
65+ "NPathComplexity" , "NPath Complexity"
66+ );
67+
68+ private static final String OPTION_STRING = "Option" ;
69+ private static final String COMMA_STRING = "," ;
6370 private static final int PARAM_TYPE_DB_COLUMN_TYPE_SIZE_LIMIT = 512 ;
71+
6472 private final RulesDefinition .NewRepository repository ;
6573 private final Map <String , ModuleDetails > metadataRepo ;
6674
@@ -314,10 +322,16 @@ private static String getRuleTag(String checkPackage,
314322 public static String getFullCheckName (String checkName ) {
315323 final int capacity = 1024 ;
316324 final StringBuilder result = new StringBuilder (capacity );
317- for (int i = 0 ; i < checkName .length (); i ++) {
318- result .append (checkName .charAt (i ));
319- if (i + 1 < checkName .length () && Character .isUpperCase (checkName .charAt (i + 1 ))) {
320- result .append (' ' );
325+
326+ if (MODULE_NAME_EXCEPTIONS .containsKey (checkName )) {
327+ result .append (MODULE_NAME_EXCEPTIONS .get (checkName ));
328+ }
329+ else {
330+ for (int i = 0 ; i < checkName .length (); i ++) {
331+ result .append (checkName .charAt (i ));
332+ if (i + 1 < checkName .length () && Character .isUpperCase (checkName .charAt (i + 1 ))) {
333+ result .append (' ' );
334+ }
321335 }
322336 }
323337 return result .toString ();
0 commit comments