Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting different offset breaks hte pre-commit-hook config #43

Open
zemzale opened this issue Sep 9, 2022 · 1 comment
Open

Setting different offset breaks hte pre-commit-hook config #43

zemzale opened this issue Sep 9, 2022 · 1 comment

Comments

@zemzale
Copy link

zemzale commented Sep 9, 2022

I am trying to run different formatting option than the default

    args: [--mapping, '2', --sequence, '2', --offset, '2', --width, '150']

After setting offset to 2 I try to commit the changes and the format breaks the config itself by doing these changes

 ---
 repos:
-- repo: https://github.com/pre-commit/pre-commit-hooks
+  - repo: https://github.com/pre-commit/pre-commit-hooks
   rev: v4.2.0
   hooks:
-  - id: check-yaml
-  - id: check-ast
+    - id: check-yaml
+    - id: check-ast

Example of the config before

---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
  rev: v4.2.0
  hooks:
  - id: check-yaml
  - id: check-ast
  - id: trailing-whitespace
  - id: check-added-large-files
  - id: debug-statements
  - id: detect-private-key
  - id: requirements-txt-fixer
  - id: name-tests-test

After the format

---
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
  rev: v4.2.0
  hooks:
    - id: check-yaml
    - id: check-ast
          #- id: end-of-file-fixer
    - id: trailing-whitespace
    - id: check-added-large-files
    - id: debug-statements
    - id: detect-private-key
    - id: requirements-txt-fixer
    - id: name-tests-test

i have no idea what is causing this, but in need for more info I can help out with something.

@mihaigalos
Copy link

This works for me:

args: [--mapping, '4', --sequence, '4', --offset, '2', --colons, --width, '150']

Result:

 ---
 repos:
-    - repo: https://github.com/pre-commit/pre-commit-hooks
-      rev: v4.4.0
-      hooks:
-          - id: check-yaml
-          - id: trailing-whitespace
-    - repo: https://github.com/mihaigalos/pre-commit-hook-yamlfmt
-      rev: 0.2.3
-      hooks:
-          - id: yamlfmt
-            args: [--mapping, '4', --sequence, '4', --offset, '2', --colons, --width, '150']
-    - repo: https://github.com/mihaigalos/pre-commit-rust
-      rev: v1.0
-      hooks:
-          - id: cargo-check
-          - id: clippy
-          - id: fmt
+  - repo: https://github.com/pre-commit/pre-commit-hooks
+    rev: v4.4.0
+    hooks:
+      - id: check-yaml
+      - id: trailing-whitespace
+  - repo: https://github.com/mihaigalos/pre-commit-hook-yamlfmt
+    rev: 0.2.3
+    hooks:
+      - id: yamlfmt
+        args: [--mapping, '4', --sequence, '4', --offset, '2', --colons, --width, '150']
+  - repo: https://github.com/mihaigalos/pre-commit-rust
+    rev: v1.0
+    hooks:
+      - id: cargo-check
+      - id: clippy
+      - id: fmt

mihaigalos added a commit to mihaigalos/pre-commit-hook-yamlfmt that referenced this issue May 26, 2023
mihaigalos added a commit to mihaigalos/pre-commit-hook-yamlfmt that referenced this issue May 26, 2023
mihaigalos added a commit to mihaigalos/pre-commit-hook-yamlfmt that referenced this issue May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants