Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom linting framework + freeze struct enforcement lint #724

Merged
merged 57 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
f241f66
add root crate
sam0x17 Jul 17, 2024
770b21a
linting scaffold
sam0x17 Jul 17, 2024
aebe741
lints trait
sam0x17 Jul 17, 2024
33d11d7
more
sam0x17 Jul 17, 2024
44e1d4d
working but not parallel
sam0x17 Jul 17, 2024
a65fb77
Merge remote-tracking branch 'origin/devnet-ready' into sam-custom-lints
sam0x17 Aug 7, 2024
eb4746f
fix warnings
sam0x17 Aug 7, 2024
252fea5
cargo +nightly fmt
sam0x17 Aug 7, 2024
b2e5290
cargo fix --workspace
sam0x17 Aug 7, 2024
932e7b2
compiling but overflowing stack
sam0x17 Aug 7, 2024
4a87650
working in parallel :tada:
sam0x17 Aug 7, 2024
60f04ad
use channels, warning syntax 100% working
sam0x17 Aug 7, 2024
75857e9
freeze struct lint scaffold
sam0x17 Aug 7, 2024
a9200bc
working! cleaning up now
sam0x17 Aug 7, 2024
323f5ef
now actually working, before had false positives
sam0x17 Aug 7, 2024
a71a3a0
WIP
sam0x17 Aug 7, 2024
dad50ac
ALMOST
sam0x17 Aug 7, 2024
e1ba277
clean up
sam0x17 Aug 8, 2024
13db9e6
add missing freeze_struct to Registration
sam0x17 Aug 8, 2024
6a792ce
add missing freeze_structs + confirm detection issue with crate::free…
sam0x17 Aug 8, 2024
b3485c9
fix detection issue
sam0x17 Aug 8, 2024
a76484c
fix rerun-if logic
sam0x17 Aug 8, 2024
f704724
add missing freeze_struct to PrometheusInfo
sam0x17 Aug 8, 2024
955ee84
hack: include linting framework in main crate so we can test it
sam0x17 Aug 8, 2024
19aa49f
refactor to enable testing, separate linting crate
sam0x17 Aug 8, 2024
2abb319
tests for freeze struct lint
sam0x17 Aug 8, 2024
4e976a1
ensure no warnings allowed / re-enable cargo check --workspace job
sam0x17 Aug 8, 2024
583c6a7
cargo clippy --fix --workspace
sam0x17 Aug 8, 2024
34ca8a9
cargo +nightly fmt
sam0x17 Aug 8, 2024
3c4903e
check that CI fails successfully
sam0x17 Aug 8, 2024
b98133d
test warning detection in CI
sam0x17 Aug 9, 2024
af6435a
proper check for custom lint failures
sam0x17 Aug 9, 2024
e47f2de
clippy fixes
sam0x17 Aug 9, 2024
3398adc
tweak
sam0x17 Aug 9, 2024
63da5af
try again
sam0x17 Aug 9, 2024
fad9f69
tweak again
sam0x17 Aug 9, 2024
4b79e61
try again
sam0x17 Aug 9, 2024
a4ac8b6
try echoing the file
sam0x17 Aug 9, 2024
4021d60
warning detection should be working in CI now
sam0x17 Aug 9, 2024
dbe2a89
but actually now
sam0x17 Aug 9, 2024
fe0d6ad
try catting
sam0x17 Aug 9, 2024
9c3690b
strip color codes
sam0x17 Aug 9, 2024
370ca7f
whoops
sam0x17 Aug 9, 2024
75df997
working, now proper error message at the end
sam0x17 Aug 9, 2024
567696f
fix exit status
sam0x17 Aug 9, 2024
7aa4dc8
fix unwrap
sam0x17 Aug 9, 2024
320aecf
fix clippy warning
sam0x17 Aug 9, 2024
7072971
last remaining warning
sam0x17 Aug 9, 2024
2cb7ef4
allow multiple linting errors per file
sam0x17 Aug 11, 2024
3b8cab1
change Lint trait to take a syn::File instead
sam0x17 Aug 11, 2024
ee1422e
cargo clippy --fix --workspace --all-features
sam0x17 Aug 11, 2024
fec737d
bump spec version
sam0x17 Aug 11, 2024
bbd1b5f
fix localnet.sh to use production profile + sane workspace setup
sam0x17 Aug 11, 2024
42cb74f
Merge remote-tracking branch 'origin/devnet-ready' into sam-custom-lints
sam0x17 Aug 15, 2024
d4a5165
Merge remote-tracking branch 'origin/devnet-ready' into sam-custom-lints
sam0x17 Aug 16, 2024
9b0d246
switch localnet back to release
sam0x17 Aug 16, 2024
6333edd
strip out DummyLint
sam0x17 Aug 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/check-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,54 @@ jobs:
- name: cargo clippy --workspace --all-targets -- -D warnings
run: cargo clippy --workspace --all-targets -- -D warnings

cargo-check-lints:
name: check custom lints
runs-on: SubtensorCI
strategy:
matrix:
rust-branch:
- stable
rust-target:
- x86_64-unknown-linux-gnu
# - x86_64-apple-darwin
os:
- ubuntu-latest
# - macos-latest
env:
RELEASE_NAME: development
RUSTV: ${{ matrix.rust-branch }}
RUSTFLAGS: -D warnings
RUST_BACKTRACE: full
RUST_BIN_DIR: target/${{ matrix.rust-target }}
SKIP_WASM_BUILD: 1
TARGET: ${{ matrix.rust-target }}
steps:
- name: Check-out repository under $GITHUB_WORKSPACE
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update &&
sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler

- name: Install Rust ${{ matrix.rust-branch }}
uses: actions-rs/[email protected]
with:
toolchain: ${{ matrix.rust-branch }}
components: rustfmt, clippy
profile: minimal

- name: Utilize Shared Rust Cache
uses: Swatinem/[email protected]
with:
key: ${{ matrix.os }}-${{ env.RUST_BIN_DIR }}

- name: check lints
run: |
set -o pipefail # Ensure the pipeline fails if any command in the pipeline fails
cargo check 2>&1 | sed -r "s/\x1B\[[0-9;]*[mK]//g" | tee /dev/tty | grep -q "^warning:" && \
(echo "Build emitted the following warnings:" >&2 && exit 1) || echo "No warnings found."

cargo-clippy-all-features:
name: cargo clippy --all-features
runs-on: SubtensorCI
Expand Down
Loading
Loading