-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
Enable More PyDocStyle Checks #10742
Comments
I've taken:
Might be an idea @kaxil to add a checklist for all rules needing updating in the initial issue comment. This way potential contributors can know which ones are done and which are still open to do? Just a quality of life idea so we don't have to look at the PRs individually. |
@pcandoalmeida That's a good idea, I updated the description and added a check-box. |
Hi @kaxil I'm working on D202 now. |
Morning @kaxil what do you think about adding the |
Good idea again, just added :) |
Hi I wanna try D205. Can I try this ? |
I started to fix D205 (1 blank line required between summary line and description). For example, airflow/airflow/configuration.py Lines 481 to 486 in d86cf37
This docs has no summary line and there are a lot of docs like this. How can I do that? If someone has any idea, please help me. |
@ktrueda You can do 2 things:
I would prefer (1) though |
@kaxil Thank you for your help. Since I found thousands of docs to fix, I need much times. |
@kaxil Can I take D200? |
Hiya 👋🏼 @potix2 I believe D200 is currently being worked on 😃 |
@pcandoalmeida Yeah, I'm working on it. I'll send a pull request soon. |
I'm working on D400. |
I would like to tackle this issue if it hasn't been assigned recently. Thanks! @uranusjr :) |
Go ahead 👍 Note that the ignore list above is out of date; please find the correct list in the pre-commit config file on |
Just finish calculation other violations of D100-D107
Tip D104 for providers packages should be resolved by change If someone interested to look on possible exclusion lists, see attached archive ruff-exclusions.zip |
In theory we could enable all rules #10742 (comment) but place exclusions into the separate file, e.g. in ruff.toml extend = "pyproject.toml"
[lint.extend-per-file-ignores]
"airflow/api/auth/backend/kerberos_auth.py" = ["D100", "D107"]
"airflow/api/common/airflow_health.py" = ["D100"]
"airflow/api_connexion/endpoints/config_endpoint.py" = ["D100"]
# Another 1500 lines of exclusions
"airflow/providers/teradata/hooks/teradata.py" = ["D107"]
"airflow/providers/yandex/secrets/lockbox.py" = ["D107"]
"hatch_build.py" = ["D100", "D102"] |
Can we just update it in the current |
Oh absolutley. Moving it out is just theorethically possible, but we do not want to do it (or at least we have not decided about it yet. I personally think there is a value in keeping all project settings in a single pyproject.toml. |
I was just trying to do this. But, I see an issue with updating one of the module As of now, I only see three other modules causing above conflict:
|
This comment was marked as outdated.
This comment was marked as outdated.
We could combine several |
Issue is that same module have |
We could combine |
I don’t think it is even possible not to combine them if we want to enable all of them. Only problem to create issues with all of them |
I just raised this draft PR - #37469 . can you please take a look. ruff did ignore multiple lint errors in a single line. |
And personally not sure about D107 |
Part of apache/airflow#10742 D205 asserts that all docstrings must have a one-line summary ending in a period. If there is more than one sentence then there must be a blank line before the rest of the docstring. Meeting these requirements could be as simple as adding a newline, or might require some rephrasing. There are almost a thousand violations in the repo so we're going to have to take this in bites. ### PLEASE NOTE There should be zero logic changes in this PR, only changes to docstrings and whitespace. If you see otherwise, please call it out. ### Included in this chunk All files in the `airflow/jobs` module. ### To test If you comment out [this line](https://github.com/apache/airflow/blob/main/pyproject.toml#L68) and run pre-commit in main you will get 284 errors. After these changes, "only" 269 remain and no files in the dag_processing folder should be on the list. After uncommenting that line and rerunning pre-commits, there should be zero regressions. GitOrigin-RevId: 156b85ad85ded6131e0902a4e00c27506eee62f3
I know this is ancient, but checking back in on it. It appears that the remaining rules on the checklist are no longer ignored. Searching the current pyproject.toml doesn't find |
Agree. |
@potiuk Sorry, I started a slack thread and did a bit of a deep dive on this but I never followed up here. Since the "D1" prefix is not enabled, the D100, D102, D104, and D107 don't need to be explicitly excluded. So currently, they are not actually being checked, but it isn't obvious that they aren't and I mistook the fact they aren't excluded to mean they were running. TLDR: If we want those rules enabled, then this is not actually done. Proposal: |
+1 |
Part of apache/airflow#10742 D205 asserts that all docstrings must have a one-line summary ending in a period. If there is more than one sentence then there must be a blank line before the rest of the docstring. Meeting these requirements could be as simple as adding a newline, or might require some rephrasing. There are almost a thousand violations in the repo so we're going to have to take this in bites. ### PLEASE NOTE There should be zero logic changes in this PR, only changes to docstrings and whitespace. If you see otherwise, please call it out. ### Included in this chunk All files in the `airflow/jobs` module. ### To test If you comment out [this line](https://github.com/apache/airflow/blob/main/pyproject.toml#L68) and run pre-commit in main you will get 284 errors. After these changes, "only" 269 remain and no files in the dag_processing folder should be on the list. After uncommenting that line and rerunning pre-commits, there should be zero regressions. GitOrigin-RevId: 156b85ad85ded6131e0902a4e00c27506eee62f3
Part of apache/airflow#10742 D205 asserts that all docstrings must have a one-line summary ending in a period. If there is more than one sentence then there must be a blank line before the rest of the docstring. Meeting these requirements could be as simple as adding a newline, or might require some rephrasing. There are almost a thousand violations in the repo so we're going to have to take this in bites. ### PLEASE NOTE There should be zero logic changes in this PR, only changes to docstrings and whitespace. If you see otherwise, please call it out. ### Included in this chunk All files in the `airflow/jobs` module. ### To test If you comment out [this line](https://github.com/apache/airflow/blob/main/pyproject.toml#L68) and run pre-commit in main you will get 284 errors. After these changes, "only" 269 remain and no files in the dag_processing folder should be on the list. After uncommenting that line and rerunning pre-commits, there should be zero regressions. GitOrigin-RevId: 156b85ad85ded6131e0902a4e00c27506eee62f3
We use PyDocStyle in pre-commit to enforce docstring styleWe use Ruff to enforce docsting style
airflow/pyproject.toml
Lines 47 to 74 in 23b8e83
We follow pep257 style (http://www.pydocstyle.org/en/stable/error_codes.html) for checks.
Currently, we ignore the following rules:
The task is to complete the following missing rules:
Missing Docstrings
[ ] D105 | Missing docstring in magic method: As discussed in https://lists.apache.org/thread/8jbg1dd2lr2cfydtqbjxsd6pb6q2wkc3, Remove D105 from pyproject.toml #38452 - we remove the D105 rule from our checks.__init__
Whitespace Issues
Docstring Content Issues
It would be good if we can enable them one by one -- separate PRs are ok
Let me know if you need any help
The text was updated successfully, but these errors were encountered: