Skip to content

Commit

Permalink
pre-commit: set min-space to 1 for in-line comments in yaml files (#3254
Browse files Browse the repository at this point in the history
)

Renovate bot commit may contain trailing comments with 1 space from
the content. This is caused by Renovate's use of 'prettier' for formatting, which
has a different default compared to yamllint, and that is not likely to change.
This is completely arbitrary, thus to avoid further linting issues cased by
Renovate we can as well adapt to use 1 min-space from content.

Prepare for 'pre-commit.ci' use 'Skip flake8', as the '.flake8' file is ignored
by pre-commit.ci. For some unknown reason the 'clang-format' of pre-commit.ci
also formats ipynb files (being json files), but local use of pre-commit
does not. Exclude ipynb files from clang-format.
  • Loading branch information
nilason committed Nov 22, 2023
1 parent 816c25f commit 49fb2d9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
ci:
skip: [flake8]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
Expand Down Expand Up @@ -60,11 +62,14 @@ repos:
types_or: [c, c++, javascript, json, objective-c]
exclude: |
(?x)^(
man/jquery.fixedheadertable.min.js
man/jquery.fixedheadertable.min.js$|
.*\.ipynb$
)
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.29.0
hooks:
- id: yamllint
args: [--format, parsable, --strict, -d,
'{extends: default, rules: {truthy: disable, line-length: {max: 120, allow-non-breakable-words: true}}}']
'{extends: default, rules: {truthy: disable,
line-length: {max: 120, allow-non-breakable-words: true},
comments: {min-spaces-from-content: 1}}}']

0 comments on commit 49fb2d9

Please sign in to comment.