Repository navigation
build: deny self-named module files - #6
Merged
Merged
Conversation
Turn on clippy's self_named_module_files check as an error. Clippy is Rust's code checker. A module is a named part of the code, usually a file or a folder, and a crate is a Rust package. With this check, a module that has its own folder puts its code in foo/mod.rs inside that folder, not in a foo.rs file beside it. Every pichi-vm crate uses this same layout. No source files use the rejected layout. Fixes #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Set
self_named_module_filestodenyin clippy (Rust's code checker).Every pichi-vm crate (a Rust package) uses the same
mod.rslayout formodules that have their own folder, so the code follows one layout.
Fixes #5
Approach
A module is a named part of the code, usually a file or a folder. This
lint (an automatic code check) requires a module with its own folder to
use
foo/mod.rsinside that folder, rather thanfoo.rsbeside it.No source files use the rejected layout.
The setting is in
Cargo.toml(the build settings file), besidepedantic(clippy's extra-strict group of checks). Thefuzzproject isfor fuzzing, which means feeding random inputs to look for crashes. It
has no lint table, so it is not part of this change.
Verification
The regular test run passed 105 tests, with 0 failed, 0 ignored, and
0 filtered out. The ignored-only run passed 0 tests, with 0 failed,
0 ignored, and 105 filtered out.
The documentation test run passed 1 test, with 0 failed, 1 ignored, and
0 filtered out. The ignored-only documentation run passed that ignored
example: 1 passed, 0 failed, 0 ignored, and 1 filtered out. Both examples
passed across the two runs.
The tests and documentation tests also passed with warnings treated as errors, as the automatic checks do: 105 regular tests passed, the ignored-only run passed 0 with 105 filtered out, the documentation run passed 1 with 1 ignored, and its ignored-only run passed 1 with 1 filtered out, with no failures.
rustfmt, run through cargo fmt (Rust's code formatter), and clippy passed.
cargo-deny (the dependency policy checker), gitlint (the commit message
checker), hawkeye (the license header checker), and actionlint (the
workflow file checker) passed. The whitespace check passed.
Documentation built with docsrs (the setting used when docs.rs builds
the documentation). Fixture regeneration with dtc (the devicetree
compiler) passed and produced matching files.
cargo fuzz (the Rust fuzzing tool) built all targets with nightly (the
preview build of Rust). Each run used a seeded corpus (the saved set of
sample inputs a fuzzer starts from). Each target ran with a 60-second
limit; the fuzzer reported 61 elapsed seconds for each run.
fuzz_parsecompleted 2,378,477 runs,fuzz_overlaycompleted1,562,227 runs, and
fuzz_ownedcompleted 1,823,829 runs.All three passed with no crashes and no crash artifacts.
A test file placed beside a same-named folder makes clippy fail.