Skip to content

Commit

Permalink
chore: introduce formatting patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
leona-ya committed Jul 6, 2024
1 parent 7b38449 commit be46f73
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 180
tab_width = 4
trim_trailing_whitespace = true

[{*.nix,*.yaml}]
indent_size = 2
tab_width = 2

[*.html]
max_line_length = off

[/.sqlx/**]
indent_size = unset
tab_width = unset
max_line_length = off

[flake.lock]
indent_size = unset
tab_width = unset
max_line_length = off
16 changes: 16 additions & 0 deletions .github/workflows/formatting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: formatting

on:
pull_request:
push:
branches: [master]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: editorconfig-checker/action-editorconfig-checker@main
- uses: actions/setup-python@v4
- uses: pre-commit/action@v3.0.0
23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: detect-private-key
- id: check-added-large-files
- id: trailing-whitespace
- repo: local
hooks:
- id: editorconfig-checker
name: 'Check .editorconfig rules'
description: 'Runs system executable of `editorconfig-checker` to lint text files according to `.editorconfig` rules'
language: system
entry: editorconfig-checker
types: [ text ]
require_serial: true
- id: rustfmt
name: "rustfmt"
description: Format files with cargo fmt.
entry: cargo fmt
language: system
types: [rust]
args: ["--"]
1 change: 1 addition & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
max_width = 180

0 comments on commit be46f73

Please sign in to comment.