Skip to content

Commit

Permalink
Show diff from formatted code on pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
azriel1rf committed May 4, 2024
1 parent 9460fc5 commit b5aa5c6
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ repos:
- id: forbid-submodules
fail_fast: true
- id: detect-private-key
fail_fast: true
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace
Expand All @@ -27,21 +26,20 @@ repos:
hooks:
- id: remove-crlf
- id: remove-tabs
verbose: true

# Formatting for Python configuration files
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.5.0
hooks:
- id: setup-cfg-fmt
verbose: true

# Linting and formatting for C++
- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
hooks:
- id: clang-format
args: [-i]
verbose: true
args: [-i, --Werror]
# - id: clang-tidy
# - id: oclint
# - id: cppcheck
Expand All @@ -60,10 +58,9 @@ repos:
# Linting for Python
- id: ruff-check
name: Python - Linting with Ruff
entry: bash -c 'pip install ruff && cd python && ruff check'
entry: bash -c 'pip install ruff && cd python && ruff check --diff'
language: system
types_or: [python]
verbose: true
pass_filenames: false

# Formatting for Python
Expand All @@ -72,7 +69,6 @@ repos:
entry: bash -c 'pip install ruff && cd python && ruff format'
language: system
types_or: [python]
verbose: true
pass_filenames: false

# Type checking for Python
Expand All @@ -81,7 +77,6 @@ repos:
entry: bash -c 'pip install mypy && cd python && mypy .'
language: system
types_or: [python]
verbose: true
pass_filenames: false
stages:
- pre-commit
Expand All @@ -94,10 +89,17 @@ repos:
name: run unit tests
entry: python -m unittest discover
language: system
verbose: true
pass_filenames: false
stages:
- pre-commit
- pre-merge-commit
- pre-rebase
- manual

# Display the differences between the original and formatted code
- id: git-diff
name: git diff
entry: git diff --exit-code
language: system
pass_filenames: false
always_run: true

0 comments on commit b5aa5c6

Please sign in to comment.