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

[lintian] 01/01: Avoid false positives in spelling detection by allowing "(s)" suffixes instead of universally stripping all parenthesis. (Closes: #894077)



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

lamby pushed a commit to branch master
in repository lintian.

commit 8782e00c8717c22b942f35b94b98041a9c299b30
Author: Chris Lamb <lamby@debian.org>
Date:   Mon Mar 26 15:33:40 2018 -0400

    Avoid false positives in spelling detection by allowing "(s)" suffixes instead of universally stripping all parenthesis. (Closes: #894077)
    
    This prevents, for example, "directory(s)" from triggering false-positive
    whilst still warning about "directorys". Thanks to Patrick Matthäi for the
    report.
---
 debian/changelog                          | 7 +++++++
 lib/Lintian/Check.pm                      | 4 +++-
 t/tests/manpages-general/debian/program.1 | 1 +
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 7f0bf41..7cc5e32 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,13 @@ lintian (2.5.81) UNRELEASED; urgency=medium
       avoid a false-positive in extra-license-file. Thanks to Innocent De
       Marchi for the report.  (Closes: #894139)
 
+  * lib/Lintian/Check.pm:
+    + [CL] Avoid false positives in spelling detection by allowing "(s)"
+      suffixes instead of universally stripping all parenthesis.  This
+      prevents, for example, "directory(s)" from triggering false-positive
+      whilst still warning about "directorys".  Thanks to Patrick Matthäi
+      for the report.  (Closes: #894077)
+
  -- Chris Lamb <lamby@debian.org>  Sun, 18 Mar 2018 22:55:23 -0400
 
 lintian (2.5.80) unstable; urgency=medium
diff --git a/lib/Lintian/Check.pm b/lib/Lintian/Check.pm
index e553007..d29a9a0 100644
--- a/lib/Lintian/Check.pm
+++ b/lib/Lintian/Check.pm
@@ -285,7 +285,9 @@ sub check_spelling {
         }
     }
 
-    $text =~ tr/()[]//d;
+    $text =~ tr/[]//d;
+    # Strip () except for "(s)" suffixes.
+    $text =~ s/(\((?!s\))|(?<!\(s)\))//gi;
     $text =~ s/(\w-)\s*\n\s*/$1/;
     $text =~ tr/\r\n \t/ /s;
     $text =~ s/\s++/ /g;
diff --git a/t/tests/manpages-general/debian/program.1 b/t/tests/manpages-general/debian/program.1
index d370a94..8d8da5d 100644
--- a/t/tests/manpages-general/debian/program.1
+++ b/t/tests/manpages-general/debian/program.1
@@ -41,6 +41,7 @@ A summary of options is included below.
 For a complete description, see the Info files.
 This is a speling mistake.
 This is the false-positive spelling mistake for the proper noun German.
+This is the false-positive spelling mistake for the quasi-plural directory(S).
 .TP
 .B \-h, \-\-help
 Show summary of options.

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


Reply to: