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

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=0d5602d95fbf696e117e1de2f5861ed360440f2e

commit 0d5602d95fbf696e117e1de2f5861ed360440f2e
Author: Guillem Jover <[email protected]>
AuthorDate: Tue Aug 28 02:42:32 2018 +0200

    test: Add new codespell author test
---
 .gitlab-ci.yml                |  2 +-
 Makefile.am                   |  2 ++
 README                        |  1 +
 debian/changelog              |  1 +
 t/{cppcheck.t => codespell.t} | 34 ++++++++++++++++++++++++++--------
 t/codespell/stopwords         | 14 ++++++++++++++
 6 files changed, 45 insertions(+), 9 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4dea92ec4..b3d16f608 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -22,7 +22,7 @@ unit-tests:
   stage: test
   script:
     - eatmydata apt install -qq -y --no-install-recommends
-      fakeroot gpg cppcheck aspell aspell-en i18nspector
+      fakeroot gpg cppcheck aspell aspell-en codespell i18nspector
       libtest-strict-perl libtest-minimumversion-perl libtest-perl-critic-perl
       libtest-pod-perl libtest-pod-coverage-perl libtest-spelling-perl
       libtest-synopsis-perl
diff --git a/Makefile.am b/Makefile.am
index 0445daaa1..cf78ed8ce 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -160,11 +160,13 @@ test_scripts = \
        t/syntax.t \
        t/strict.t \
        t/critic.t \
+       t/codespell.t \
        t/cppcheck.t \
        $(nil)
 
 test_data = \
        t/critic/perlcriticrc \
+       t/codespell/stopwords \
        t/cppcheck/cppcheck.supp \
        $(nil)
 
diff --git a/README b/README
index 723ae3eed..fd24d0097 100644
--- a/README
+++ b/README
@@ -88,6 +88,7 @@ To run the test suite («make check»):
   Test::Perl::Critic perl module (optional, author)
   aspell (optional, author)
   aspell-en (optional, author)
+  codespell (optional, author)
   cppcheck (optional, author)
   fakeroot (optional)
   gpg (optional)
diff --git a/debian/changelog b/debian/changelog
index 79b849ab9..0bb03dd40 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -278,6 +278,7 @@ dpkg (1.19.1) UNRELEASED; urgency=medium
     - Add new unit tests for namevalue, fsys-hash and pkg-hash libdpkg modules.
     - Improve coverage of perl unit tests.
     - Delete fixup lines from i18nspector output instead of emptying them.
+    - Add new codespell author test.
 
   [ Updated programs translations ]
   * Dutch (Frans Spiesschaert). Closes: #881401
diff --git a/t/cppcheck.t b/t/codespell.t
similarity index 63%
copy from t/cppcheck.t
copy to t/codespell.t
index 696b6b08c..101b00bba 100644
--- a/t/cppcheck.t
+++ b/t/codespell.t
@@ -20,26 +20,44 @@ use Test::More;
 use Test::Dpkg qw(:needs);
 
 test_needs_author();
-test_needs_command('cppcheck');
+test_needs_command('codespell');
 test_needs_srcdir_switch();
 
 plan tests => 1;
 
-my @cppcheck_opts = (qw(
-  -q --force --error-exitcode=2
-  --suppressions-list=t/cppcheck/cppcheck.supp
+my @codespell_skip = qw(
+  .git
+  *.po
+  *.pot
+  *.gmo
+  *.add
+  *.cache
+  ChangeLog
+  Makefile.in
+  Makefile
+  configure
+  libtool
+  libtool.m4
+  aclocal.m4
+);
+my $codespell_skip = join ',', @codespell_skip;
+
+my @codespell_opts = (qw(
+  --ignore-words=t/codespell/stopwords
 ), (
-  '--enable=warning,performance,portability,style',
-  '--template=\'{file}:{line}: {severity} ({id}): {message}\''
+  "--skip=$codespell_skip"
 ));
-my $tags = qx(cppcheck @cppcheck_opts . 2>&1);
+my $tags = qx(codespell @codespell_opts 2>&1);
 
 # Fixup the output:
+$tags =~ s/^WARNING: Binary file:.*\n//mg;
+$tags =~ s{^\./build-aux/.*\n}{}mg;
+$tags =~ s{^\./man/[a-zA-Z_]+/.*\n}{}mg;
 chomp $tags;
 
 my $ok = length $tags == 0;
 
-ok($ok, 'cppcheck');
+ok($ok, 'codespell');
 if (not $ok) {
     diag($tags);
 }
diff --git a/t/codespell/stopwords b/t/codespell/stopwords
new file mode 100644
index 000000000..a8ef90dde
--- /dev/null
+++ b/t/codespell/stopwords
@@ -0,0 +1,14 @@
+chage
+cmo
+creat
+iff
+isnt
+lowercased
+mitre
+objext
+readded
+rela
+te
+thru
+ths
+troup

-- 
Dpkg.Org's dpkg

Reply via email to