Skip to content

Commit d45e8eb

Browse files
Merge pull request #560 from cakebaker/move_lints_from_ci_to_cargo_toml
Move lints from CI to `Cargo.toml`
2 parents 9c12e49 + c8dcd12 commit d45e8eb

File tree

19 files changed

+65
-2
lines changed

19 files changed

+65
-2
lines changed

.github/workflows/code-quality.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,8 @@ jobs:
7474
run: |
7575
## `cargo clippy` lint testing
7676
unset fault
77-
CLIPPY_FLAGS="-W clippy::default_trait_access -W clippy::manual_string_new -W clippy::cognitive_complexity -W clippy::implicit_clone -W clippy::range-plus-one -W clippy::redundant-clone -W clippy::match_bool -W clippy::semicolon_if_nothing_returned"
7877
fault_type="${{ steps.vars.outputs.FAULT_TYPE }}"
7978
fault_prefix=$(echo "$fault_type" | tr '[:lower:]' '[:upper:]')
8079
# * convert any warnings to GHA UI annotations; ref: <https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-a-warning-message>
81-
S=$(cargo clippy --all-targets -pprocps -- ${CLIPPY_FLAGS} -D warnings 2>&1) && printf "%s\n" "$S" || { printf "%s\n" "$S" ; printf "%s" "$S" | sed -E -n -e '/^error:/{' -e "N; s/^error:[[:space:]]+(.*)\\n[[:space:]]+-->[[:space:]]+(.*):([0-9]+):([0-9]+).*$/::${fault_type} file=\2,line=\3,col=\4::${fault_prefix}: \`cargo clippy\`: \1 (file:'\2', line:\3)/p;" -e '}' ; fault=true ; }
80+
S=$(cargo clippy --all-targets -pprocps -- -D warnings 2>&1) && printf "%s\n" "$S" || { printf "%s\n" "$S" ; printf "%s" "$S" | sed -E -n -e '/^error:/{' -e "N; s/^error:[[:space:]]+(.*)\\n[[:space:]]+-->[[:space:]]+(.*):([0-9]+):([0-9]+).*$/::${fault_type} file=\2,line=\3,col=\4::${fault_prefix}: \`cargo clippy\`: \1 (file:'\2', line:\3)/p;" -e '}' ; fault=true ; }
8281
if [ -n "${{ steps.vars.outputs.FAIL_ON_FAULT }}" ] && [ -n "$fault" ]; then exit 1 ; fi

Cargo.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,16 @@ inherits = "release"
159159
opt-level = "z"
160160
panic = "abort"
161161
strip = true
162+
163+
[lints]
164+
workspace = true
165+
166+
[workspace.lints.clippy]
167+
default_trait_access = "warn"
168+
manual_string_new = "warn"
169+
cognitive_complexity = "warn"
170+
implicit_clone = "warn"
171+
range-plus-one = "warn"
172+
redundant-clone = "warn"
173+
match_bool = "warn"
174+
semicolon_if_nothing_returned = "warn"

src/uu/free/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ keywords.workspace = true
1010
license.workspace = true
1111
version.workspace = true
1212

13+
[lints]
14+
workspace = true
15+
1316
[dependencies]
1417
bytesize = { workspace = true }
1518
clap = { workspace = true }

src/uu/pgrep/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ keywords.workspace = true
1010
license.workspace = true
1111
version.workspace = true
1212

13+
[lints]
14+
workspace = true
15+
1316
[dependencies]
1417
uucore = { workspace = true, features = ["entries", "signals", "process"] }
1518
clap = { workspace = true }

src/uu/pidof/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ keywords.workspace = true
1010
license.workspace = true
1111
version.workspace = true
1212

13+
[lints]
14+
workspace = true
15+
1316
[dependencies]
1417
uucore = { workspace = true, features = ["process"] }
1518
clap = { workspace = true }

src/uu/pidwait/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ keywords.workspace = true
1010
license.workspace = true
1111
version.workspace = true
1212

13+
[lints]
14+
workspace = true
15+
1316
[dependencies]
1417
nix = { workspace = true }
1518
uucore = { workspace = true, features = ["entries"] }

src/uu/pkill/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ keywords.workspace = true
1010
license.workspace = true
1111
version.workspace = true
1212

13+
[lints]
14+
workspace = true
15+
1316
[dependencies]
1417
uucore = { workspace = true, features = ["entries"] }
1518
clap = { workspace = true }

src/uu/pmap/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ keywords.workspace = true
1010
license.workspace = true
1111
version.workspace = true
1212

13+
[lints]
14+
workspace = true
15+
1316
[dependencies]
1417
uucore = { workspace = true }
1518
clap = { workspace = true }

src/uu/ps/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ keywords.workspace = true
1010
license.workspace = true
1111
version.workspace = true
1212

13+
[lints]
14+
workspace = true
15+
1316
[dependencies]
1417
uucore = { workspace = true, features = ["utmpx"] }
1518
clap = { workspace = true }

src/uu/pwdx/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ keywords.workspace = true
1010
license.workspace = true
1111
version.workspace = true
1212

13+
[lints]
14+
workspace = true
15+
1316
[dependencies]
1417
uucore = { workspace = true }
1518
clap = { workspace = true }

0 commit comments

Comments
 (0)