From 79c90e10376bc62884b06d4f39912e86a5957c7b Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Tue, 8 Mar 2016 10:38:52 -0500 Subject: [PATCH] Bug 16003 - Add exceptions file logic to codespell call I created an exceptions file by: $ git grep "isnt(" | cut -f2- -d":" | sort -u > ~/qa-test-tools/spelling.exceptions I then patched QohA/File.pm to include a -x extension to the codespell call if the exceptions file existed. TEST PLAN --------- In your koha development directory apply bug 15870 run the koha qa test tools -- you will get a complaint about isnt(, likely because it is tokenized as isnt. apply this patch to your qa test tools run the koha qa test tools on bug 15870 again -- spelling issue passed! --- QohA/File.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/QohA/File.pm b/QohA/File.pm index 420dfbd..bd217f7 100644 --- a/QohA/File.pm +++ b/QohA/File.pm @@ -75,7 +75,14 @@ sub check_forbidden_patterns { sub check_spelling { my ($self) = @_; - my $cmd = q{codespell -d } . $self->path; + my $exception_file = dirname(abs_path($0)) . q{/QohA/spelling.exceptions}; + my $cmd; + if (-e $exception_file) { + $cmd = q{codespell -x } . $exception_file . q{ -d } . $self->path; + } + else { + $cmd = q{codespell -d } . $self->path; + } my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run( command => $cmd, verbose => 0 ); return 0 unless @$full_buf; -- 2.1.4