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

chore: Adopt '_rust/main' template #147

Merged
merged 114 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
e7b7555
chore: First step
epage Mar 29, 2023
d6b4446
docs: Set changelog base
epage Mar 29, 2023
afeff23
chore(ci): Quote strings in yaml
epage Mar 29, 2023
2768727
chore: Don't set rustflags by default
epage Mar 29, 2023
0838840
chore: Update release process
epage Mar 29, 2023
afd6a45
chore: Use workspace inheritance
epage Mar 29, 2023
037f379
chore(ci): Remove rustfmt/clippy next jobs
epage Mar 29, 2023
d1dd4ae
chore(ci): Expand approved licenses
epage Mar 29, 2023
6c8df60
chore: Include Cargo.lock
epage Mar 30, 2023
fbaab42
chore(deps): update msrv to v1.65.0
renovate[bot] Apr 1, 2023
29b981c
Merge pull request #1 from epage/renovate/rust-1.x
epage Apr 1, 2023
614b0a2
docs(contrib): Remove reference to travis
epage Mar 29, 2023
f7b990b
fix(ci): Fix Renovate regexes
epage Apr 17, 2023
4163ad7
style(ci): Match auto-generated style
epage Apr 17, 2023
563de12
chore(ci): Update stabilidyDays to new syntax
epage Apr 17, 2023
2c4a7f5
chore(ci): Delay Renovate PRs until ready
epage Apr 17, 2023
62401b8
chore(ci): Lower the MSRV churn for template
epage Apr 17, 2023
d99db2e
style(ci): Match auto-generated style
epage Apr 17, 2023
afaba35
chore(ci): Use new minimumReleaseAge field
epage Apr 17, 2023
60a8ec8
chore(ci): Ban for_each
epage Apr 18, 2023
96297f0
chore(ci): Clarify why map_or is banned
epage Apr 18, 2023
716170e
chore(gh): Ban rebase merges
epage Apr 18, 2023
80d4cdd
chore: Remove clippy lint past MSRV (needs 1.67)
epage May 18, 2023
2b6bb28
chore(ci): Catch clippy config failures
epage May 18, 2023
4d44cd7
chore: Update precommit hooks
epage May 19, 2023
d6075a4
chore: Expand update window so more likely to be hit
epage Aug 2, 2023
67eb1d9
chore(ci): Ensure lockfile isn't stale
epage Aug 7, 2023
ba76b8b
chore(ci): Ensure latest deps are good
epage Aug 11, 2023
5286387
chore: Update pre-commit hooks
epage Aug 11, 2023
efe14d6
chore(renovate): Make style consistent
epage Aug 22, 2023
a6ecf92
chore(renovate): Update config
epage Aug 22, 2023
c8624f0
chore(renovate): Update MSRV on release
epage Aug 23, 2023
44604fc
chore(renovate): Try to fix schedule
epage Aug 23, 2023
ff82d69
chore(ci): Don't fail on wildcards
epage Aug 23, 2023
5749aa0
chore: Approve ISC
epage Sep 7, 2023
4173c8f
chore(ci): Don't set patch for MSRV
epage Sep 20, 2023
86c29de
chore(ci): Updaet Renovate schema
epage Sep 26, 2023
ac51f09
chore(ci): Normalize json5 syntax
epage Sep 26, 2023
3057980
README.md 'Crates Status' icon link now uses the Markdown placeholder…
peter-lyons-kehl Sep 30, 2023
cad9b47
README.md list indentation and no bare URLs, as per Markdown Lint VS …
peter-lyons-kehl Sep 30, 2023
6d3f888
chore(deps): update actions/checkout action to v4
renovate[bot] Oct 1, 2023
f97fa94
Merge pull request #8 from epage/renovate/actions-checkout-4.x
epage Oct 1, 2023
8499939
Merge pull request #6 from peter-kehl/readme_use_crates_io_link_place…
epage Oct 2, 2023
74beef5
Merge pull request #7 from peter-kehl/readme_pass_markdown_lint
epage Oct 2, 2023
5e3b324
chore(ci): Ensure MSRV is quoted
epage Oct 5, 2023
5ebe30b
chore(ci): Update pre-commit hooks
epage Oct 26, 2023
598c624
chore(config): migrate config .github/renovate.json5
renovate[bot] Dec 3, 2023
8c836ea
Merge pull request #10 from epage/renovate/migrate-config
epage Dec 4, 2023
69fa026
chore(deps): update actions/setup-python action to v5
renovate[bot] Jan 1, 2024
82c9aa7
chore(deps): update github/codeql-action action to v3
renovate[bot] Jan 1, 2024
c7805bc
Merge pull request #12 from epage/renovate/actions-setup-python-5.x
epage Jan 2, 2024
739d2cf
Merge pull request #13 from epage/renovate/github-codeql-action-3.x
epage Jan 2, 2024
a4c0626
chore: Make renovate commits to match
epage Jan 2, 2024
61250a3
chore(ci): Optimize CI runs
epage Jan 3, 2024
e819db4
chore(ci): Cancel prior CI runs
epage Jan 18, 2024
0b02906
chore(ci): Be explicit in renovate updates
epage Jan 24, 2024
131de55
chore(ci): Add m1 runners
epage Jan 31, 2024
9a5af5c
chore(ci): Only check intel mac on schedule
epage Feb 8, 2024
da56001
chore(ci): Gather coverage
epage Feb 8, 2024
1313256
chore(ci): Use latest for coverage
epage Feb 8, 2024
51a98a2
chore(ci): Defer to package.rust-version for clippy
epage Feb 15, 2024
4db293d
chore(ci): Only verify MSRV for published packages
epage Feb 15, 2024
779496b
chore(ci): Run the latest clippy
epage Feb 15, 2024
c977df5
chore(ci): Prevent cargo-hack from blowing away our lockfile
epage Feb 21, 2024
7846c51
chore(deps): Update pre-commit/action action to v3.0.1
renovate[bot] Mar 1, 2024
2d5ff55
Merge pull request #16 from epage/renovate/pre-commit-action-3.x
epage Mar 1, 2024
3d5ead8
chore(ci): Configure standard lints
epage Mar 21, 2024
ace6e07
chore(ci): Don't update stable and MSRV together
epage Mar 21, 2024
8ec86ab
chore: Normalize clippy lint names
epage Mar 25, 2024
8e647d9
chore: Encourage use of workspace.dependencies
epage Mar 28, 2024
126eb3d
chore: Encourage a single test binary
epage Mar 28, 2024
c8b190b
chore(ci): Use latest SARIF
epage Mar 28, 2024
9b1b566
chore(ci): Fix all rust-version-specific checks to stable
epage Mar 28, 2024
92d486c
chore(ci): Speed up lockfile check
epage Mar 28, 2024
9258d9a
chore(ci): More exhaustively check features
epage Mar 28, 2024
2714cca
chore(ci): Don't check for unused crates
epage Mar 28, 2024
314eef7
chore: Dont check must_use
epage Mar 28, 2024
6a9d2bf
chore: Don't warn on unsafe
epage Mar 28, 2024
8d4b1b6
chore: Remove clippy::tests_outside_test_module
epage Mar 28, 2024
99e034b
chore: Move print lints to lib.rs
epage Mar 28, 2024
a516bda
chore: Drop workspace.dependencies
epage Apr 1, 2024
ebc70d0
chore: Only check missing_docs in lib
epage Apr 1, 2024
3278d49
chore: Allow print in tests
epage Apr 1, 2024
d634de6
chore(ci): Ensure CI job always runs
epage Apr 1, 2024
dc3e937
Merge pull request #19 from epage/t
epage Apr 1, 2024
2570b58
chore(ci): Skip branch protections
epage Apr 1, 2024
afd2755
chore(ci): Don't block on Lint Commits
epage Apr 1, 2024
14225df
chore(ci): Auto-merge linter version updates
epage Apr 17, 2024
be30b1b
chore(ci): Try again with not auto-updating MSRV
epage Apr 26, 2024
a01f25d
chore(ci): Reduce noisy lints
epage Apr 26, 2024
82cf9a6
chore(ci): Reduce noisy lints
epage Apr 26, 2024
181a2cf
chore(ci): Allow prelude wildcard imports
epage Apr 26, 2024
51de731
chore(ci): Lint clippy::items_after_statements seems too strict
epage Apr 26, 2024
78741e5
chore: Remove lints that lead to bad code
epage May 28, 2024
44916f6
chore: Update deny config
epage May 29, 2024
ce6badc
chore: Fix typo
epage Jun 3, 2024
1353a95
chore: Encourage use of repository
epage Jun 4, 2024
7039c66
chore: Encourage cloneable repositories
epage Jun 4, 2024
2a274e1
chore(ci): Auto-update Mac now that latest uses m1
epage Jun 21, 2024
0547ff2
docs(contrib): Clarify our policies
epage Jul 4, 2024
eb4e999
Fix typos in CONTRIBUTING.md
jalil-salame Jul 4, 2024
045de93
Merge pull request #21 from jalil-salame/patch-1
epage Jul 4, 2024
bdb06a1
chore(ci): Verify version requirements
epage Jul 9, 2024
87d9ae5
chore: Fix clippy::lint_groups_priority for 1.80
epage Jul 25, 2024
553258a
Have clippy warn about uninlined format arguments
joshtriplett Jul 25, 2024
266ead1
Merge pull request #22 from joshtriplett/clippy-uninlined-format-args
epage Jul 26, 2024
7a28f01
docs(contrib): Fix tpo
epage Aug 24, 2024
37cf108
chore(deps): Update EmbarkStudios/cargo-deny-action action to v2
renovate[bot] Sep 1, 2024
68d2027
Merge pull request #23 from epage/renovate/embarkstudios-cargo-deny-a…
epage Sep 3, 2024
6e193aa
chore: Ensure pre-commit gets non-system Python
epage Sep 27, 2024
35fcbb7
Merge pull request #24 from epage/pre-commit
epage Sep 27, 2024
9599e01
chore: Adopt '_rust/main' template
epage Sep 27, 2024
67ea821
style: Use inline format args
epage Sep 27, 2024
218d7ff
chore(ci): Fix CI
epage Oct 10, 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
41 changes: 39 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
permissions:
contents: none
name: CI
needs: [test, msrv, lockfile, docs, rustfmt, clippy]
needs: [test, msrv, lockfile, docs, rustfmt, clippy, minimal-versions]
runs-on: ubuntu-latest
if: "always()"
steps:
Expand All @@ -34,7 +34,7 @@ jobs:
name: Test
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-14"]
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
rust: ["stable"]
continue-on-error: ${{ matrix.rust != 'stable' }}
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -65,6 +65,24 @@ jobs:
- uses: taiki-e/install-action@cargo-hack
- name: Default features
run: cargo hack check --feature-powerset --locked --rust-version --ignore-private --workspace --lib --bins
minimal-versions:
name: Minimal versions
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install stable Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Install nightly Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
- name: Downgrade dependencies to minimal versions
run: cargo +nightly generate-lockfile -Z minimal-versions
- name: Compile with minimal versions
run: cargo +stable check --workspace --all-features --locked
lockfile:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -138,3 +156,22 @@ jobs:
wait-for-processing: true
- name: Report status
run: cargo clippy --workspace --all-features --all-targets -- -D warnings --allow deprecated
coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Install cargo-tarpaulin
run: cargo install cargo-tarpaulin
- name: Gather coverage
run: cargo tarpaulin --output-dir coverage --out lcov --timeout 120
- name: Publish to Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- uses: pre-commit/[email protected]
2 changes: 1 addition & 1 deletion .github/workflows/rust-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
name: Test
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest", "macos-14"]
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
rust: ["stable", "beta"]
include:
- os: ubuntu-latest
Expand Down
133 changes: 80 additions & 53 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,66 +1,31 @@
[package]
name = "annotate-snippets"
version = "0.11.4"
edition = "2021"
rust-version = "1.65" # MSRV
authors = ["Zibi Braniecki <[email protected]>"]
description = "Library for building code annotations"
license = "Apache-2.0/MIT"
repository = "https://github.com/rust-lang/annotate-snippets-rs"
readme = "README.md"
keywords = ["code", "analysis", "ascii", "errors", "debug"]
[workspace]
resolver = "2"

[package.metadata.release]
tag-name = "{{version}}"
pre-release-replacements = [
{file="CHANGELOG.md", search="Unreleased", replace="{{version}}", min=1},
{file="CHANGELOG.md", search="\\.\\.\\.HEAD", replace="...{{tag_name}}", exactly=1},
{file="CHANGELOG.md", search="ReleaseDate", replace="{{date}}", min=1},
{file="CHANGELOG.md", search="<!-- next-header -->", replace="<!-- next-header -->\n## [Unreleased] - ReleaseDate\n", exactly=1},
{file="CHANGELOG.md", search="<!-- next-url -->", replace="<!-- next-url -->\n[Unreleased]: https://github.com/rust-lang/annotate-snippets-rs/compare/{{tag_name}}...HEAD", exactly=1},
[workspace.package]
repository = "https://github.com/rust-lang/annotate-snippets-rs"
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.65.0" # MSRV
include = [
"build.rs",
"src/**/*",
"Cargo.toml",
"Cargo.lock",
"LICENSE*",
"README.md",
"benches/**/*",
"examples/**/*"
]

[badges]
maintenance = { status = "actively-developed" }

[dependencies]
anstyle = "1.0.4"
memchr = { version = "2.7.4", optional = true }
unicode-width = "0.1.11"

[dev-dependencies]
annotate-snippets = { path = ".", features = ["testing-colors"] }
anstream = "0.6.13"
difference = "2.0.0"
divan = "0.1.14"
glob = "0.3.1"
serde = { version = "1.0.199", features = ["derive"] }
snapbox = { version = "0.6.0", features = ["diff", "term-svg", "cmd", "examples"] }
toml = "0.5.11"
tryfn = "0.2.1"

[[bench]]
name = "bench"
harness = false

[[test]]
name = "fixtures"
harness = false

[features]
default = []
simd = ["memchr"]
testing-colors = []

[lints.rust]
[workspace.lints.rust]
rust_2018_idioms = { level = "warn", priority = -1 }
unreachable_pub = "warn"
unsafe_op_in_unsafe_fn = "warn"
unused_lifetimes = "warn"
unused_macro_rules = "warn"
unused_qualifications = "warn"

[lints.clippy]
[workspace.lints.clippy]
bool_assert_comparison = "allow"
branches_sharing_code = "allow"
checked_conversions = "warn"
Expand Down Expand Up @@ -115,6 +80,68 @@ string_lit_as_bytes = "warn"
string_to_string = "warn"
todo = "warn"
trait_duplication_in_bounds = "warn"
uninlined_format_args = "warn"
verbose_file_reads = "warn"
wildcard_imports = "warn"
zero_sized_map_values = "warn"

[package]
name = "annotate-snippets"
version = "0.11.4"
description = "Library for building code annotations"
categories = []
keywords = ["code", "analysis", "ascii", "errors", "debug"]
repository.workspace = true
license.workspace = true
edition.workspace = true
rust-version.workspace = true
include.workspace = true

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[package.metadata.release]
tag-name = "{{version}}"
pre-release-replacements = [
{file="CHANGELOG.md", search="Unreleased", replace="{{version}}", min=1},
{file="CHANGELOG.md", search="\\.\\.\\.HEAD", replace="...{{tag_name}}", exactly=1},
{file="CHANGELOG.md", search="ReleaseDate", replace="{{date}}", min=1},
{file="CHANGELOG.md", search="<!-- next-header -->", replace="<!-- next-header -->\n## [Unreleased] - ReleaseDate\n", exactly=1},
{file="CHANGELOG.md", search="<!-- next-url -->", replace="<!-- next-url -->\n[Unreleased]: https://github.com/rust-lang/annotate-snippets-rs/compare/{{tag_name}}...HEAD", exactly=1},
]

[badges]
maintenance = { status = "actively-developed" }

[dependencies]
anstyle = "1.0.4"
memchr = { version = "2.7.4", optional = true }
unicode-width = "0.1.11"

[dev-dependencies]
annotate-snippets = { path = ".", features = ["testing-colors"] }
anstream = "0.6.13"
difference = "2.0.0"
divan = "0.1.14"
glob = "0.3.1"
serde = { version = "1.0.199", features = ["derive"] }
snapbox = { version = "0.6.0", features = ["diff", "term-svg", "cmd", "examples"] }
toml = "0.5.11"
tryfn = "0.2.1"

[[bench]]
name = "bench"
harness = false

[[test]]
name = "fixtures"
harness = false

[features]
default = []
simd = ["memchr"]
testing-colors = []

[lints]
workspace = true
5 changes: 3 additions & 2 deletions LICENSE-APACHE
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,15 @@
APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright {yyyy} {name of copyright owner}

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -199,3 +199,4 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

14 changes: 7 additions & 7 deletions LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Copyright 2017 Mozilla
Copyright (c) Individual contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
Expand Down
3 changes: 2 additions & 1 deletion release.toml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
allow-branch = ["master"]
dependent-version = "fix"
allow-branch = ["main"]
13 changes: 5 additions & 8 deletions src/renderer/display_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ impl<'a> DisplaySet<'a> {
self.format_label(line_offset, &annotation.label, stylesheet, buffer)
} else {
let id = match &annotation.id {
Some(id) => format!("[{}]", id),
Some(id) => format!("[{id}]"),
None => String::new(),
};
buffer.append(
Expand Down Expand Up @@ -290,12 +290,12 @@ impl<'a> DisplaySet<'a> {
} => {
let lineno_color = stylesheet.line_no();
if anonymized_line_numbers && lineno.is_some() {
let num = format!("{:>width$} |", ANONYMIZED_LINE_NUM, width = lineno_width);
let num = format!("{ANONYMIZED_LINE_NUM:>lineno_width$} |");
buffer.puts(line_offset, 0, &num, *lineno_color);
} else {
match lineno {
Some(n) => {
let num = format!("{:>width$} |", n, width = lineno_width);
let num = format!("{n:>lineno_width$} |");
buffer.puts(line_offset, 0, &num, *lineno_color);
}
None => {
Expand Down Expand Up @@ -645,7 +645,7 @@ impl<'a> DisplaySet<'a> {
} else if formatted_len != 0 {
formatted_len += 2;
let id = match &annotation.annotation.id {
Some(id) => format!("[{}]", id),
Some(id) => format!("[{id}]"),
None => String::new(),
};
buffer.puts(
Expand Down Expand Up @@ -1292,10 +1292,7 @@ fn format_body(
None
}
}) {
panic!(
"SourceAnnotation range `{:?}` is beyond the end of buffer `{}`",
bigger, source_len
)
panic!("SourceAnnotation range `{bigger:?}` is beyond the end of buffer `{source_len}`")
}

let mut body = vec![];
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn setup(input_path: std::path::PathBuf) -> tryfn::Case {
.to_str()
.unwrap();
let file_name = input_path.file_name().unwrap().to_str().unwrap();
let name = format!("{}/{}", parent, file_name);
let name = format!("{parent}/{file_name}");
let expected = Data::read_from(&input_path.with_extension("svg"), None);
tryfn::Case {
name,
Expand Down
Loading