forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 'src/tools/clippy/' from commit 'd2708873ef711ec8ab45df1e984ecf24…
…a96cd369' git-subtree-dir: src/tools/clippy git-subtree-mainline: 06c4481 git-subtree-split: d270887
- Loading branch information
Showing
1,286 changed files
with
114,475 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[alias] | ||
uitest = "test --test compile-test" | ||
dev = "run --package clippy_dev --bin clippy_dev --manifest-path clippy_dev/Cargo.toml --" | ||
|
||
[build] | ||
rustflags = ["-Zunstable-options"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.yml] | ||
indent_size = 2 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* text=auto eol=lf | ||
*.rs text eol=lf whitespace=tab-in-indent,trailing-space,tabwidth=4 | ||
*.fixed linguist-language=Rust |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!-- | ||
Hi there! Whether you've come to make a suggestion for a new lint, an improvement to an existing lint or to report a bug or a false positive in Clippy, you've come to the right place. | ||
For bug reports and false positives, please include the output of `cargo clippy -V` in the report. | ||
Thank you for using Clippy! | ||
Write your comment below this line: --> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Thank you for making Clippy better! | ||
|
||
We're collecting our changelog from pull request descriptions. | ||
If your PR only updates to the latest nightly, you can leave the | ||
`changelog` entry as `none`. Otherwise, please write a short comment | ||
explaining your change. | ||
|
||
If your PR fixes an issue, you can add "fixes #issue_number" into this | ||
PR description. This way the issue will be automatically closed when | ||
your PR is merged. | ||
|
||
If you added a new lint, here's a checklist for things that will be | ||
checked during review or continuous integration. | ||
|
||
- [ ] Followed [lint naming conventions][lint_naming] | ||
- [ ] Added passing UI tests (including committed `.stderr` file) | ||
- [ ] `cargo test` passes locally | ||
- [ ] Executed `cargo dev update_lints` | ||
- [ ] Added lint documentation | ||
- [ ] Run `cargo dev fmt` | ||
|
||
[lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints | ||
|
||
Note that you can skip the above if you are just opening a WIP PR in | ||
order to get feedback. | ||
|
||
Delete this line and everything above before opening your PR. | ||
|
||
--- | ||
|
||
changelog: none |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
echo "Removing the current docs for master" | ||
rm -rf out/master/ || exit 0 | ||
|
||
echo "Making the docs for master" | ||
mkdir out/master/ | ||
cp util/gh-pages/index.html out/master | ||
python3 ./util/export.py out/master/lints.json | ||
|
||
if [[ -n $TAG_NAME ]]; then | ||
echo "Save the doc for the current tag ($TAG_NAME) and point stable/ to it" | ||
cp -r out/master "out/$TAG_NAME" | ||
rm -f out/stable | ||
ln -s "$TAG_NAME" out/stable | ||
fi | ||
|
||
if [[ $BETA = "true" ]]; then | ||
echo "Update documentation for the beta release" | ||
cp -r out/master out/beta | ||
fi | ||
|
||
# Generate version index that is shown as root index page | ||
cp util/gh-pages/versions.html out/index.html | ||
|
||
echo "Making the versions.json file" | ||
python3 ./util/versions.py out | ||
|
||
cd out | ||
# Now let's go have some fun with the cloned repo | ||
git config user.name "GHA CI" | ||
git config user.email "gha@ci.invalid" | ||
|
||
if git diff --exit-code --quiet; then | ||
echo "No changes to the output on this push; exiting." | ||
exit 0 | ||
fi | ||
|
||
if [[ -n $TAG_NAME ]]; then | ||
# Add the new dir | ||
git add "$TAG_NAME" | ||
# Update the symlink | ||
git add stable | ||
# Update versions file | ||
git add versions.json | ||
git commit -m "Add documentation for ${TAG_NAME} release: ${SHA}" | ||
elif [[ $BETA = "true" ]]; then | ||
git add beta | ||
git commit -m "Automatic deploy to GitHub Pages (beta): ${SHA}" | ||
else | ||
git add . | ||
git commit -m "Automatic deploy to GitHub Pages: ${SHA}" | ||
fi | ||
|
||
git push "$SSH_REPO" "$TARGET_BRANCH" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
# Check sysroot handling | ||
sysroot=$(./target/debug/clippy-driver --print sysroot) | ||
test "$sysroot" = "$(rustc --print sysroot)" | ||
|
||
if [[ ${OS} == "Windows" ]]; then | ||
desired_sysroot=C:/tmp | ||
else | ||
desired_sysroot=/tmp | ||
fi | ||
sysroot=$(./target/debug/clippy-driver --sysroot $desired_sysroot --print sysroot) | ||
test "$sysroot" = $desired_sysroot | ||
|
||
sysroot=$(SYSROOT=$desired_sysroot ./target/debug/clippy-driver --print sysroot) | ||
test "$sysroot" = $desired_sysroot | ||
|
||
# Make sure this isn't set - clippy-driver should cope without it | ||
unset CARGO_MANIFEST_DIR | ||
|
||
# Run a lint and make sure it produces the expected output. It's also expected to exit with code 1 | ||
# FIXME: How to match the clippy invocation in compile-test.rs? | ||
./target/debug/clippy-driver -Dwarnings -Aunused -Zui-testing --emit metadata --crate-type bin tests/ui/cstring.rs 2> cstring.stderr && exit 1 | ||
sed -e "s,tests/ui,\$DIR," -e "/= help/d" cstring.stderr > normalized.stderr | ||
diff normalized.stderr tests/ui/cstring.stderr | ||
|
||
# TODO: CLIPPY_CONF_DIR / CARGO_MANIFEST_DIR |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
name: Clippy Test | ||
|
||
on: | ||
push: | ||
# Ignore bors branches, since they are covered by `clippy_bors.yml` | ||
branches-ignore: | ||
- auto | ||
- try | ||
# Don't run Clippy tests, when only textfiles were modified | ||
paths-ignore: | ||
- 'COPYRIGHT' | ||
- 'LICENSE-*' | ||
- '**.md' | ||
- '**.txt' | ||
pull_request: | ||
# Don't run Clippy tests, when only textfiles were modified | ||
paths-ignore: | ||
- 'COPYRIGHT' | ||
- 'LICENSE-*' | ||
- '**.md' | ||
- '**.txt' | ||
|
||
env: | ||
RUST_BACKTRACE: 1 | ||
CARGO_TARGET_DIR: '${{ github.workspace }}/target' | ||
NO_FMT_TEST: 1 | ||
|
||
jobs: | ||
base: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Setup | ||
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master | ||
with: | ||
github_token: "${{ secrets.github_token }}" | ||
|
||
- name: rust-toolchain | ||
uses: actions-rs/toolchain@v1.0.3 | ||
with: | ||
toolchain: nightly | ||
target: x86_64-unknown-linux-gnu | ||
profile: minimal | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v2.0.0 | ||
|
||
- name: Run cargo update | ||
run: cargo update | ||
|
||
- name: Cache cargo dir | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.cargo | ||
key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-x86_64-unknown-linux-gnu | ||
- name: Master Toolchain Setup | ||
run: bash setup-toolchain.sh | ||
|
||
# Run | ||
- name: Set LD_LIBRARY_PATH (Linux) | ||
run: | | ||
SYSROOT=$(rustc --print sysroot) | ||
echo "::set-env name=LD_LIBRARY_PATH::${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" | ||
- name: Build | ||
run: cargo build --features deny-warnings | ||
|
||
- name: Test | ||
run: cargo test --features deny-warnings | ||
|
||
- name: Test clippy_lints | ||
run: cargo test --features deny-warnings | ||
working-directory: clippy_lints | ||
|
||
- name: Test rustc_tools_util | ||
run: cargo test --features deny-warnings | ||
working-directory: rustc_tools_util | ||
|
||
- name: Test clippy_dev | ||
run: cargo test --features deny-warnings | ||
working-directory: clippy_dev | ||
|
||
- name: Test cargo-clippy | ||
run: ../target/debug/cargo-clippy | ||
working-directory: clippy_workspace_tests | ||
|
||
- name: Test clippy-driver | ||
run: bash .github/driver.sh | ||
env: | ||
OS: ${{ runner.os }} | ||
|
||
# Cleanup | ||
- name: Run cargo-cache --autoclean | ||
run: | | ||
cargo +nightly install cargo-cache --no-default-features --features ci-autoclean cargo-cache | ||
cargo cache |
Oops, something went wrong.