Skip to content

Enable Even More PyDocStyle Checks #40567

Description

@ferruzzi

Description

Followup to #10742

We use Ruff to enforce docsting style

airflow/pyproject.toml

Lines 47 to 74 in 23b8e83

extend-select = [
"I", # Missing required import (auto-fixable)
"UP", # Pyupgrade
"RUF100", # Unused noqa (auto-fixable)
# implicit single-line string concatenation
"ISC001",
# We ignore more pydocstyle than we enable, so be more selective at what we enable
"D101",
"D106",
"D2",
"D3",
"D400",
# "D401", # Not enabled by ruff, but we don't want it
"D402",
"D403",
"D412",
"D419"
]
extend-ignore = [
"D203",
"D205",
"D212",
"D213",
"D214",
"D215",
"E731",
]

We follow pep257 style (http://www.pydocstyle.org/en/stable/error_codes.html) for checks.

Currently, we ignore the following rules and should work towards enabling them:

Missing Docstrings

It would be good if we can enable them one by one -- separate PRs are ok

Rough process to fix these

  1. Set up your dev environment [docs]
    0.5. Go to your airflow directory and run ruff check. Write down the number of failures. Mine currently says 8. This step is just to make sure it's working and give you a baseline.

  2. Open /airflow/pyproject.toml

  3. In the ignore list (currently starting on line 301) comment out the rule you intend to work on

  4. In a terminal, go to the airflow directory and run ruff check again. It should now fail with WAY more errors. Mine currently says 863. If the number didn't go way up, something is wrong with your setup.

  5. Have a quick scroll through that list, paying attention to which ones failed because of the rule you just enabled.

  6. Come up with a rough plan to break that down into bites. Maybe pick one directory that has a bunch of failures and start fixing there.

  7. After you have a handful of fixes done: remove your comment (so it is ignored again) and submit a PR with that chunk of changes (see the Contributing docs in step 0)

PLEASE submit these in many small PRs. If you do it all at once it will turn into a 3000-line PR and nobody will review it. Eventually, on the last chunk you'll just remove that line from the ignore list entirely when there are no more violations to fix.

Let me know if you need any help, or ask in the Slack server.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    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