Skip to content

Commit

Permalink
Issue checkstyle#15555: modified Example4.py to Example4.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
mohitsatr authored and romani committed Sep 12, 2024
1 parent d1099dd commit eac2b81
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void testExample4() throws Exception {
"1: " + getCheckMessage(MSG_KEY_NO_NEWLINE_EOF),
};

verifyWithInlineConfigParser(getPath("Example4.py"), expected);
verifyWithInlineConfigParser(getPath("Example4.cpp"), expected);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/*xml
<module name="Checker">
<module name="NewlineAtEndOfFile">
<property name="fileExtensions" value="java, xml, py"/>
<property name="fileExtensions" value="java, xml, cpp"/>
</module>
</module>
*/
// violation 7 lines above 'File does not end with a newline.'
// xdoc section -- start
print("Hello world!")
# no ⤶ below it is violation
int main() { //
return 0;//
} // no ⤶ below it is violation
// xdoc section -- end
11 changes: 6 additions & 5 deletions src/xdocs/checks/misc/newlineatendoffile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,19 +128,20 @@ public class Example3 { // &#x2936;
</source>

<p id="Example4-config">
To configure the check to work only on Java, XML and Python files:
To configure the check to work only on Java, XML and Cpp files:
</p>
<source>
&lt;module name=&quot;Checker&quot;&gt;
&lt;module name=&quot;NewlineAtEndOfFile&quot;&gt;
&lt;property name=&quot;fileExtensions&quot; value=&quot;java, xml, py&quot;/&gt;
&lt;property name=&quot;fileExtensions&quot; value=&quot;java, xml, cpp&quot;/&gt;
&lt;/module&gt;
&lt;/module&gt;
</source>
<p id="Example4-code">Python file <code>Example4.py</code>:</p>
<p id="Example4-code">Cpp file <code>Example4.cpp</code>:</p>
<source>
print(&quot;Hello world!&quot;)
# no &#x2936; below it is violation
int main() { // &#x2936;
return 0;// &#x2936;
} // no &#x2936; below it is violation
</source>

<p id="Example5-code">Java file <code>Example5.java</code>:</p>
Expand Down
8 changes: 4 additions & 4 deletions src/xdocs/checks/misc/newlineatendoffile.xml.template
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,17 @@ StaticMethodCandidateCheck.name = Static Method Candidate
</macro>

<p id="Example4-config">
To configure the check to work only on Java, XML and Python files:
To configure the check to work only on Java, XML and Cpp files:
</p>
<macro name="example">
<param name="path"
value="resources/com/puppycrawl/tools/checkstyle/checks/newlineatendoffile/Example4.py"/>
value="resources/com/puppycrawl/tools/checkstyle/checks/newlineatendoffile/Example4.cpp"/>
<param name="type" value="config"/>
</macro>
<p id="Example4-code">Python file <code>Example4.py</code>:</p>
<p id="Example4-code">Cpp file <code>Example4.cpp</code>:</p>
<macro name="example">
<param name="path"
value="resources/com/puppycrawl/tools/checkstyle/checks/newlineatendoffile/Example4.py"/>
value="resources/com/puppycrawl/tools/checkstyle/checks/newlineatendoffile/Example4.cpp"/>
<param name="type" value="code"/>
</macro>

Expand Down

0 comments on commit eac2b81

Please sign in to comment.