mirror of
https://github.com/curl/curl.git
synced 2026-04-16 17:31:41 +03:00
scripts: fix shellcheck SC2046 warnings
Fix SC2046: "Quote this to prevent word splitting." Ref: https://www.shellcheck.net/wiki/SC2046 Also: - shellcheck.sh: add `set -eu`. - shellcheck.sh, yamlcheck.sh: always run from repo root. - pass `--` before passing the list of files, where missing. - badwords.pl, cleancmd.pl: rework to accept `git ls-files` arguments. Requires Perl 5.22+ (2015-Jun-01) on Windows. Ref: https://perldoc.perl.org/functions/open - INTERNALS.md: require Perl 5.22 on Windows. - spacecheck.pl: formatting. - GHA/http3-linux: rework command to avoid SC2046. - stop suppressing SC2046 warnings. The yamlcheck.sh issue reported-by: Stanislav Fort (Aisle Research) Ref: 20251109163515_6eb31da3-deb2-4f4d-8327-935904f27da5 Closes #19432
This commit is contained in:
parent
f477f3efc3
commit
b39c158e4a
10 changed files with 33 additions and 29 deletions
8
.github/scripts/badwords.pl
vendored
8
.github/scripts/badwords.pl
vendored
|
|
@ -79,9 +79,11 @@ sub file {
|
|||
close(F);
|
||||
}
|
||||
|
||||
my @files = @ARGV;
|
||||
|
||||
foreach my $each (@files) {
|
||||
my @filemasks = @ARGV;
|
||||
open(my $git_ls_files, '-|', 'git', 'ls-files', '--', @filemasks) or die "Failed running git ls-files: $!";
|
||||
while(my $each = <$git_ls_files>) {
|
||||
chomp $each;
|
||||
file($each);
|
||||
}
|
||||
close $git_ls_files;
|
||||
exit $errors;
|
||||
|
|
|
|||
6
.github/scripts/cleancmd.pl
vendored
6
.github/scripts/cleancmd.pl
vendored
|
|
@ -119,6 +119,10 @@ sub process {
|
|||
}
|
||||
}
|
||||
|
||||
for my $f (@ARGV) {
|
||||
my @filemasks = @ARGV;
|
||||
open(my $git_ls_files, '-|', 'git', 'ls-files', '--', @filemasks) or die "Failed running git ls-files: $!";
|
||||
while(my $f = <$git_ls_files>) {
|
||||
chomp $f;
|
||||
process($f);
|
||||
}
|
||||
close $git_ls_files;
|
||||
|
|
|
|||
4
.github/scripts/codespell.sh
vendored
4
.github/scripts/codespell.sh
vendored
|
|
@ -7,7 +7,7 @@ set -eu
|
|||
|
||||
cd "$(dirname "${0}")"/../..
|
||||
|
||||
# shellcheck disable=SC2046
|
||||
git ls-files -z | xargs -0 -r \
|
||||
codespell \
|
||||
--skip '.github/scripts/pyspelling.words' \
|
||||
--skip '.github/scripts/typos.toml' \
|
||||
|
|
@ -16,4 +16,4 @@ codespell \
|
|||
--skip 'scripts/wcurl' \
|
||||
--ignore-regex '.*spellchecker:disable-line' \
|
||||
--ignore-words '.github/scripts/codespell-ignore.words' \
|
||||
$(git ls-files)
|
||||
--
|
||||
|
|
|
|||
10
.github/scripts/shellcheck.sh
vendored
10
.github/scripts/shellcheck.sh
vendored
|
|
@ -3,7 +3,11 @@
|
|||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
|
||||
# shellcheck disable=SC2046
|
||||
shellcheck --exclude=1091 \
|
||||
set -eu
|
||||
|
||||
cd "$(dirname "${0}")"/../..
|
||||
|
||||
git grep -z -l -E '^#!(/usr/bin/env bash|/bin/sh|/bin/bash)' | xargs -0 -r \
|
||||
shellcheck --exclude=1091,2248 \
|
||||
--enable=avoid-nullary-conditions,deprecate-which \
|
||||
$(grep -l -E '^#!(/usr/bin/env bash|/bin/sh|/bin/bash)' $(git ls-files))
|
||||
--
|
||||
|
|
|
|||
4
.github/scripts/spacecheck.pl
vendored
4
.github/scripts/spacecheck.pl
vendored
|
|
@ -88,11 +88,11 @@ sub eol_detect {
|
|||
|
||||
my $issues = 0;
|
||||
|
||||
open my $git_ls_files, '-|', 'git ls-files' or die "Failed running git ls-files: $!";
|
||||
open(my $git_ls_files, '-|', 'git ls-files') or die "Failed running git ls-files: $!";
|
||||
while(my $filename = <$git_ls_files>) {
|
||||
chomp $filename;
|
||||
|
||||
open my $fh, '<', $filename or die "Cannot open '$filename': $!";
|
||||
open(my $fh, '<', $filename) or die "Cannot open '$filename': $!";
|
||||
my $content = do { local $/; <$fh> };
|
||||
close $fh;
|
||||
|
||||
|
|
|
|||
8
.github/scripts/yamlcheck.sh
vendored
8
.github/scripts/yamlcheck.sh
vendored
|
|
@ -5,9 +5,11 @@
|
|||
|
||||
set -eu
|
||||
|
||||
# shellcheck disable=SC2046
|
||||
cd "$(dirname "${0}")"/../..
|
||||
|
||||
git ls-files '*.yaml' '*.yml' -z | xargs -0 -r \
|
||||
yamllint \
|
||||
--format standard \
|
||||
--strict \
|
||||
--config-data "$(dirname "$0")/yamlcheck.yaml" \
|
||||
$(git ls-files '*.yaml' '*.yml')
|
||||
--config-data .github/scripts/yamlcheck.yaml \
|
||||
--
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue