Problems with RegexpMultiline Pattern for detecting windows line endings
Patrick Gottschaemmer <[email protected]> Thu, 17 Jan 2013 12:10:22 +0100
| Newsgroups | gmane.comp.java.audit.checkstyle.user |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
--===============3975558546801865500==
Content-Type: multipart/alternative;
boundary="------------010108070908010604080606"
This is a multi-part message in MIME format.
--------------010108070908010604080606
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Hello,
the following checkstyle code
<module name="Checker">
<module name="RegexpMultiline">
<property name="format" value=".*(\r\n)(.*|\r\n|\n)*"/>
</module>
</module>
should actually detect a single windows line ending in a textfile.
However, my checkstyle-result looks like this:
(for a file with only windows new lines).
<error line="1" severity="error" message="Line matches the illegal
pattern '.*(\r\n)(.*|\r\n|\n)*'."
source="com.puppycrawl.tools.checkstyle.checks.regexp.RegexpMultilineCheck"/>
<error line="2" severity="error" message="Line matches the illegal
pattern '.*(\r\n)(.*|\r\n|\n)*'."
source="com.puppycrawl.tools.checkstyle.checks.regexp.RegexpMultilineCheck"/>
<error line="3" severity="error" message="Line matches the illegal
pattern '.*(\r\n)(.*|\r\n|\n)*'."
source="com.puppycrawl.tools.checkstyle.checks.regexp.RegexpMultilineCheck"/>
...
So, what I actually want is:
- Detect one (or more) windows line endings in a file and print out
one error for it (e.g., with the first appeareance as error line).
- NOT one error for each line with a windows line ending
- Line endings in a file could be mixed (windows + unix new lines),
so a simple
<module name="NewlineAtEndOfFile">
<property name="lineSeparator" value="lf"/>
won't do the trick unfortunately.
I've tried some variations of the pattern above, but I just can't find
the missing part.
Is this maybe due to the fact how checkstyle parses Regular Expressions?
Best regards
Patrick Gottschaemmer
--------------010108070908010604080606
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-15">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hello,<br>
<br>
the following checkstyle code<br>
<br>
<blockquote><module name="Checker"><br>
<module name="RegexpMultiline"><br>
<property name="format"
value=".*(\r\n)(.*|\r\n|\n)*"/><br>
</module><br>
</module><br>
</blockquote>
should actually detect a single windows line ending in a textfile.
However, my checkstyle-result looks like this:<br>
(for a file with only windows new lines).<br>
<br>
<blockquote><error line="1" severity="error" message="Line
matches the illegal pattern
&apos;.*(\r\n)(.*|\r\n|\n)*&apos;."
source="com.puppycrawl.tools.checkstyle.checks.regexp.RegexpMultilineCheck"/><br>
<error line="2" severity="error" message="Line matches the
illegal pattern &apos;.*(\r\n)(.*|\r\n|\n)*&apos;."
source="com.puppycrawl.tools.checkstyle.checks.regexp.RegexpMultilineCheck"/><br>
<error line="3" severity="error" message="Line matches the
illegal pattern &apos;.*(\r\n)(.*|\r\n|\n)*&apos;."
source="com.puppycrawl.tools.checkstyle.checks.regexp.RegexpMultilineCheck"/><br>
...<br>
</blockquote>
<br>
So, what I actually want is:<br>
<br>
- Detect one (or more) windows line endings in a file and print
out one error for it (e.g., with the first appeareance as error
line).<br>
- NOT one error for each line with a windows line ending<br>
- Line endings in a file could be mixed (windows + unix new
lines), so a simple<br>
<blockquote><module name="NewlineAtEndOfFile"><br>
<property name="lineSeparator" value="lf"/><br>
</blockquote>
won't do the trick unfortunately. <br>
I've tried some variations of the pattern above, but I just can't
find the missing part. <br>
Is this maybe due to the fact how checkstyle parses Regular
Expressions?<br>
<br>
Best regards<br>
Patrick Gottschaemmer<br>
</body>
</html>
--------------010108070908010604080606--
--===============3975558546801865500==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
--===============3975558546801865500==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Checkstyle-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/checkstyle-user
--===============3975558546801865500==--