com.puppycrawl.tools.checkstyle.DefaultConfiguration Java Examples
The following examples show how to use
com.puppycrawl.tools.checkstyle.DefaultConfiguration.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OneMethodPrivateFieldCheckTest.java From cacheonix-core with GNU Lesser General Public License v2.1 | 6 votes |
public void testIgnoreFormat() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(OneMethodPrivateFieldCheck.class); checkConfig.addAttribute("ignoreFormat", "2$"); final String[] expected = { "6:24: Field 'SFIELD0' is used in only one method.", "7:24: Field 'SFIELD1' is used in only one method.", "9:24: Field 'SFIELD3' is used in only one method.", "11:17: Field 'mField0' is used in only one method.", "12:17: Field 'mField1' is used in only one method.", "47:17: Field 'mField0' is used in only one method.", "48:17: Field 'mField1' is used in only one method.", "105:19: Field 'mField' is used in only one method.", }; verify(checkConfig, getPath("usage/InputOneMethodPrivateField.java"), expected); }
Example #2
Source File: OneMethodPrivateFieldCheckTest.java From contribution with GNU Lesser General Public License v2.1 | 6 votes |
public void testIgnoreFormat() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(OneMethodPrivateFieldCheck.class); checkConfig.addAttribute("ignoreFormat", "2$"); final String[] expected = { "6:24: Field 'SFIELD0' is used in only one method.", "7:24: Field 'SFIELD1' is used in only one method.", "9:24: Field 'SFIELD3' is used in only one method.", "11:17: Field 'mField0' is used in only one method.", "12:17: Field 'mField1' is used in only one method.", "47:17: Field 'mField0' is used in only one method.", "48:17: Field 'mField1' is used in only one method.", "105:19: Field 'mField' is used in only one method.", }; verify(checkConfig, getPath("usage/InputOneMethodPrivateField.java"), expected); }
Example #3
Source File: OneMethodPrivateFieldCheckTest.java From contribution with GNU Lesser General Public License v2.1 | 6 votes |
public void testDefault() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(OneMethodPrivateFieldCheck.class); final String[] expected = { "6:24: Field 'SFIELD0' is used in only one method.", "7:24: Field 'SFIELD1' is used in only one method.", "8:24: Field 'SFIELD2' is used in only one method.", "9:24: Field 'SFIELD3' is used in only one method.", "11:17: Field 'mField0' is used in only one method.", "12:17: Field 'mField1' is used in only one method.", "13:17: Field 'mField2' is used in only one method.", "47:17: Field 'mField0' is used in only one method.", "48:17: Field 'mField1' is used in only one method.", "49:17: Field 'mField2' is used in only one method.", "105:19: Field 'mField' is used in only one method.", }; verify(checkConfig, getPath("usage/InputOneMethodPrivateField.java"), expected); }
Example #4
Source File: UnusedPrivateMethodCheckTest.java From contribution with GNU Lesser General Public License v2.1 | 6 votes |
public void testAllowSerializationMethods() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnusedPrivateMethodCheck.class); checkConfig.addAttribute("allowSerializationMethods", "true"); final String[] expected = { "7:18: Unused private method 'methodUnused0'.", "91:18: Unused private method 'writeObject'.", "95:18: Unused private method 'writeObject'.", "99:18: Unused private method 'writeObject'.", "103:18: Unused private method 'readObject'.", "107:18: Unused private method 'readObject'.", "111:17: Unused private method 'writeReplace'.", "116:20: Unused private method 'writeReplace'.", "121:17: Unused private method 'readResolve'.", "126:20: Unused private method 'readResolve'.", "134:17: Unused private method 'writeObject'.", "139:18: Unused private method 'readObject'.", "143:20: Unused private method 'readResolve'.", "151:17: Unused private method 'readObject'.", }; verify(checkConfig, getPath("usage/InputUnusedMethod.java"), expected); }
Example #5
Source File: UnusedPrivateMethodCheckTest.java From contribution with GNU Lesser General Public License v2.1 | 6 votes |
public void testDefault() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnusedPrivateMethodCheck.class); final String[] expected = { "7:18: Unused private method 'methodUnused0'.", "66:18: Unused private method 'writeObject'.", "71:18: Unused private method 'readObject'.", "76:20: Unused private method 'writeReplace'.", "82:20: Unused private method 'readResolve'.", "91:18: Unused private method 'writeObject'.", "95:18: Unused private method 'writeObject'.", "99:18: Unused private method 'writeObject'.", "103:18: Unused private method 'readObject'.", "107:18: Unused private method 'readObject'.", "111:17: Unused private method 'writeReplace'.", "116:20: Unused private method 'writeReplace'.", "121:17: Unused private method 'readResolve'.", "126:20: Unused private method 'readResolve'.", "134:17: Unused private method 'writeObject'.", "139:18: Unused private method 'readObject'.", "143:20: Unused private method 'readResolve'.", "151:17: Unused private method 'readObject'.", }; verify(checkConfig, getPath("usage/InputUnusedMethod.java"), expected); }
Example #6
Source File: OneMethodPrivateFieldCheckTest.java From cacheonix-core with GNU Lesser General Public License v2.1 | 6 votes |
public void testDefault() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(OneMethodPrivateFieldCheck.class); final String[] expected = { "6:24: Field 'SFIELD0' is used in only one method.", "7:24: Field 'SFIELD1' is used in only one method.", "8:24: Field 'SFIELD2' is used in only one method.", "9:24: Field 'SFIELD3' is used in only one method.", "11:17: Field 'mField0' is used in only one method.", "12:17: Field 'mField1' is used in only one method.", "13:17: Field 'mField2' is used in only one method.", "47:17: Field 'mField0' is used in only one method.", "48:17: Field 'mField1' is used in only one method.", "49:17: Field 'mField2' is used in only one method.", "105:19: Field 'mField' is used in only one method.", }; verify(checkConfig, getPath("usage/InputOneMethodPrivateField.java"), expected); }
Example #7
Source File: UnusedPrivateMethodCheckTest.java From cacheonix-core with GNU Lesser General Public License v2.1 | 6 votes |
public void testAllowSerializationMethods() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnusedPrivateMethodCheck.class); checkConfig.addAttribute("allowSerializationMethods", "true"); final String[] expected = { "7:18: Unused private method 'methodUnused0'.", "91:18: Unused private method 'writeObject'.", "95:18: Unused private method 'writeObject'.", "99:18: Unused private method 'writeObject'.", "103:18: Unused private method 'readObject'.", "107:18: Unused private method 'readObject'.", "111:17: Unused private method 'writeReplace'.", "116:20: Unused private method 'writeReplace'.", "121:17: Unused private method 'readResolve'.", "126:20: Unused private method 'readResolve'.", "134:17: Unused private method 'writeObject'.", "139:18: Unused private method 'readObject'.", "143:20: Unused private method 'readResolve'.", "151:17: Unused private method 'readObject'.", }; verify(checkConfig, getPath("usage/InputUnusedMethod.java"), expected); }
Example #8
Source File: UnusedPrivateMethodCheckTest.java From cacheonix-core with GNU Lesser General Public License v2.1 | 6 votes |
public void testDefault() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnusedPrivateMethodCheck.class); final String[] expected = { "7:18: Unused private method 'methodUnused0'.", "66:18: Unused private method 'writeObject'.", "71:18: Unused private method 'readObject'.", "76:20: Unused private method 'writeReplace'.", "82:20: Unused private method 'readResolve'.", "91:18: Unused private method 'writeObject'.", "95:18: Unused private method 'writeObject'.", "99:18: Unused private method 'writeObject'.", "103:18: Unused private method 'readObject'.", "107:18: Unused private method 'readObject'.", "111:17: Unused private method 'writeReplace'.", "116:20: Unused private method 'writeReplace'.", "121:17: Unused private method 'readResolve'.", "126:20: Unused private method 'readResolve'.", "134:17: Unused private method 'writeObject'.", "139:18: Unused private method 'readObject'.", "143:20: Unused private method 'readResolve'.", "151:17: Unused private method 'readObject'.", }; verify(checkConfig, getPath("usage/InputUnusedMethod.java"), expected); }
Example #9
Source File: UnusedLocalVariableCheckTest.java From contribution with GNU Lesser General Public License v2.1 | 5 votes |
public void testDefault() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnusedLocalVariableCheck.class); final String[] expected = { "13:13: Unused local variable 'mUnreadPrimitive'.", "24:16: Unused local variable 'unreadObject'.", "36:15: Unused local variable 'unreadArray'.", "45:13: Unused local variable 'java'.", }; verify(checkConfig, getPath("usage/InputUnusedLocal.java"), expected); }
Example #10
Source File: CheckstyleConfiguration.java From sonar-checkstyle with GNU Lesser General Public License v3.0 | 5 votes |
private void defineModuleCharset(Configuration module) { if (module instanceof DefaultConfiguration && ("Checker".equals(module.getName()) || "com.puppycrawl.tools.checkstyle.Checker".equals(module.getName()))) { final Charset charset = getCharset(); final String charsetName = charset.name(); LOG.info("Checkstyle charset: {}", charsetName); ((DefaultConfiguration) module).addAttribute("charset", charsetName); } }
Example #11
Source File: HiddenStaticMethodTest.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public void testIt() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(HiddenStaticMethodCheck.class); final String[] expected = { "0: Static method 'public static int staticMethod()' hides method in class 'com.puppycrawl.tools.checkstyle.bcel.checks.SuperClass'.", "0: Static method 'public static int staticMethodSameParamName(int i)' hides method in class 'com.puppycrawl.tools.checkstyle.bcel.checks.SuperClass'.", "0: Static method 'public static int staticMethodSameParamType(int x)' hides method in class 'com.puppycrawl.tools.checkstyle.bcel.checks.SuperClass'.", }; verify(checkConfig, getPath("com\\puppycrawl\\tools\\checkstyle\\bcel\\checks\\SubClass.class"), expected); }
Example #12
Source File: UnusedParameterCheckTest.java From contribution with GNU Lesser General Public License v2.1 | 5 votes |
public void testIgnoreNonLocal() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnusedParameterCheck.class); checkConfig.addAttribute("ignoreNonLocal", "true"); final String[] expected = { "8:57: Unused parameter 'aUnreadPrimitive'.", "29:66: Unused parameter 'aUnreadArray'.", }; verify(checkConfig, getPath("usage/InputUnusedParameter.java"), expected); }
Example #13
Source File: UnusedParameterCheckTest.java From contribution with GNU Lesser General Public License v2.1 | 5 votes |
public void testIgnoreFormat() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnusedParameterCheck.class); checkConfig.addAttribute("ignoreFormat", "Array$"); final String[] expected = { "8:57: Unused parameter 'aUnreadPrimitive'.", "16:16: Unused parameter 'aUnreadObject'.", }; verify(checkConfig, getPath("usage/InputUnusedParameter.java"), expected); }
Example #14
Source File: UnusedParameterCheckTest.java From contribution with GNU Lesser General Public License v2.1 | 5 votes |
public void testException() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnusedParameterCheck.class); checkConfig.addAttribute("ignoreCatch", Boolean.FALSE.toString()); final String[] expected = { "8:57: Unused parameter 'aUnreadPrimitive'.", "16:16: Unused parameter 'aUnreadObject'.", "25:26: Unused parameter 'unreadException'.", "29:66: Unused parameter 'aUnreadArray'.", }; verify(checkConfig, getPath("usage/InputUnusedParameter.java"), expected); }
Example #15
Source File: UnusedParameterCheckTest.java From contribution with GNU Lesser General Public License v2.1 | 5 votes |
public void testDefault() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnusedParameterCheck.class); final String[] expected = { "8:57: Unused parameter 'aUnreadPrimitive'.", "16:16: Unused parameter 'aUnreadObject'.", "29:66: Unused parameter 'aUnreadArray'.", }; verify(checkConfig, getPath("usage/InputUnusedParameter.java"), expected); }
Example #16
Source File: UnusedPrivateFieldCheckTest.java From contribution with GNU Lesser General Public License v2.1 | 5 votes |
public void testIgnoreFormat() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnusedPrivateFieldCheck.class); checkConfig.addAttribute("ignoreFormat", "Array$"); final String[] expected = { "10:17: Unused private field 'mUnreadPrimitive'.", "20:17: Unused private field 'mUnused2'.", "22:30: Unused private field 'SUNUSED'.", "64:17: Unused private field 'mUnused'.", }; verify(checkConfig, getPath("usage/InputUnusedField.java"), expected); }
Example #17
Source File: UnusedPrivateFieldCheckTest.java From contribution with GNU Lesser General Public License v2.1 | 5 votes |
public void testDefault() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnusedPrivateFieldCheck.class); final String[] expected = { "10:17: Unused private field 'mUnreadPrimitive'.", "16:19: Unused private field 'mUnreadArray'.", "20:17: Unused private field 'mUnused2'.", "22:30: Unused private field 'SUNUSED'.", "64:17: Unused private field 'mUnused'.", }; verify(checkConfig, getPath("usage/InputUnusedField.java"), expected); }
Example #18
Source File: UnusedPrivateMethodCheckTest.java From contribution with GNU Lesser General Public License v2.1 | 5 votes |
public void testEmptyFile() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnusedPrivateMethodCheck.class); final String[] expected = { }; verify(checkConfig, getPath("usage/InputEmptyFile.java"), expected); }
Example #19
Source File: UnusedPrivateMethodCheckTest.java From contribution with GNU Lesser General Public License v2.1 | 5 votes |
public void testInner() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnusedPrivateMethodCheck.class); final String[] expected = { }; verify(checkConfig, getPath("usage/InputInnerUsedMethod.java"), expected); }
Example #20
Source File: HiddenInheritedFieldTest.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public void testIt() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(HiddenInheritedFieldCheck.class); final String[] expected = { "0: Field 'private int subClassPrivate' hides field in class 'com.puppycrawl.tools.checkstyle.bcel.checks.SuperClass'.", "0: Field 'protected int differentType' hides field in class 'com.puppycrawl.tools.checkstyle.bcel.checks.SuperClass'.", "0: Field 'protected int reusedName' hides field in class 'com.puppycrawl.tools.checkstyle.bcel.checks.SuperClass'.", }; verify(checkConfig, getPath("com\\puppycrawl\\tools\\checkstyle\\bcel\\checks\\SubClass.class"), expected); }
Example #21
Source File: UnusedLocalVariableCheckTest.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public void testDefault() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnusedLocalVariableCheck.class); final String[] expected = { "13:13: Unused local variable 'mUnreadPrimitive'.", "24:16: Unused local variable 'unreadObject'.", "36:15: Unused local variable 'unreadArray'.", "45:13: Unused local variable 'java'.", }; verify(checkConfig, getPath("usage/InputUnusedLocal.java"), expected); }
Example #22
Source File: UnusedLocalVariableCheckTest.java From contribution with GNU Lesser General Public License v2.1 | 5 votes |
public void testIgnoreFormat() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnusedLocalVariableCheck.class); checkConfig.addAttribute("ignoreFormat", "Array$"); final String[] expected = { "13:13: Unused local variable 'mUnreadPrimitive'.", "24:16: Unused local variable 'unreadObject'.", "45:13: Unused local variable 'java'.", }; verify(checkConfig, getPath("usage/InputUnusedLocal.java"), expected); }
Example #23
Source File: HiddenInheritedFieldTest.java From contribution with GNU Lesser General Public License v2.1 | 5 votes |
public void testIt() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(HiddenInheritedFieldCheck.class); final String[] expected = { "0: Field 'private int subClassPrivate' hides field in class 'com.puppycrawl.tools.checkstyle.bcel.checks.SuperClass'.", "0: Field 'protected int differentType' hides field in class 'com.puppycrawl.tools.checkstyle.bcel.checks.SuperClass'.", "0: Field 'protected int reusedName' hides field in class 'com.puppycrawl.tools.checkstyle.bcel.checks.SuperClass'.", }; verify(checkConfig, getPath("com\\puppycrawl\\tools\\checkstyle\\bcel\\checks\\SubClass.class"), expected); }
Example #24
Source File: HiddenStaticMethodTest.java From contribution with GNU Lesser General Public License v2.1 | 5 votes |
public void testIt() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(HiddenStaticMethodCheck.class); final String[] expected = { "0: Static method 'public static int staticMethod()' hides method in class 'com.puppycrawl.tools.checkstyle.bcel.checks.SuperClass'.", "0: Static method 'public static int staticMethodSameParamName(int i)' hides method in class 'com.puppycrawl.tools.checkstyle.bcel.checks.SuperClass'.", "0: Static method 'public static int staticMethodSameParamType(int x)' hides method in class 'com.puppycrawl.tools.checkstyle.bcel.checks.SuperClass'.", }; verify(checkConfig, getPath("com\\puppycrawl\\tools\\checkstyle\\bcel\\checks\\SubClass.class"), expected); }
Example #25
Source File: UnusedLocalVariableCheckTest.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public void testIgnoreFormat() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnusedLocalVariableCheck.class); checkConfig.addAttribute("ignoreFormat", "Array$"); final String[] expected = { "13:13: Unused local variable 'mUnreadPrimitive'.", "24:16: Unused local variable 'unreadObject'.", "45:13: Unused local variable 'java'.", }; verify(checkConfig, getPath("usage/InputUnusedLocal.java"), expected); }
Example #26
Source File: UnusedParameterCheckTest.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public void testIgnoreNonLocal() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnusedParameterCheck.class); checkConfig.addAttribute("ignoreNonLocal", "true"); final String[] expected = { "8:57: Unused parameter 'aUnreadPrimitive'.", "29:66: Unused parameter 'aUnreadArray'.", }; verify(checkConfig, getPath("usage/InputUnusedParameter.java"), expected); }
Example #27
Source File: UnusedParameterCheckTest.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public void testIgnoreFormat() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnusedParameterCheck.class); checkConfig.addAttribute("ignoreFormat", "Array$"); final String[] expected = { "8:57: Unused parameter 'aUnreadPrimitive'.", "16:16: Unused parameter 'aUnreadObject'.", }; verify(checkConfig, getPath("usage/InputUnusedParameter.java"), expected); }
Example #28
Source File: UnusedParameterCheckTest.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public void testException() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnusedParameterCheck.class); checkConfig.addAttribute("ignoreCatch", Boolean.FALSE.toString()); final String[] expected = { "8:57: Unused parameter 'aUnreadPrimitive'.", "16:16: Unused parameter 'aUnreadObject'.", "25:26: Unused parameter 'unreadException'.", "29:66: Unused parameter 'aUnreadArray'.", }; verify(checkConfig, getPath("usage/InputUnusedParameter.java"), expected); }
Example #29
Source File: UnusedParameterCheckTest.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public void testDefault() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnusedParameterCheck.class); final String[] expected = { "8:57: Unused parameter 'aUnreadPrimitive'.", "16:16: Unused parameter 'aUnreadObject'.", "29:66: Unused parameter 'aUnreadArray'.", }; verify(checkConfig, getPath("usage/InputUnusedParameter.java"), expected); }
Example #30
Source File: UnusedPrivateFieldCheckTest.java From cacheonix-core with GNU Lesser General Public License v2.1 | 5 votes |
public void testIgnoreFormat() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(UnusedPrivateFieldCheck.class); checkConfig.addAttribute("ignoreFormat", "Array$"); final String[] expected = { "10:17: Unused private field 'mUnreadPrimitive'.", "20:17: Unused private field 'mUnused2'.", "22:30: Unused private field 'SUNUSED'.", "64:17: Unused private field 'mUnused'.", }; verify(checkConfig, getPath("usage/InputUnusedField.java"), expected); }