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

Enforce single quote - clarification #7834

Closed
Auric-Manteo opened this issue Oct 6, 2023 · 3 comments
Closed

Enforce single quote - clarification #7834

Auric-Manteo opened this issue Oct 6, 2023 · 3 comments
Labels
question Asking for support or clarification

Comments

@Auric-Manteo
Copy link

Auric-Manteo commented Oct 6, 2023

I am trying to get ruff to complain about using double quotes.
In this example I want to have single quotes instead of double quotes: my_var="text"
Currently when I run ruff check it does not complain if I use double quotes or single quotes.
If this does not work I don't quite get hat the inline-quotes (I never heard the term inline quote. Is that "'" an inline quote? :D) and quote-style is for.
Could you clarify?

ruff 0.0.292

pyproject.toml

  [tool.ruff]
  line-length = 120
  
  [tool.ruff.flake8-quotes]
  docstring-quotes = "double"
  inline-quotes = "single"
  
  [tool.ruff.format]
  # Prefer single quotes over double quotes
  quote-style = "single"
  
  [tool.black]
  line-length = 120
  skip-string-normalization = true
@dhruvmanila
Copy link
Member

Hey, is this related to the linter? If so, you'll have to select the rules explicitly:

[tool.ruff]
extend-select = ["Q"]

The inline-quotes settings is for the inline strings which are basically every string apart from the docstrings.

@zanieb zanieb added the question Asking for support or clarification label Oct 6, 2023
@Auric-Manteo
Copy link
Author

Fantastic, thank you @dhruvmanila!

@Borda
Copy link

Borda commented Apr 29, 2024

@dhruvmanila we may have a similar issue; I have set all as suggested:

[lint]
select = [
    ...
    "Q",
]

flake8-quotes = {inline-quotes = "single"}

But still, the single quotes are not enforced, for example here
this line seems to be untouched:

logger.info(
            f"Connecting to {username}@{hostname} via ssh. If you encounter any issues, you can try `ssh -v -p {self._ssh_port} {username}@{hostname}` with the password '{self._ssh_password}' and report the issue on GitHub."
        )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for support or clarification
Projects
None yet
Development

No branches or pull requests

5 participants
@zanieb @Borda @dhruvmanila @Auric-Manteo and others