Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ryaneberly committed Feb 2, 2017
1 parent 8dbda7a commit b86c2d5
Show file tree
Hide file tree
Showing 34 changed files with 268 additions and 78 deletions.
7 changes: 4 additions & 3 deletions src/main/java/com/cflint/CFLint.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,12 @@ public void scan(final File folderOrFile) {
final CFLintConfiguration saveConfig = configuration;
try {
for (final File file : folderOrFile.listFiles()) {
if (file.getName().equalsIgnoreCase(".cflintrc.xml")) {
if (file.getName().toLowerCase().startsWith(".cflintrc")) {
try {
CFLintConfiguration newConfig = com.cflint.config.ConfigUtils
.unmarshal(new FileInputStream(file), CFLintConfig.class);
System.out.println("read config " + file);
CFLintConfiguration newConfig = file.getName().toLowerCase().endsWith(".xml")?
ConfigUtils.unmarshal(new FileInputStream(file), CFLintConfig.class):
ConfigUtils.unmarshalJson(new FileInputStream(file), CFLintConfig.class);
configuration = new CFLintChainedConfig(newConfig, configuration);
} catch (Exception e) {
System.err.println("Could not read config file " + file);
Expand Down
29 changes: 0 additions & 29 deletions src/test/java/com/cflint/config/TestConfigUtilsJson.java

This file was deleted.

12 changes: 12 additions & 0 deletions src/test/resources/com/cflint/integration/.cflintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"output" : [ ],
"rule" : [ ],
"excludes" : [ ],
"includes" : [ {
"code" : "FUNCTION_HINT_MISSING",
"messageText" : null,
"severity" : null
} ],
"inheritParent" : false,
"inheritPlugins" : true
}
1 change: 0 additions & 1 deletion src/test/resources/com/cflint/integration/.cflintrc.xml

This file was deleted.

16 changes: 16 additions & 0 deletions src/test/resources/com/cflint/integration/inherit/.cflintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"output" : [ ],
"rule" : [ ],
"excludes" : [ ],
"includes" : [ {
"code" : "FUNCTION_HINT_MISSING",
"messageText" : null,
"severity" : null
}, {
"code" : "COMPONENT_INVALID_NAME",
"messageText" : null,
"severity" : null
} ],
"inheritParent" : true,
"inheritPlugins" : true
}

This file was deleted.

12 changes: 12 additions & 0 deletions src/test/resources/com/cflint/integration/standalone/.cflintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"output" : [ ],
"rule" : [ ],
"excludes" : [ ],
"includes" : [ {
"code" : "FUNCTION_HINT_MISSING",
"messageText" : null,
"severity" : null
} ],
"inheritParent" : false,
"inheritPlugins" : true
}

This file was deleted.

12 changes: 12 additions & 0 deletions src/test/resources/com/cflint/tests/ArgVarConflict/.cflintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"output" : [ ],
"rule" : [ ],
"excludes" : [ ],
"includes" : [ {
"code" : "ARG_VAR_CONFLICT",
"messageText" : null,
"severity" : null
} ],
"inheritParent" : false,
"inheritPlugins" : true
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"output" : [ ],
"rule" : [ ],
"excludes" : [ ],
"includes" : [ {
"code" : "COMPARE_INSTEAD_OF_ASSIGN",
"messageText" : null,
"severity" : null
} ],
"inheritParent" : false,
"inheritPlugins" : true
}

This file was deleted.

16 changes: 16 additions & 0 deletions src/test/resources/com/cflint/tests/Complexity/.cflintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"output" : [ ],
"rule" : [ ],
"excludes" : [ ],
"includes" : [ {
"code" : "PARSE_NOTHING",
"messageText" : null,
"severity" : null
}, {
"code" : "FUNCTION_TOO_COMPLEX",
"messageText" : null,
"severity" : null
} ],
"inheritParent" : false,
"inheritPlugins" : true
}
4 changes: 0 additions & 4 deletions src/test/resources/com/cflint/tests/Complexity/.cflintrc.xml

This file was deleted.

12 changes: 12 additions & 0 deletions src/test/resources/com/cflint/tests/FunctionType/Any/.cflintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"output" : [ ],
"rule" : [ ],
"excludes" : [ ],
"includes" : [ {
"code" : "FUNCTION_TYPE_ANY",
"messageText" : null,
"severity" : null
} ],
"inheritParent" : false,
"inheritPlugins" : true
}

This file was deleted.

20 changes: 20 additions & 0 deletions src/test/resources/com/cflint/tests/Hints/.cflintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"output" : [ ],
"rule" : [ ],
"excludes" : [ ],
"includes" : [ {
"code" : "COMPONENT_HINT_MISSING",
"messageText" : null,
"severity" : null
}, {
"code" : "FUNCTION_HINT_MISSING",
"messageText" : null,
"severity" : null
}, {
"code" : "ARG_HINT_MISSING",
"messageText" : null,
"severity" : null
} ],
"inheritParent" : false,
"inheritPlugins" : true
}
5 changes: 0 additions & 5 deletions src/test/resources/com/cflint/tests/Hints/.cflintrc.xml

