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

Files that should be ignored aren't #189

Open
tamere-allo-peter opened this issue Jul 5, 2022 · 0 comments
Open

Files that should be ignored aren't #189

tamere-allo-peter opened this issue Jul 5, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@tamere-allo-peter
Copy link
Member

tamere-allo-peter commented Jul 5, 2022

1️⃣ Description

yamlfixer passes YAML files through yamllint by sending their content to yamllint's standard input.

Due to this behavior, yamllint doesn't know the input files' names, and so is unable to match them to ignore directives in .yamllint, if any is present.

📑 Steps to Reproduce

Steps to reproduce the behavior:

jerome@OPT17844:~/work$ yamllint -v
yamllint 1.26.3

jerome@OPT17844:~/work$ yamlfixer -v
yamlfixer v0.9.13

jerome@OPT17844:~/work$ cat meta/main.yml
---
galaxy_info:
  galaxy_tags: []
    # List tags for your role here, one per line. A tag is
    # a keyword that describes and categorizes the role.

# yamllint repots a comments-indentation problem
jerome@OPT17844:~/work$ yamllint --strict meta/main.yml
meta/main.yml
  4:5       warning  comment not indented like content  (comments-indentation)

# Then we create a .yamllint file
jerome@OPT17844:~/work$ cat .yamllint
---

extends: default

rules:
  line-length:
    max: 160
  comments-indentation:
    ignore: |
      meta/main.yml

# Now the meta/main.yml file is correctly ignored for rule comments-indentation
jerome@OPT17844:~/work$ yamllint --strict meta/main.yml
jerome@OPT17844:~/work$

# But yamlfixer wants to fix it anyway
jerome@OPT17844:~/work$ yamlfixer --summary meta/main.yml
Files to fix: 1
0 files were already correct before
1 files were modified but problems remain
0 files were entirely fixed
0 files were skipped
0 files were not writable
0 files with unknown status
   MODIFIED meta/main.yml (handled 1/1)
jerome@OPT17844:~/work$ 

2️⃣ Expected behavior

The expected behavior is for yamllint to not report any comments-indentation problem on the meta/main.yml file to yamlfixer, so that yamlfixer doesn't try to fix them.

So yamlfixer should be modified to pass file names to yamllint for real files, and only pass content on yamllint's stdin when its own input is stdin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant