View | Details | Raw Unified | Return to bug 21892
Collapse All | Expand All

(-)a/QohA/File.pm (-5 / +34 lines)
Lines 120-135 sub tell_bash_to_unhash_codespell { Link Here
120
    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run( command => $cmd, verbose => 0 );
120
    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run( command => $cmd, verbose => 0 );
121
}
121
}
122
122
123
# returns 1 if Codespell should have -L after calling this.
124
# returns 0 if it was not fixed.
125
sub fix_if_desired {
126
    my $result = 0;
127
    print STDERR "Would you like to update Codespell? (y/N) ";
128
    my $answer = <STDIN>;
129
    if ($answer =~ /[yY]/ ) {
130
        remove_codespell;
131
        install_codespell;
132
        tell_bash_to_unhash_codespell;
133
        $result = 1;
134
    }
135
    return $result;
136
}
137
138
sub have_codespell {
139
    my $have_it = 0;
140
    if ( -f '/usr/bin/codespell' || -f '/usr/local/bin/codespell' ) {
141
        $have_it = 1;
142
    }
143
    return $have_it;
144
}
145
123
sub check_spelling {
146
sub check_spelling {
124
    my ($self) = @_;
147
    my ($self) = @_;
125
148
149
    return 0 if ! have_codespell();
150
151
    my $has_l_option = 1;
126
    if (! codespell_has_L_option()) {
152
    if (! codespell_has_L_option()) {
127
        print STDERR "\nCodespell missing required -L option!\n";
153
        print STDERR "\nCodespell missing -L option!\n";
128
        remove_codespell;
154
        $has_l_option = fix_if_desired;
129
        install_codespell;
155
    }
130
        tell_bash_to_unhash_codespell;
156
    my $cmd;
157
    if ($has_l_option) {
158
        $cmd = q{codespell -L sheat -d } . $self->path;
159
    } else {
160
        $cmd = q{codespell -d } . $self->path;
131
    }
161
    }
132
    my $cmd = q{codespell -L sheat -d } . $self->path;
133
    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run( command => $cmd, verbose => 0 );
162
    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run( command => $cmd, verbose => 0 );
134
163
135
    return 0 unless @$full_buf;
164
    return 0 unless @$full_buf;
(-)a/koha-qa.pl (-7 / +3 lines)
Lines 41-56 BEGIN { Link Here
41
}
41
}
42
42
43
our @tests_to_skip = ();
43
our @tests_to_skip = ();
44
# Check for codespell
44
45
my $have_codespell = 0;
45
my $have_codespell = QohA::File::have_codespell();
46
if ( -f '/usr/bin/codespell' || -f '/usr/local/bin/codespell' ) {
47
    $have_codespell = 1;
48
}
49
# Assuming codespell is in /usr/bin
50
if (! $have_codespell ) {
46
if (! $have_codespell ) {
51
    warn "You should install codespell\n";
47
    warn "You should install codespell\n";
52
    push @tests_to_skip, 'spelling';
48
    push @tests_to_skip, 'spelling';
53
}
49
}
50
54
unless ( can_load( modules => { 't::lib::QA::TemplateFilters' => undef } ) ) {
51
unless ( can_load( modules => { 't::lib::QA::TemplateFilters' => undef } ) ) {
55
    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";
52
    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";
56
    push @tests_to_skip, 'filters';
53
    push @tests_to_skip, 'filters';
57
- 

Return to bug 21892