Add forbid script (#827)
This commit is contained in:
parent
50cd24d37b
commit
d8c00ac2e4
11
.github/workflows/build.yaml
vendored
11
.github/workflows/build.yaml
vendored
@ -77,10 +77,6 @@ jobs:
|
||||
- name: Clippy
|
||||
run: cargo clippy --all --all-targets --all-features
|
||||
|
||||
- name: Lint
|
||||
if: matrix.os != 'windows-2016'
|
||||
run: cargo run lint
|
||||
|
||||
- name: Install Rustfmt Toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
@ -98,6 +94,13 @@ jobs:
|
||||
./bin/generate-completions
|
||||
git diff --no-ext-diff --quiet --exit-code
|
||||
|
||||
- name: Check for Forbidden Words
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install ripgrep
|
||||
./bin/forbid
|
||||
|
||||
- name: Package
|
||||
id: package
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
|
9
bin/forbid
Executable file
9
bin/forbid
Executable file
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
! rg \
|
||||
--glob !bin/forbid \
|
||||
--glob !CHANGELOG.md \
|
||||
--ignore-case \
|
||||
'dbg!|fixme|todo|xxx'
|
11
justfile
11
justfile
@ -61,7 +61,7 @@ version := `sed -En 's/version[[:space:]]*=[[:space:]]*"([^"]+)"/v\1/p' Cargo.to
|
||||
changes:
|
||||
git log --pretty=format:%s >> CHANGELOG.md
|
||||
|
||||
check: lint clippy test
|
||||
check: clippy test forbid
|
||||
git diff --no-ext-diff --quiet --exit-code
|
||||
grep {{version}} CHANGELOG.md
|
||||
cargo +nightly generate-lockfile -Z minimal-versions
|
||||
@ -114,16 +114,13 @@ install-dev-deps-homebrew:
|
||||
clippy:
|
||||
cargo clippy --all --all-targets --all-features
|
||||
|
||||
forbid:
|
||||
./bin/forbid
|
||||
|
||||
# count non-empty lines of code
|
||||
sloc:
|
||||
@cat src/*.rs | sed '/^\s*$/d' | wc -l
|
||||
|
||||
@lint:
|
||||
echo Checking for FIXME/TODO...
|
||||
! grep --color -Ein 'fixme|todo|xxx|#\[ignore\]' src/*.rs
|
||||
echo Checking for long lines...
|
||||
! grep --color -En '.{101}' src/*.rs
|
||||
|
||||
replace FROM TO:
|
||||
sd '{{FROM}}' '{{TO}}' src/*.rs
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user