Bugzilla – Attachment 86572 Details for
Bug 21892
Robin Sheat is not a typo
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21892: Add prompt for CodeSpell update
Bug-21892-Add-prompt-for-CodeSpell-update.patch (text/plain), 2.82 KB, created by
Mark Tompsett
on 2019-03-13 15:31:44 UTC
(
hide
)
Description:
Bug 21892: Add prompt for CodeSpell update
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2019-03-13 15:31:44 UTC
Size:
2.82 KB
patch
obsolete
>From 0fbd714b27a766c3e1c9e633dc3cebf97fd2e2d8 Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Wed, 13 Mar 2019 15:29:33 +0000 >Subject: [PATCH] Bug 21892: Add prompt for CodeSpell update > >TEST PLAN >--------- >Now you can say no, get the spelling error. >Say yes, and the spelling error goes away. >--- > QohA/File.pm | 39 ++++++++++++++++++++++++++++++++++----- > koha-qa.pl | 9 +++------ > 2 files changed, 37 insertions(+), 11 deletions(-) > >diff --git a/QohA/File.pm b/QohA/File.pm >index e37afb4..9c5f669 100644 >--- a/QohA/File.pm >+++ b/QohA/File.pm >@@ -120,16 +120,45 @@ sub tell_bash_to_unhash_codespell { > my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run( command => $cmd, verbose => 0 ); > } > >+# returns 1 if Codespell should have -L after calling this. >+# returns 0 if it was not fixed. >+sub fix_if_desired { >+ my $result = 0; >+ print STDERR "Would you like to update Codespell? (y/N) "; >+ my $answer = <STDIN>; >+ if ($answer =~ /[yY]/ ) { >+ remove_codespell; >+ install_codespell; >+ tell_bash_to_unhash_codespell; >+ $result = 1; >+ } >+ return $result; >+} >+ >+sub have_codespell { >+ my $have_it = 0; >+ if ( -f '/usr/bin/codespell' || -f '/usr/local/bin/codespell' ) { >+ $have_it = 1; >+ } >+ return $have_it; >+} >+ > sub check_spelling { > my ($self) = @_; > >+ return 0 if ! have_codespell(); >+ >+ my $has_l_option = 1; > if (! codespell_has_L_option()) { >- print STDERR "\nCodespell missing required -L option!\n"; >- remove_codespell; >- install_codespell; >- tell_bash_to_unhash_codespell; >+ print STDERR "\nCodespell missing -L option!\n"; >+ $has_l_option = fix_if_desired; >+ } >+ my $cmd; >+ if ($has_l_option) { >+ $cmd = q{codespell -L sheat -d } . $self->path; >+ } else { >+ $cmd = q{codespell -d } . $self->path; > } >- my $cmd = q{codespell -L sheat -d } . $self->path; > my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run( command => $cmd, verbose => 0 ); > > return 0 unless @$full_buf; >diff --git a/koha-qa.pl b/koha-qa.pl >index 098393a..2cd5f86 100755 >--- a/koha-qa.pl >+++ b/koha-qa.pl >@@ -41,16 +41,13 @@ BEGIN { > } > > our @tests_to_skip = (); >-# Check for codespell >-my $have_codespell = 0; >-if ( -f '/usr/bin/codespell' || -f '/usr/local/bin/codespell' ) { >- $have_codespell = 1; >-} >-# Assuming codespell is in /usr/bin >+ >+my $have_codespell = QohA::File::have_codespell(); > if (! $have_codespell ) { > warn "You should install codespell\n"; > push @tests_to_skip, 'spelling'; > } >+ > unless ( can_load( modules => { 't::lib::QA::TemplateFilters' => undef } ) ) { > warn "You are using a version of Koha that does not contain bug 13618 and/or bug 21393. Missing filters check will be skipped.\n"; > push @tests_to_skip, 'filters'; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21892
:
82680
|
82681
|
82682
|
85571
| 86572