apache / airflow

Apache Airflow - A platform to programmatically author, schedule, and monitor workflows
https://airflow.apache.org/
Apache License 2.0
37.12k stars 14.3k forks source link

Fix remaining D401 checks #37256

Closed Taragolis closed 9 months ago

Taragolis commented 9 months ago

Body

Part of https://github.com/apache/airflow/issues/10742. Recently we enable D401 pydocstyle rule, however we still have some modules which do not follow D401 rule yet

Easy way to find all linting problem into the module

  1. Remove corresponding line to particular module into the pyproject.toml in [tool.ruff.lint.per-file-ignores]
  2. Run ruff via pre-commit hook
❯ pre-commit run ruff --all-files
Run 'ruff' for extremely fast Python linting.............................Failed
- hook id: ruff
- exit code: 1

airflow/www/auth.py:90:5: D401 First line of docstring should be in imperative mood: "This decorator is used to check permissions on views."
airflow/www/auth.py:348:5: D401 First line of docstring should be in imperative mood: "Decorator that checks current user's permissions to access the website."
Found 2 errors.

Airflow Core

Provider airbyte

Provider amazon

Provider apache.hive

Provider apache.spark

Provider atlassian.jira

Provider cncf.kubernetes

Provider common.io

Provider databricks

Provider discord

Provider fab

Provider google

Provider grpc

Provider hashicorp

Provider http

Provider imap

Provider jenkins

Provider microsoft.azure

Provider microsoft.mssql

Provider microsoft.psrp

Provider mongo

Provider mysql

Provider neo4j

Provider odbc

Provider openfaas

Provider openlineage

Provider opensearch

Provider opsgenie

Provider oracle

Provider pagerduty

Provider papermill

Provider pinecone

Provider postgres

Provider presto

Provider qdrant

Provider redis

Provider salesforce

Provider samba

Provider segment

Provider sftp

Provider slack

Provider smtp

Provider snowflake

Provider sqlite

Provider ssh

Provider tableau

Provider tabular

Provider telegram

Provider trino

Provider weaviate

Provider yandex

Committer

guptarohit commented 9 months ago

I can help on these, if not all modules are picked or in progress.

Taragolis commented 9 months ago

@guptarohit feel free to pick up any providers or even core

rawwar commented 9 months ago

@Taragolis , What to do when the docstring doesn't actually explain anything about the method?

Example:

https://github.com/apache/airflow/blob/7835fd2659335d3acf830ce2e70dc19bfc5b2a84/airflow/providers/google/cloud/hooks/bigquery.py#L2350

Can i add noqa for docstrings like this?

EDIT:

slack message: https://apache-airflow.slack.com/archives/CCPRP7943/p1707489704051959?thread_ts=1707489399.332569&cid=CCPRP7943

possible rewrite : “Do nothing. Not needed for BigQueryConnection” ?

okirialbert commented 9 months ago

Hey, I'd like to work on any pending modules.