[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[lintian] 06/06: c/cruft: Add comments to regex



This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository lintian.

commit ef1a598a58411ab86834aa46500b0702e540d9b3
Author: Niels Thykier <niels@thykier.net>
Date:   Sun Sep 6 11:50:48 2015 +0200

    c/cruft: Add comments to regex
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 checks/cruft.pm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/checks/cruft.pm b/checks/cruft.pm
index 416e01e..c804f8d 100644
--- a/checks/cruft.pm
+++ b/checks/cruft.pm
@@ -973,11 +973,16 @@ sub _linelength_test {
         $strip =~ s/^\s+//g;
         # from perl faq strip comments
         $strip =~ s{
+                     # Strip /* */ comments
                      /\* [^*]*+ \*++ (?: [^/*][^*]*+\*++ ) */
+                     # Strip // comments (C++ style)
                   |  // (?: [^\\] | [^\n][\n]? )*? (?=\n)
                   |  (
+                         # Keep "/* */" (etc) as is
                          "(?: \\. | [^"\\]++)*"
+                         # Keep '/**/' (etc) as is
                        | '(?: \\. | [^'\\]++)*'
+                         # Keep anything else
                        | .[^/"'\\]*+
                      )
                    }{defined $1 ? $1 : ""}xgse;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: