From e0083cd1debe1a70590e5ba2aef78f9ce7d5a3c9 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Thu, 9 Nov 2023 15:59:17 -0600 Subject: [PATCH 1/4] chore(ci): Validate basics in CI / pre-commit --- .github/workflows/pre-commit.yml | 23 +++++++++++++++++++++++ .pre-commit-config.yaml | 16 ++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 .github/workflows/pre-commit.yml create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 00000000..80447507 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,23 @@ +name: pre-commit + +permissions: {} # none + +on: + pull_request: + push: + branches: [main] + +env: + RUST_BACKTRACE: 1 + CARGO_TERM_COLOR: always + CLICOLOR: 1 + +jobs: + pre-commit: + permissions: + contents: read + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + - uses: pre-commit/action@v3.0.0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..7d2fdd9d --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,16 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: check-yaml + stages: [commit] + - id: check-json + stages: [commit] + - id: check-toml + stages: [commit] + - id: check-merge-conflict + stages: [commit] + - id: check-case-conflict + stages: [commit] + - id: detect-private-key + stages: [commit] From 0da8be6b27b0837c512125c923d45648679a9479 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Thu, 9 Nov 2023 16:01:54 -0600 Subject: [PATCH 2/4] docs: Fix typos --- src/display_list/structs.rs | 4 ++-- tests/formatter.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/display_list/structs.rs b/src/display_list/structs.rs index 7941d5fc..5a31d1e1 100644 --- a/src/display_list/structs.rs +++ b/src/display_list/structs.rs @@ -225,7 +225,7 @@ pub enum DisplayRawLine<'a> { source_aligned: bool, /// If set to `true`, only the label of the `Annotation` will be /// displayed. It allows for a multiline annotation to be aligned - /// without displaing the meta information (`type` and `id`) to be + /// without displaying the meta information (`type` and `id`) to be /// displayed on each line. continuation: bool, }, @@ -283,7 +283,7 @@ pub enum DisplayMarkType { /// There are several ways to uses this information when formatting the `DisplayList`: /// /// * An annotation may display the name of the type like `error` or `info`. -/// * An underline for `Error` may be `^^^` while for `Warning` it coule be `---`. +/// * An underline for `Error` may be `^^^` while for `Warning` it could be `---`. /// * `ColorStylesheet` may use different colors for different annotations. #[derive(Debug, Clone, PartialEq)] pub enum DisplayAnnotationType { diff --git a/tests/formatter.rs b/tests/formatter.rs index b1392a1d..f95b0026 100644 --- a/tests/formatter.rs +++ b/tests/formatter.rs @@ -513,7 +513,7 @@ fn test_raw_origin_initial_pos_anon_lines() { header_type: DisplayHeaderType::Initial, })]); - // Using anonymized_line_numbers should not affect the inital position + // Using anonymized_line_numbers should not affect the initial position dl.anonymized_line_numbers = true; assert_eq!(dl.to_string(), "--> src/test.rs:23:15"); } From cf579ff37061f25d6d95d75ae4d4e059e26a990b Mon Sep 17 00:00:00 2001 From: Ed Page Date: Thu, 9 Nov 2023 16:01:25 -0600 Subject: [PATCH 3/4] chore(ci): Check typos --- .github/workflows/spelling.yml | 21 +++++++++++++++++++++ .pre-commit-config.yaml | 5 +++++ 2 files changed, 26 insertions(+) create mode 100644 .github/workflows/spelling.yml diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml new file mode 100644 index 00000000..12f75859 --- /dev/null +++ b/.github/workflows/spelling.yml @@ -0,0 +1,21 @@ +name: Spelling + +permissions: + contents: read + +on: [pull_request] + +env: + RUST_BACKTRACE: 1 + CARGO_TERM_COLOR: always + CLICOLOR: 1 + +jobs: + spelling: + name: Spell Check with Typos + runs-on: ubuntu-latest + steps: + - name: Checkout Actions Repository + uses: actions/checkout@v4 + - name: Spell Check Repo + uses: crate-ci/typos@master diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7d2fdd9d..5340e097 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,3 +14,8 @@ repos: stages: [commit] - id: detect-private-key stages: [commit] + - repo: https://github.com/crate-ci/typos + rev: v1.16.20 + hooks: + - id: typos + stages: [commit] From e4e731c25c24dc124cd086d32c8d9ed2871bff5e Mon Sep 17 00:00:00 2001 From: Ed Page Date: Thu, 9 Nov 2023 16:05:16 -0600 Subject: [PATCH 4/4] chore(ci): Encourage conventional commits This would help with writing changelogs --- .github/workflows/committed.yml | 24 ++++++++++++++++++++++++ .pre-commit-config.yaml | 5 +++++ committed.toml | 3 +++ 3 files changed, 32 insertions(+) create mode 100644 .github/workflows/committed.yml create mode 100644 committed.toml diff --git a/.github/workflows/committed.yml b/.github/workflows/committed.yml new file mode 100644 index 00000000..04625584 --- /dev/null +++ b/.github/workflows/committed.yml @@ -0,0 +1,24 @@ +# Not run as part of pre-commit checks because they don't handle sending the correct commit +# range to `committed` +name: Lint Commits +on: [pull_request] + +permissions: + contents: read + +env: + RUST_BACKTRACE: 1 + CARGO_TERM_COLOR: always + CLICOLOR: 1 + +jobs: + committed: + name: Lint Commits + runs-on: ubuntu-latest + steps: + - name: Checkout Actions Repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Lint Commits + uses: crate-ci/committed@master diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5340e097..68db968e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,3 +19,8 @@ repos: hooks: - id: typos stages: [commit] + - repo: https://github.com/crate-ci/committed + rev: v1.0.20 + hooks: + - id: committed + stages: [commit-msg] diff --git a/committed.toml b/committed.toml new file mode 100644 index 00000000..4211ae38 --- /dev/null +++ b/committed.toml @@ -0,0 +1,3 @@ +style="conventional" +ignore_author_re="(dependabot|renovate)" +merge_commit = false