Skip to content

nbqa-ruff-check hooks do not take into account pyproject.toml #868

@martibosch

Description

@martibosch

I have the following setup with nbqa 1.9.0 and ruff 0.6.4:

# pyproject.toml
[tool.nbqa.addopts]
ruff = [
    "--ignore=D,I",
]
# .pre-commit-config.yaml
  - repo: https://github.com/nbQA-dev/nbQA
    rev: 1.9.0
    hooks:
      - id: nbqa-ruff-check
        args: ["--fix"]
      - id: nbqa-ruff-format
      - id: nbqa-ruff-check

Nonetheless, pre-commit hooks still raise D100 and I001 in my notebooks. A workaround is to use:

# .pre-commit-config.yaml
  - repo: https://github.com/nbQA-dev/nbQA
    rev: 1.9.0
    hooks:
      - id: nbqa-ruff-check
        args: ["--fix", "--ignore=D,I"]
      - id: nbqa-ruff-format
      - id: nbqa-ruff-check
        args: ["--ignore=D,I"]

However, this requires me to "duplicate" the configuration. Is there any way to make nbqa take pyproject.toml into account with the new nbqa-ruff-check hook?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions