1 /* 2 LocalVariableName 3 format = (default)^([a-z][a-zA-Z0-9]*|_)$ 4 allowOneCharVarInForLoop = (default)false 5 6 7 */ 8 9 package com.puppycrawl.tools.checkstyle.checks.naming.localvariablename; 10 import java.io.*; 11 /** 12 * Contains simple mistakes: 13 * - Long lines 14 * - Tabs 15 * - Format of variables and parameters 16 * - Order of modifiers 17 * @author Oliver Burn 18 **/ 19 20 final class InputLocalVariableName1two 21 { 22 private InputLocalVariableName1two() 23 { 24 // a line 25 // a line 26 // a line 27 // a line 28 // a line 29 // a line 30 // a line 31 // a line 32 } 33 34 /** test local variables */ 35 private void localVariables() 36 { 37 // normal decl 38 int abc = 0; 39 int ABC = 0; // violation 40 41 // final decls 42 final int cde = 0; 43 final int CDE = 0; 44 45 // decl in for loop init statement 46 for (int k = 0; k < 1; k++) 47 { 48 String innerBlockVariable = ""; 49 } 50 for (int I = 0; I < 1; I++) // violation 51 { 52 String InnerBlockVariable = ""; // violation 53 } 54 } 55 56 /** test method pattern */ 57 void ALL_UPPERCASE_METHOD() 58 { 59 } 60 61 /** test illegal constant **/ 62 private static final int BAD__NAME = 3; 63 64 // A very, very long line that is OK because it matches the regexp "^.*is OK.*regexp.*$" 65 // long line that has a tab -> <- and would be OK if tab counted as 1 char 66 // tabs that count as one char because of their position -> <- -> <-, OK 67 68 /** some lines to test the violation column after tabs */ 69 void errorColumnAfterTabs() 70 { 71 // with tab-width 8 all statements below start at the same column, 72 // with different combinations of ' ' and '\t' before the statement 73 int tab0 =1; 74 int tab1 =1; 75 int tab2 =1; 76 int tab3 =1; 77 int tab4 =1; 78 int tab5 =1; 79 } 80 81 // MEMME: 82 /* MEMME: a 83 * MEMME: 84 * OOOO 85 */ 86 /* NOTHING */ 87 /* YES */ /* MEMME: x */ /* YES!! */ 88 89 /** test long comments **/ 90 void veryLong() 91 { 92 /* 93 blah blah blah blah 94 blah blah blah blah 95 blah blah blah blah 96 blah blah blah blah 97 blah blah blah blah 98 blah blah blah blah 99 blah blah blah blah 100 blah blah blah blah 101 blah blah blah blah 102 blah blah blah blah 103 blah blah blah blah 104 blah blah blah blah 105 blah blah blah blah 106 blah blah blah blah 107 blah blah blah blah 108 enough talk */ 109 } 110 111 /** 112 * @see to lazy to document all args. Testing excessive # args 113 **/ 114 void toManyArgs(int aArg1, int aArg2, int aArg3, int aArg4, int aArg5, 115 int aArg6, int aArg7, int aArg8, int aArg9) 116 { 117 } 118 }