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

nitpick removes YAML document start #621

Open
jamesbraza opened this issue Oct 24, 2023 · 1 comment
Open

nitpick removes YAML document start #621

jamesbraza opened this issue Oct 24, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@jamesbraza
Copy link

Expected behavior

I run yamllint --strict (docs), which checks for the presence of a YAML document start.

I am finding nitpick making extra diff churn because pre-commit configs don't use document start.

Current behavior

When running nitpick, it removes the document start.

Steps to reproduce

  1. Have a .pre-commit-config.yaml that previously has a document start ---
  2. Run nitpick fix to generate an updated .pre-commit-config.yaml
  3. Observe it removed document start ---

Possible Solution

Adding a CLI flag for preserving document starts in YAML somehow.

Context

N/a

Your environment

  • nitpick version used: 0.34.0
  • Python version: 3.12.0
@jamesbraza jamesbraza added the bug Something isn't working label Oct 24, 2023
@andreoliwa
Copy link
Owner

Hi, thanks for the multiple bug reports. :)

Adding a CLI flag for preserving document starts in YAML somehow.

I would say Nitpick should preserve existing content whenever possible, without any CLI flags.

I didn't check ruamel.yaml's docs yet; it's the YAML-preserving package I use.
I don't remember configuring it to remove document starts, I'm not sure if it is configurable at all.
I'll check it when working on this bug. 👍🏻

@andreoliwa andreoliwa moved this to Triage in Nitpick Roadmap Oct 24, 2023
@andreoliwa andreoliwa moved this from Triage to Upvoted / Requests in Nitpick Roadmap Oct 24, 2023
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
Status: Upvoted / Requests
Development

No branches or pull requests

2 participants