Skip to content

Commit 9c82145

Browse files
authored
Merge pull request #23 from devkdas/resolve-conf
Resolve conf
2 parents ba81217 + 2dc71ba commit 9c82145

351 files changed

Lines changed: 3374 additions & 3302 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/scripts/badwords.pl

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,29 @@
2020
my @whitelist;
2121
my %alt;
2222
my %exactcase;
23+
my $skip_indented = 1;
24+
25+
if($ARGV[0] eq "-a") {
26+
shift @ARGV;
27+
$skip_indented = 0;
28+
}
29+
my %wl;
30+
if($ARGV[0] eq "-w") {
31+
shift @ARGV;
32+
my $file = shift @ARGV;
33+
open(W, "<$file");
34+
while(<W>) {
35+
if(/^#/) {
36+
# allow #-comments
37+
next;
38+
}
39+
if(/^([^:]*):(\d+):(.*)/) {
40+
$wl{"$1:$2:$3"}=1;
41+
#print STDERR "whitelisted $1:$2:$3\n";
42+
}
43+
}
44+
close(W);
45+
}
2346

2447
my @w;
2548
while(<STDIN>) {
@@ -30,7 +53,7 @@
3053
if($_ =~ /^---(.*)/) {
3154
push @whitelist, $1;
3255
}
33-
elsif($_ =~ /^([^:=]*)([:=])(.*)/) {
56+
elsif($_ =~ /^(.*)([:=])(.*)/) {
3457
my ($bad, $sep, $better)=($1, $2, $3);
3558
push @w, $bad;
3659
$alt{$bad} = $better;
@@ -50,7 +73,7 @@ sub file {
5073
my $in = $_;
5174
$l++;
5275
chomp $in;
53-
if($in =~ /^ /) {
76+
if($skip_indented && $in =~ /^ /) {
5477
next;
5578
}
5679
# remove the link part
@@ -67,8 +90,16 @@ sub file {
6790
($in =~ /^(.*)$w/ && $case) ) {
6891
my $p = $1;
6992
my $c = length($p)+1;
93+
94+
my $ch = "$f:$l:$w";
95+
if($wl{$ch}) {
96+
# whitelisted
97+
print STDERR "$ch found but whitelisted\n";
98+
next;
99+
}
100+
70101
print STDERR "$f:$l:$c: error: found bad word \"$w\"\n";
71-
printf STDERR " %4d | $in\n", $l;
102+
printf STDERR " %4d | %s\n", $l, $in;
72103
printf STDERR " | %*s^%s\n", length($p), " ",
73104
"~" x (length($w)-1);
74105
printf STDERR " maybe use \"%s\" instead?\n", $alt{$w};
@@ -79,9 +110,11 @@ sub file {
79110
close(F);
80111
}
81112

82-
my @files = @ARGV;
83-
84-
foreach my $each (@files) {
113+
my @filemasks = @ARGV;
114+
open(my $git_ls_files, '-|', 'git', 'ls-files', '--', @filemasks) or die "Failed running git ls-files: $!";
115+
while(my $each = <$git_ls_files>) {
116+
chomp $each;
85117
file($each);
86118
}
119+
close $git_ls_files;
87120
exit $errors;

.github/scripts/badwords.txt

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,64 +3,63 @@
33
# SPDX-License-Identifier: curl
44
#
55
back-end:backend
6-
e-mail:email
6+
\be-mail[^/]:email
77
run-time:runtime
88
set-up:setup
99
tool chain:toolchain
1010
tool-chain:toolchain
1111
wild-card:wildcard
1212
wild card:wildcard
13+
\bit's:it is
14+
aren't:are not
15+
can't:cannot
16+
could've:could have
17+
couldn't:could not
18+
didn't:did not
19+
doesn't:does not
20+
don't=do not
1321
i'm:I am
14-
you've:You have
15-
we've:we have
16-
we're:we are
17-
we'll:we will
18-
we'd:we would
19-
they've:They have
20-
they're:They are
21-
they'll:They will
22+
isn't:is not
23+
it'd:it would
24+
should've:should have
25+
that's:that is
26+
there's:there is
2227
they'd:They would
23-
you've:you have
28+
they'll:They will
29+
they're:They are
30+
they've:They have
31+
we'd:we would
32+
we'll:we will
33+
we're:we are
34+
we've:we have
35+
won't:will not
2436
you'd:you would
2537
you'll:you will
2638
you're:you are
27-
should've:should have
28-
don't=do not
29-
could've:could have
30-
doesn't:does not
31-
isn't:is not
32-
aren't:are not
39+
you've:you have
3340
a html: an html
3441
a http: an http
3542
a ftp: an ftp
3643
a IPv4: an IPv4
3744
a IPv6: an IPv6
38-
url =URL
39-
internet\b=Internet
45+
url [^=]=URL
46+
[^/]internet\b=Internet
4047
isation:ization
41-
\bit's:it is
42-
it'd:it would
43-
there's:there is
4448
[^.]\. And: Rewrite it somehow?
4549
^(And|So|But) = Rewrite it somehow?
4650
\. But: Rewrite it somehow?
4751
\. So : Rewrite without "so" ?
48-
dir :directory
52+
dir [^=]=directory
53+
Dir [^=]=Directory
4954
sub-director:subdirector
50-
can't:cannot
51-
that's:that is
5255
web page:webpage
5356
host name\b:hostname
5457
host names\b:hostnames
55-
file name\b:filename
58+
[^;<]file name\b:filename
5659
file names\b:filenames
5760
\buser name\b:username
5861
\buser names\b:usernames
5962
\bpass phrase:passphrase
60-
didn't:did not
61-
doesn't:does not
62-
won't:will not
63-
couldn't:could not
6463
\bwill\b:rewrite to present tense
6564
\b32bit=32-bit
6665
\b64bit=64-bit
@@ -70,7 +69,11 @@ couldn't:could not
7069
32-bits:32 bits or 32-bit
7170
\bvery\b:rephrase using an alternative word
7271
\bCurl\b=curl
72+
\bcURL\b=curl
7373
\bLibcurl\b=libcurl
74+
\bLibCurl\b=libcurl
7475
---WWW::Curl
7576
---NET::Curl
7677
---Curl Corporation
78+
\bmanpages[^./&:-]:man pages
79+
\bmanpage[^si./&:-]:man page

.github/scripts/cleancmd.pl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ sub process {
119119
}
120120
}
121121

122-
for my $f (@ARGV) {
122+
my @filemasks = @ARGV;
123+
open(my $git_ls_files, '-|', 'git', 'ls-files', '--', @filemasks) or die "Failed running git ls-files: $!";
124+
while(my $f = <$git_ls_files>) {
125+
chomp $f;
123126
process($f);
124127
}
128+
close $git_ls_files;

.github/scripts/codespell.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set -eu
77

88
cd "$(dirname "${0}")"/../..
99

10-
# shellcheck disable=SC2046
10+
git ls-files -z | xargs -0 -r \
1111
codespell \
1212
--skip '.github/scripts/pyspelling.words' \
1313
--skip '.github/scripts/typos.toml' \
@@ -16,4 +16,4 @@ codespell \
1616
--skip 'scripts/wcurl' \
1717
--ignore-regex '.*spellchecker:disable-line' \
1818
--ignore-words '.github/scripts/codespell-ignore.words' \
19-
$(git ls-files)
19+
--

.github/scripts/pyspelling.words

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ CSeq
149149
csh
150150
cshrc
151151
CTRL
152-
cURL
153152
CURLcode
154153
curldown
155154
CURLE
@@ -245,6 +244,7 @@ et
245244
etag
246245
ETag
247246
ETags
247+
exa
248248
exe
249249
executables
250250
EXPN
@@ -418,6 +418,7 @@ kerberos
418418
Keychain
419419
keychain
420420
KiB
421+
kibibyte
421422
kickstart
422423
Kirei
423424
Knauf
@@ -492,6 +493,7 @@ Mavrogiannopoulos
492493
Mbed
493494
mbedTLS
494495
md
496+
mebibyte
495497
Meglio
496498
memdebug
497499
MesaLink

.github/scripts/shellcheck.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
#
44
# SPDX-License-Identifier: curl
55

6-
# shellcheck disable=SC2046
7-
shellcheck --exclude=1091 \
6+
set -eu
7+
8+
cd "$(dirname "${0}")"/../..
9+
10+
git grep -z -l -E '^#!(/usr/bin/env bash|/bin/sh|/bin/bash)' | xargs -0 -r \
11+
shellcheck --exclude=1091,2248 \
812
--enable=avoid-nullary-conditions,deprecate-which \
9-
$(grep -l -E '^#!(/usr/bin/env bash|/bin/sh|/bin/bash)' $(git ls-files))
13+
--

.github/scripts/spacecheck.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ sub eol_detect {
8888

8989
my $issues = 0;
9090

91-
open my $git_ls_files, '-|', 'git ls-files' or die "Failed running git ls-files: $!";
91+
open(my $git_ls_files, '-|', 'git ls-files') or die "Failed running git ls-files: $!";
9292
while(my $filename = <$git_ls_files>) {
9393
chomp $filename;
9494

95-
open my $fh, '<', $filename or die "Cannot open '$filename': $!";
95+
open(my $fh, '<', $filename) or die "Cannot open '$filename': $!";
9696
my $content = do { local $/; <$fh> };
9797
close $fh;
9898

.github/scripts/yamlcheck.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55

66
set -eu
77

8-
# shellcheck disable=SC2046
8+
cd "$(dirname "${0}")"/../..
9+
10+
git ls-files '*.yaml' '*.yml' -z | xargs -0 -r \
911
yamllint \
1012
--format standard \
1113
--strict \
12-
--config-data "$(dirname "$0")/yamlcheck.yaml" \
13-
$(git ls-files '*.yaml' '*.yml')
14+
--config-data .github/scripts/yamlcheck.yaml \
15+
--

.github/workflows/checkdocs.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ name: 'Docs'
1414
- '*/ci'
1515
paths:
1616
- '.github/workflows/checkdocs.yml'
17+
- '.github/scripts/**'
1718
- '.github/scripts/mdlinkcheck'
1819
- '/scripts/**'
1920
- '**.md'
@@ -25,6 +26,7 @@ name: 'Docs'
2526
- '.github/workflows/checkdocs.yml'
2627
- '.github/scripts/**'
2728
- '.github/scripts/mdlinkcheck'
29+
- '/scripts/**'
2830
- '**.md'
2931
- 'docs/*'
3032

@@ -66,10 +68,10 @@ jobs:
6668
# JSON
6769
#
6870
# - name: 'trim headers off all *.md files'
69-
# run: git ls-files -z '*.md' | xargs -0 -n1 .github/scripts/trimmarkdownheader.pl
71+
# run: git ls-files '*.md' -z | xargs -0 -n1 .github/scripts/trimmarkdownheader.pl
7072
#
7173
# - name: 'check prose'
72-
# run: git ls-files -z '*.md' | grep -Evz 'CHECKSRC\.md|DISTROS\.md|curl_mprintf\.md|CURLOPT_INTERFACE\.md|interface\.md' | xargs -0 proselint -- README
74+
# run: git ls-files '*.md' -z | grep -Evz 'CHECKSRC\.md|DISTROS\.md|curl_mprintf\.md|CURLOPT_INTERFACE\.md|interface\.md' | xargs -0 proselint -- README
7375
#
7476
# # This is for CHECKSRC and files with aggressive exclamation mark needs
7577
# - name: 'create second proselint config'
@@ -109,9 +111,7 @@ jobs:
109111
persist-credentials: false
110112

111113
- name: 'trim all *.md files in docs/'
112-
run: |
113-
# shellcheck disable=SC2046
114-
.github/scripts/cleancmd.pl $(find docs -name '*.md')
114+
run: .github/scripts/cleancmd.pl 'docs/*.md'
115115

116116
- name: 'install'
117117
run: |
@@ -140,9 +140,7 @@ jobs:
140140
persist-credentials: false
141141

142142
- name: 'badwords'
143-
run: |
144-
# shellcheck disable=SC2046
145-
.github/scripts/badwords.pl < .github/scripts/badwords.txt $(git ls-files '**.md') docs/TODO docs/KNOWN_BUGS packages/OS400/README.OS400
143+
run: .github/scripts/badwords.pl '**.md' docs/TODO docs/KNOWN_BUGS packages/OS400/README.OS400 < .github/scripts/badwords.txt
146144

147145
- name: 'verify synopsis'
148146
run: .github/scripts/verify-synopsis.pl docs/libcurl/curl*.md

.github/workflows/checksrc.yml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
- name: 'pytype'
9292
run: |
9393
source ~/venv/bin/activate
94-
find . -name '*.py' -exec pytype -j auto -k {} +
94+
find . -name '*.py' -exec pytype -j auto -k -- {} +
9595
9696
- name: 'ruff'
9797
run: |
@@ -103,10 +103,6 @@ jobs:
103103
runs-on: ubuntu-latest
104104
timeout-minutes: 3
105105
steps:
106-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
107-
with:
108-
persist-credentials: false
109-
110106
- name: 'install pmccabe'
111107
run: |
112108
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
@@ -115,9 +111,25 @@ jobs:
115111
sudo apt-get -o Dpkg::Use-Pty=0 install \
116112
pmccabe
117113
114+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
115+
with:
116+
persist-credentials: false
117+
118118
- name: 'check scores'
119119
run: ./scripts/top-complexity
120120

121+
xmllint:
122+
name: 'xmllint'
123+
runs-on: macos-latest
124+
timeout-minutes: 1
125+
steps:
126+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
127+
with:
128+
persist-credentials: false
129+
130+
- name: 'check'
131+
run: git grep -z -i -l -E '^<\?xml' | xargs -0 -r xmllint >/dev/null
132+
121133
miscchecks:
122134
name: 'misc checks'
123135
runs-on: ubuntu-latest
@@ -155,9 +167,7 @@ jobs:
155167
- name: 'yamlcheck'
156168
run: .github/scripts/yamlcheck.sh
157169

158-
# we allow some extra in source code
159170
- name: 'badwords'
160171
run: |
161-
# shellcheck disable=SC2046
162-
grep -Ev '(\\bwill| url | dir )' .github/scripts/badwords.txt | \
163-
.github/scripts/badwords.pl $(git ls-files -- src lib include)
172+
# we allow some extra in source code
173+
grep -Ev '(\\bwill| But: | So : )' .github/scripts/badwords.txt | .github/scripts/badwords.pl -a src lib include docs/examples

0 commit comments

Comments
 (0)