Skip to content

Enable Ruff rules #316

@njzjz

Description

@njzjz

Our target Ruff configuration is

[tool.ruff.format]
docstring-code-format = true

[tool.ruff.lint]
select = [
    "E", # errors
    "W", # warning
    "F", # pyflakes
    "D", # pydocstyle
    "UP", # pyupgrade
    "C4", # flake8-comprehensions
    "RUF", # ruff
    "NPY", # numpy
    "TID251", # banned-api
    "TID253", # banned-module-level-imports
    "T20", # ban print
    "B904", # raise-without-from-inside-except
    "N804", # invalid-first-argument-name-for-class-method
    "N805", # invalid-first-argument-name-for-method
    "DTZ", # datetime
]

ignore = [
    "E501", # line too long
    "F841", # local variable is assigned to but never used
    "E741", # ambiguous variable name
    "E402", # module level import not at top of file
    "D100", # TODO: missing docstring in public module
    "D101", # TODO: missing docstring in public class
    "D102", # TODO: missing docstring in public method
    "D103", # TODO: missing docstring in public function
    "D104", # TODO: missing docstring in public package
    "D105", # TODO: missing docstring in magic method
    "D205", # 1 blank line required between summary line and description
    "D401", # TODO: first line should be in imperative mood
    "D404", # TODO: first word of the docstring should not be This
]
exclude = [
]

[tool.ruff.lint.pydocstyle]
convention = "numpy"

But I think we could split the rules and assign them to the copilot.

  • Enable Ruff D rule
  • Enable Ruff UP and C4 rules
  • Enable Ruff TID251, TID253, T20, B904, N804, N805 rules
  • Enable Ruff I rule

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions