Skip to content

Commit

Permalink
Add pre-commit configuration. Link to it via gh action
Browse files Browse the repository at this point in the history
  • Loading branch information
bergercookie committed Oct 22, 2023
1 parent 51c1225 commit 3c51f99
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ name: Build Cargo Workspace
on:
workflow_dispatch:
push:
branches: ["master"]
branches:
- "*"
pull_request:
branches: ["master"]

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: Build Documentation
on:
workflow_dispatch:
push:
branches: ["master"]
branches:
- "*"
pull_request:
branches: ["master"]

Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/lint_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ name: Lint Code / Run Tests
on:
workflow_dispatch:
push:
branches: ["master"]
branches:
- "*"
paths:
- "src/**"
- "Cargo.*"
Expand Down Expand Up @@ -38,12 +39,9 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4

- run: rustup toolchain install ${{ matrix.rust }} --profile minimal
- uses: Swatinem/rust-cache@v2

- name: Run rustfmt checks
run: cargo fmt --check

- name: Run clippy lints
run: cargo clippy -- -D warnings
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
name: Run pre-commit hooks
4 changes: 4 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ jobs:
- uses: actions/checkout@v3
name: Checkout

- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
name: Run pre-commit hooks

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
Expand Down
3 changes: 3 additions & 0 deletions .markdown-link-check.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ignorePatterns": ["https://crates.io/crates/asm-lsp"]
}
42 changes: 42 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.4.0"
hooks:
- id: check-added-large-files
- id: check-merge-conflict
- id: check-toml
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/tcort/markdown-link-check
rev: "v3.10.3"
hooks:
# https://github.com/tcort/markdown-link-check#config-file-format
- id: markdown-link-check
args: ["--progress", "--config", ".markdown-link-check.json"]
- repo: https://github.com/markdownlint/markdownlint
rev: "v0.12.0"
hooks:
- id: markdownlint
exclude: ^.github/
entry: mdl -r ~MD033,~MD013,~MD034,~MD029,~MD007
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: "0.27.0"
hooks:
- id: check-github-workflows
args: ["--verbose", "--builtin-schema", "vendor.github-workflows"]
files: ^\.github/workflows/
types: [yaml]
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes

- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
hooks:
- id: fmt
- id: cargo-check
args: ["--locked"]
- id: clippy
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "asm-lsp"
version = "0.4.0"
version = "0.4.1"
authors = ["Nikos Koukis <[email protected]>"]
edition = "2018"

Expand Down

0 comments on commit 3c51f99

Please sign in to comment.