forked from rust-lang/rust-clippy
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
197 changed files
with
9,497 additions
and
1 deletion.
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
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 @@ | ||
* text=auto eol=lf |
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,4 @@ | ||
|
||
# TODO (check if already done) | ||
* [ ] Add tests | ||
* [ ] Add CHANGELOG.md entry |
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,44 @@ | ||
{ | ||
"problemMatcher": [ | ||
{ | ||
"owner": "cargo-common", | ||
"pattern": [ | ||
{ | ||
"regexp": "^(warning|warn|error)(\\[(\\S*)\\])?: (.*)$", | ||
"severity": 1, | ||
"message": 4, | ||
"code": 3 | ||
}, | ||
{ | ||
"regexp": "^\\s+-->\\s(\\S+):(\\d+):(\\d+)$", | ||
"file": 1, | ||
"line": 2, | ||
"column": 3 | ||
} | ||
] | ||
}, | ||
{ | ||
"owner": "cargo-test", | ||
"pattern": [ | ||
{ | ||
"regexp": "^.*panicked\\s+at\\s+'(.*)',\\s+(.*):(\\d+):(\\d+)$", | ||
"message": 1, | ||
"file": 2, | ||
"line": 3, | ||
"column": 4 | ||
} | ||
] | ||
}, | ||
{ | ||
"owner": "cargo-fmt", | ||
"pattern": [ | ||
{ | ||
"regexp": "^(Diff in (\\S+)) at line (\\d+):", | ||
"message": 1, | ||
"file": 2, | ||
"line": 3 | ||
} | ||
] | ||
} | ||
] | ||
} |
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,76 @@ | ||
name: Release new version | ||
|
||
on: | ||
workflow_dispatch: | ||
secrets: | ||
CARGO_REGISTRY_TOKEN: | ||
required: true | ||
|
||
env: | ||
RUST_BACKTRACE: 1 | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
create-release: | ||
name: Create release | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/main' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
persist-credentials: true | ||
|
||
- name: Install rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
override: true | ||
|
||
- uses: Swatinem/rust-cache@v2 | ||
|
||
# Determine which version we're about to publish, so we can tag it appropriately. | ||
# If the tag already exists, then we've already published this version. | ||
- name: Determine current version | ||
id: version-check | ||
run: | | ||
# Fail on first error, on undefined variables, and on errors in pipes. | ||
set -euo pipefail | ||
export VERSION="$(cargo metadata --format-version 1 | \ | ||
jq --arg crate_name ui_test --exit-status -r \ | ||
'.packages[] | select(.name == $crate_name) | .version')" | ||
echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
if [[ "$(git tag -l "$VERSION")" != '' ]]; then | ||
echo "Aborting: Version $VERSION is already published, we found its tag in the repo." | ||
exit 1 | ||
fi | ||
# TODO: Replace this with the cargo-semver-checks v2 GitHub Action when it's stabilized: | ||
# https://github.com/obi1kenobi/cargo-semver-checks-action/pull/21 | ||
- name: Semver-check | ||
run: | | ||
# Fail on first error, on undefined variables, and on errors in pipes. | ||
set -euo pipefail | ||
cargo install --locked cargo-semver-checks | ||
cargo semver-checks check-release | ||
- name: Publish | ||
run: cargo publish | ||
env: | ||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
|
||
- name: Tag the version | ||
run: | | ||
# Fail on first error, on undefined variables, and on errors in pipes. | ||
set -euo pipefail | ||
git tag "${{ steps.version-check.outputs.version }}" | ||
git push origin "${{ steps.version-check.outputs.version }}" | ||
- uses: taiki-e/create-gh-release-action@v1 | ||
name: Create GitHub release | ||
with: | ||
branch: main | ||
ref: refs/tags/${{ steps.version-check.outputs.version }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,60 @@ | ||
name: Rust | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
fmt: | ||
name: check rustfmt | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: rustfmt | ||
- name: Format | ||
run: cargo fmt --check | ||
|
||
clippy: | ||
name: check clippy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: clippy | ||
- name: Clippy | ||
run: cargo clippy -- -D warnings | ||
|
||
tests: | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
host_target: x86_64-unknown-linux-gnu | ||
- os: macos-latest | ||
host_target: x86_64-apple-darwin | ||
- os: windows-latest | ||
host_target: i686-pc-windows-msvc | ||
runs-on: ${{ matrix.os }} | ||
# Run tests under a directory with a space in it to double check the windows path heuristic | ||
defaults: | ||
run: | ||
working-directory: "dir with spaces/ui test" | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
path: "dir with spaces/ui test" | ||
- uses: dtolnay/rust-toolchain@stable | ||
- name: Build | ||
run: cargo build --verbose | ||
- name: Run ui tests | ||
run: cargo test --verbose --test integration -- --check | ||
- name: Run unit tests | ||
run: cargo test --verbose |
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 @@ | ||
target |
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,75 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
### Added | ||
|
||
### Fixed | ||
|
||
### Changed | ||
|
||
### Removed | ||
|
||
## [0.22.2] - 2024-02-27 | ||
|
||
### Added | ||
|
||
### Fixed | ||
|
||
### Changed | ||
|
||
* `spanned` dependency bump to lower `bstr` to `1.6.0` to resolve windows linker issues with `1.7` | ||
|
||
### Removed | ||
|
||
## [0.22.1] - 2024-02-16 | ||
|
||
### Added | ||
|
||
* Add `//~v` comments to put an error matcher above the error site. | ||
|
||
### Fixed | ||
|
||
* Give aux builds the default comment config, too | ||
|
||
### Changed | ||
|
||
### Removed | ||
|
||
## [0.22.0] - 2024-01-24 | ||
|
||
### Added | ||
|
||
* Started maintaining a changelog | ||
* `Config::comment_defaults` allows setting `//@` comments for all tests | ||
* `//~` comments can now specify just an error code or lint name, without any message. ERROR level is implied | ||
* `Revisioned::diagnostic_code_prefix` allows stripping a prefix of diagnostic codes to avoid having to repeat `clippy::` in all messages | ||
|
||
### Fixed | ||
|
||
* report an error instead of panicking when encountering a suggestion that does not belong to the main file. | ||
* number of filtered tests is now > 0 when things actually got filtered. | ||
|
||
### Changed | ||
|
||
* crate-private span handling was passed off to the `spanned` crate, improving some diagnostics along the way. | ||
* `Config::output_conflict_handling` does not contain the bless command message anymore, it is instead available separately as `Config::bless_command` | ||
* Updating `cargo_metadata` to `0.18` | ||
* Updated `spanned` to `0.1.5`, giving more precise spans for more iterator operations | ||
* `Config::cfgs` is now `Config::program::cfg_flag` | ||
* Bumped `annotate-snippets` to `0.10` | ||
|
||
### Removed | ||
|
||
* `$DIR` and `RUSTLIB` replacements | ||
* `Config::edition` (replaced by `config.comment_defaults.base().edition`) | ||
* `Config::filter_stdout` (replaced by `config.comment_defaults.base().normalize_stdout`) | ||
* `Config::filter_stderr` (replaced by `config.comment_defaults.base().normalize_stderr`) | ||
* `Config::mode` (replaced by `config.comment_defaults.base().mode`) | ||
|
||
## [0.21.2] - 2023-09-27 |
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,7 @@ | ||
## Running the test suite | ||
|
||
Running `cargo test` will automatically update the `.stderr` | ||
and `.stdout` files. | ||
|
||
If you only want to check that the output files match and not | ||
update them, use `cargo test -- -- --check` |
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,46 @@ | ||
[package] | ||
name = "ui_test" | ||
version = "0.22.2" | ||
edition = "2021" | ||
license = "MIT OR Apache-2.0" | ||
description = "A test framework for testing rustc diagnostics output" | ||
repository = "https://github.com/oli-obk/ui_test" | ||
rust-version = "1.63" | ||
|
||
[lib] | ||
test = true # we have unit tests | ||
doctest = false # but no doc tests | ||
|
||
[dependencies] | ||
rustc_version = "0.4" | ||
colored = "2" | ||
lazy_static = "1.4.0" | ||
serde = { version = "1.0", features = ["derive"] } | ||
serde_json = "1.0" | ||
cargo_metadata = "0.18" | ||
crossbeam-channel = "0.5.6" | ||
tempfile = "3.3.0" | ||
bstr = "1.0.1" | ||
rustfix = "0.6.1" | ||
cargo-platform = "0.1.2" | ||
comma = "1.0.0" | ||
anyhow = "1.0.6" | ||
indicatif = "0.17.6" | ||
prettydiff = { version = "0.6.4", default_features = false } | ||
annotate-snippets = { version = "0.10.0" } | ||
levenshtein = "1.0.5" | ||
spanned = "0.1.6" | ||
|
||
[dependencies.regex] | ||
version = "1.5.5" | ||
default-features = false | ||
features = ["unicode-gencat"] | ||
|
||
[dependencies.color-eyre] | ||
version = "0.6.1" | ||
default-features = false | ||
features = ["capture-spantrace"] | ||
|
||
[[test]] | ||
name = "integration" | ||
harness = false |
Oops, something went wrong.