This file was deleted.

12 changes: 12 additions & 0 deletions src/test/resources/com/cflint/tests/Ignores/.cflintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"output" : [ ],
"rule" : [ ],
"excludes" : [ ],
"includes" : [ {
"code" : "MISSING_VAR",
"messageText" : null,
"severity" : null
} ],
"inheritParent" : false,
"inheritPlugins" : true
}
1 change: 0 additions & 1 deletion src/test/resources/com/cflint/tests/Ignores/.cflintrc.xml

This file was deleted.

40 changes: 40 additions & 0 deletions src/test/resources/com/cflint/tests/Naming/.cflintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"output" : [ ],
"rule" : [ ],
"excludes" : [ ],
"includes" : [ {
"code" : "VAR_INVALID_NAME",
"messageText" : null,
"severity" : null
}, {
"code" : "VAR_ALLCAPS_NAME",
"messageText" : null,
"severity" : null
}, {
"code" : "SCOPE_ALLCAPS_NAME",
"messageText" : null,
"severity" : null
}, {
"code" : "VAR_TOO_SHORT",
"messageText" : null,
"severity" : null
}, {
"code" : "VAR_TOO_LONG",
"messageText" : null,
"severity" : null
}, {
"code" : "VAR_TOO_WORDY",
"messageText" : null,
"severity" : null
}, {
"code" : "VAR_IS_TEMPORARY",
"messageText" : null,
"severity" : null
}, {
"code" : "VAR_HAS_PREFIX_OR_POSTFIX",
"messageText" : null,
"severity" : null
} ],
"inheritParent" : false,
"inheritPlugins" : true
}
10 changes: 0 additions & 10 deletions src/test/resources/com/cflint/tests/Naming/.cflintrc.xml

This file was deleted.

12 changes: 12 additions & 0 deletions src/test/resources/com/cflint/tests/StructKeyQuoted/.cflintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"output" : [ ],
"rule" : [ ],
"excludes" : [ ],
"includes" : [ {
"code" : "UNQUOTED_STRUCT_KEY",
"messageText" : null,
"severity" : null
} ],
"inheritParent" : false,
"inheritPlugins" : true
}

This file was deleted.

12 changes: 12 additions & 0 deletions src/test/resources/com/cflint/tests/UnusedArgument/.cflintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"output" : [ ],
"rule" : [ ],
"excludes" : [ ],
"includes" : [ {
"code" : "UNUSED_METHOD_ARGUMENT",
"messageText" : null,
"severity" : null
} ],
"inheritParent" : false,
"inheritPlugins" : true
}

This file was deleted.

12 changes: 12 additions & 0 deletions src/test/resources/com/cflint/tests/UnusedVariable/.cflintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"output" : [ ],
"rule" : [ ],
"excludes" : [ ],
"includes" : [ {
"code" : "UNUSED_LOCAL_VARIABLE",
"messageText" : null,
"severity" : null
} ],
"inheritParent" : false,
"inheritPlugins" : true
}

This file was deleted.

12 changes: 12 additions & 0 deletions src/test/resources/com/cflint/tests/VarScoper/.cflintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"output" : [ ],
"rule" : [ ],
"excludes" : [ ],
"includes" : [ {
"code" : "MISSING_VAR",
"messageText" : null,
"severity" : null
} ],
"inheritParent" : false,
"inheritPlugins" : true
}

This file was deleted.

40 changes: 40 additions & 0 deletions src/test/resources/com/cflint/tests/VariableNameChecker/.cflintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"output" : [ ],
"rule" : [ ],
"excludes" : [ ],
"includes" : [ {
"code" : "VAR_INVALID_NAME",
"messageText" : null,
"severity" : null
}, {
"code" : "VAR_ALLCAPS_NAME",
"messageText" : null,
"severity" : null
}, {
"code" : "SCOPE_ALLCAPS_NAME",
"messageText" : null,
"severity" : null
}, {
"code" : "VAR_TOO_SHORT",
"messageText" : null,
"severity" : null
}, {
"code" : "VAR_TOO_LONG",
"messageText" : null,
"severity" : null
}, {
"code" : "VAR_TOO_WORDY",
"messageText" : null,
"severity" : null
}, {
"code" : "VAR_IS_TEMPORARY",
"messageText" : null,
"severity" : null
}, {
"code" : "VAR_HAS_PREFIX_OR_POSTFIX",
"messageText" : null,
"severity" : null
} ],
"inheritParent" : false,
"inheritPlugins" : true
}
Loading

0 comments on commit b86c2d5

Please sign in to comment.