Closed Avasam closed 1 year ago
Thanks for the report. Is this problem still active? If so, could you share a minimal reproducer of the issue?
.pre-commint-config.yaml
repos:
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.8.0
hooks:
- id: pretty-format-yaml
args: [--autofix, --indent, "2", --offset, "0", --line-width, "120"]
.github/workflows/typecheck.yaml
name: Typecheck
on:
workflow_dispatch: # Allows manual triggers
push:
branches:
- main
paths:
- "**.py"
- "**.pyi"
- "**/requirements*.txt"
- "**/pyproject.toml"
- ".github/workflows/typecheck.yaml"
pull_request:
branches:
- main
paths:
- "**.py"
- "**.pyi"
- "**/requirements*.txt"
- "**/pyproject.toml"
- ".github/workflows/typecheck.yaml" # I want these quotes to stay
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
FORCE_COLOR: 1
jobs:
pyright:
name: Run pyright
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.8" # I want these quotes to stay
cache: pip
cache-dependency-path: "**/requirements*.txt"
- run: pip install -r requirements.txt
- uses: jakebailey/pyright-action@v1
with:
project: ./Dolphin scripts/pyproject.toml
In the example above, "
is changed to '
, that's fine, I want them to be consistent (to either quotes idc). But I don't want quotes to be removed.
If I use --preserve-quotes
to keep the quotes, then existing ones aren't standardized.
Thanks for sharing more details, I'll be trying to see the effects of the pre-commit hooks in the provided yaml content.
In terms of preserve quotes, the idea is to keep the quotes on the original source code rather than standardising them to single or double quotes. The reason for this is that ideally no explicit quotes would be needed if no ambiguity is present.
I'd like to be able to enforce consistent single vs double quotes (whichever, idc). But I'd also like for existing quotes to not be removed. Especially for version numbers we pre-emptively quote some entries to avoid accidentally writing something like
python: 3.10
(which is actually3.1
, not3.10
!) when upgrading from python 3.9, for example.