Skip to content

Commit

Permalink
Issue #15340: created InputFormatted file for section 2.3.1 whitespac…
Browse files Browse the repository at this point in the history
…e characters
  • Loading branch information
Zopsss authored and rdiachenko committed Aug 24, 2024
1 parent 5b2b330 commit 7a5837f
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/checkstyle-resources-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
<suppress checks="FileTabCharacter"
files="src[\\/]test[\\/]resources[\\/]com[\\/]puppycrawl[\\/]tools[\\/]checkstyle[\\/]filters[\\/]suppresswithplaintextcommentfilter[\\/]Input.*"/>
<suppress checks="FileTabCharacter"
files="[\\/]it[\\/]resources[\\/]com[\\/]google[\\/]checkstyle[\\/]test[\\/]chapter2filebasic[\\/]rule231filetab[\\/]InputWhitespaceCharacters\.java"/>
files="[\\/]it[\\/]resources[\\/]com[\\/]google[\\/]checkstyle[\\/]test[\\/]chapter2filebasic[\\/]rule231filetab[\\/]Input.*\.java"/>
<suppress checks="FileTabCharacter"
files="[\\/]InputRegressionJavaClass1\.java"/>
<suppress checks="FileTabCharacter"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,9 @@ public void testFileTab() throws Exception {
verifyWithWholeConfig(getPath("InputWhitespaceCharacters.java"));
}

@Test
public void testFileTabFormatted() throws Exception {
verifyWithWholeConfig(getPath("InputFormattedWhitespaceCharacters.java"));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.google.checkstyle.test.chapter2filebasic.rule231filetab;

final class InputFormattedWhitespaceCharacters {
// Long line ----------------------------------------------------------------
// Contains a tab -> <- // violation 'Line contains a tab character.'
// Contains trailing whitespace ->

/**
* Some javadoc.
*
* @param badFormat1 bad format
* @param badFormat2 bad format
* @param badFormat3 bad format
* @return hack
* @throws Exception abc
*/
int test1(int badFormat1, int badFormat2, final int badFormat3) throws Exception {
return 0;
}

// A very, very long line that is OK because it matches the regexp "^.*is OK.*regexp.*$"
// long line that has a tab -> <- and would be OK if tab counted as 1 char
// violation above 'Line contains a tab character.'

// tabs that count as one char because of their position -> <- -> <-
// violation above 'Line contains a tab character.'

/** some lines to test the column after tabs. */
void violateColumnAfterTabs() {
// with tab-width 8 all statements below start at the same column,
// with different combinations of ' ' and '\t' before the statement
int tab0 = 1;
int tab1 = 1;
int tab2 = 1;
int tab3 = 1;
int tab4 = 1;
int tab5 = 1;
}
}

0 comments on commit 7a5837f

Please sign in to comment.