File tree Expand file tree Collapse file tree 3 files changed +28
-0
lines changed
main/resources/com/qulice/checkstyle
java/com/qulice/checkstyle
resources/com/qulice/checkstyle Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,15 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
101101 <property name =" message" value =" Two consecutive empty lines" />
102102 </module >
103103 <!--
104+ Checks that the file is not binary
105+ -->
106+ <module name =" RegexpMultiline" >
107+ <property name =" format" value =" .*[\x00-\x08\x0E-\x1F].*" />
108+ <property name =" fileExtensions" value =" java" />
109+ <property name =" id" value =" BinaryFiles" />
110+ <property name =" message" value =" Binary files are not allowed" />
111+ </module >
112+ <!--
104113 JavaDoc regexp checks
105114 -->
106115 <module name =" RegexpSingleline" >
Original file line number Diff line number Diff line change @@ -139,6 +139,16 @@ void acceptsInstanceMethodReferences() throws Exception {
139139 );
140140 }
141141
142+ /**
143+ * CheckstyleValidator can deny binary contents in java file.
144+ * This is test for #1264.
145+ * @throws Exception If something wrong happens inside
146+ */
147+ @ Test
148+ void rejectsJavaFileWithBinaryContent () throws Exception {
149+ this .runValidation ("JavaFileWithBinaryContent.java" , false );
150+ }
151+
142152 /**
143153 * CheckstyleValidator can report error when parameter object is not
144154 * documented.
Original file line number Diff line number Diff line change 1+ /*
2+ * Hello.
3+ */
4+ package foo .bar ;
5+
6+ public class BinaryContent {
7+ // Binary content: □▢■▣▤▥▦▧▨▩
8+ private static String binaryText = "Binary content: \u2581 \u2582 \u2583 \u2584 \u2585 \u2586 \u2587 \u2588 \u2589 " ;
9+ }
You can’t perform that action at this time.
0 commit comments