Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
f5ea9f2b
Unverified
Commit
f5ea9f2b
authored
2 years ago
by
Andrew Morgan
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add rust linting commands to `scripts-dev/lint.sh` (#14822)
parent
b50c0084
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/14822.misc
+1
-0
1 addition, 0 deletions
changelog.d/14822.misc
scripts-dev/lint.sh
+33
-0
33 additions, 0 deletions
scripts-dev/lint.sh
with
34 additions
and
0 deletions
changelog.d/14822.misc
0 → 100644
+
1
−
0
View file @
f5ea9f2b
Add `cargo fmt` and `cargo clippy` to the lint script.
\ No newline at end of file
This diff is collapsed.
Click to expand it.
scripts-dev/lint.sh
+
33
−
0
View file @
f5ea9f2b
...
@@ -101,10 +101,43 @@ echo
...
@@ -101,10 +101,43 @@ echo
# Print out the commands being run
# Print out the commands being run
set
-x
set
-x
# Ensure the sort order of imports.
isort
"
${
files
[@]
}
"
isort
"
${
files
[@]
}
"
# Ensure Python code conforms to an opinionated style.
python3
-m
black
"
${
files
[@]
}
"
python3
-m
black
"
${
files
[@]
}
"
# Ensure the sample configuration file conforms to style checks.
./scripts-dev/config-lint.sh
./scripts-dev/config-lint.sh
# Catch any common programming mistakes in Python code.
# --quiet suppresses the update check.
# --quiet suppresses the update check.
ruff
--quiet
"
${
files
[@]
}
"
ruff
--quiet
"
${
files
[@]
}
"
# Catch any common programming mistakes in Rust code.
#
# --bins, --examples, --lib, --tests combined explicitly disable checking
# the benchmarks, which can fail due to `#![feature]` macros not being
# allowed on the stable rust toolchain (rustc error E0554).
#
# --allow-staged and --allow-dirty suppress clippy raising errors
# for uncommitted files. Only needed when using --fix.
#
# -D warnings disables the "warnings" lint.
#
# Using --fix has a tendency to cause subsequent runs of clippy to recompile
# rust code, which can slow down this script. Thus we run clippy without --fix
# first which is quick, and then re-run it with --fix if an error was found.
if
!
cargo-clippy
--bins
--examples
--lib
--tests
--
-D
warnings
>
/dev/null 2>&1
;
then
cargo-clippy
\
--bins
--examples
--lib
--tests
--allow-staged
--allow-dirty
--fix
--
-D
warnings
fi
# Ensure the formatting of Rust code.
cargo-fmt
# Ensure all Pydantic models use strict types.
./scripts-dev/check_pydantic_models.py lint
./scripts-dev/check_pydantic_models.py lint
# Ensure type hints are correct.
mypy
mypy
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment