Skip to content
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

Run flake8 on more files #85333

Merged
merged 3 commits into from Jan 16, 2023
Merged

Run flake8 on more files #85333

merged 3 commits into from Jan 16, 2023

Conversation

mxr
Copy link
Contributor

@mxr mxr commented Jan 6, 2023

Proposed change

In order to hold more of the code to a high standard, this PR enables flake8 on all Python files, except the auto-generated sphinx config file. This PR uses a denylist instead of an allowlist so new folders/files will get linted without requiring developers to change the linter targeting rules.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@home-assistant home-assistant bot added cla-signed code-quality small-pr PRs with less than 30 lines. labels Jan 6, 2023
Copy link

@glenrobertson glenrobertson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a great addition! 👏

@ryanrhee
Copy link

ryanrhee commented Jan 7, 2023

lgtm

cc @asottile

Copy link
Contributor

@davet2001 davet2001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seem to be lots of unrelated changes in this PR. Several of the function description changes seem to have typos. Maybe they could be moved to a separate PR.

pylint/plugins/hass_enforce_type_hints.py Outdated Show resolved Hide resolved
pylint/plugins/hass_enforce_type_hints.py Outdated Show resolved Hide resolved
@mxr
Copy link
Contributor Author

mxr commented Jan 7, 2023

@davet2001 all these changes are to satisfy the flake8 errors. Without them, the errors are:

docs/source/_ext/edit_on_github.py:1:1: D205 1 blank line required between summary line and description
docs/source/_ext/edit_on_github.py:1:1: D400 First line should end with a period
docs/source/_ext/edit_on_github.py:14:1: D103 Missing docstring in public function
docs/source/_ext/edit_on_github.py:22:1: D103 Missing docstring in public function
docs/source/_ext/edit_on_github.py:40:1: D103 Missing docstring in public function
pylint/plugins/hass_constructor.py:25:1: D401 First line should be in imperative mood
pylint/plugins/hass_enforce_type_hints.py:23:1: D400 First line should end with a period
pylint/plugins/hass_enforce_type_hints.py:2840:1: D401 First line should be in imperative mood
pylint/plugins/hass_enforce_type_hints.py:2880:1: D107 Missing docstring in __init__
pylint/plugins/hass_enforce_type_hints.py:2886:1: D401 First line should be in imperative mood
pylint/plugins/hass_enforce_type_hints.py:2910:1: D401 First line should be in imperative mood
pylint/plugins/hass_enforce_type_hints.py:2937:1: D401 First line should be in imperative mood
pylint/plugins/hass_imports.py:398:1: D107 Missing docstring in __init__
pylint/plugins/hass_imports.py:403:1: D401 First line should be in imperative mood
pylint/plugins/hass_imports.py:411:1: D401 First line should be in imperative mood
pylint/plugins/hass_imports.py:433:1: D401 First line should be in imperative mood
pylint/plugins/hass_imports.py:452:1: D401 First line should be in imperative mood
pylint/plugins/hass_logger.py:32:1: D401 First line should be in imperative mood
pylint/plugins/hass_logger.py:38:12: E713 test for membership should be 'not in'

@davet2001
Copy link
Contributor

Sorry, I misunderstood some of these edits. Only minor tweaks needed I think. :)

@mxr
Copy link
Contributor Author

mxr commented Jan 7, 2023

No problem, will get the fixes out shortly

@mxr mxr requested a review from davet2001 January 7, 2023 19:49
Copy link
Contributor

@davet2001 davet2001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks ok to me now. The question still remains whether it is wanted to add flake8 restrictions to these parts of the repo. I assume yes because it will tend to improve quality/consistency.

@mxr
Copy link
Contributor Author

mxr commented Jan 8, 2023

I agree as well. Are you able to merge this or do we need someone else to make a final call?

@davet2001
Copy link
Contributor

@frenck please could we get your opinion on increasing flake8 scope in this way?

pylint/plugins/hass_constructor.py Outdated Show resolved Hide resolved
pylint/plugins/hass_enforce_type_hints.py Outdated Show resolved Hide resolved
pylint/plugins/hass_enforce_type_hints.py Outdated Show resolved Hide resolved
@mxr mxr requested a review from epenet January 9, 2023 16:13
@mxr
Copy link
Contributor Author

mxr commented Jan 16, 2023

Hi @frenck just wondering if you had a moment to look per @davet2001's comment, thanks!

Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks fine, thanks @mxr 👍

../Frenck

mxr and others added 3 commits January 16, 2023 19:55
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
@frenck frenck added the smash Indicator this PR is close to finish for merging or closing label Jan 16, 2023
@frenck frenck merged commit 156c815 into home-assistant:dev Jan 16, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jan 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed code-quality small-pr PRs with less than 30 lines. smash Indicator this PR is close to finish for merging or closing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants