Skip to content

ensure every python source dir has an __init__.py file#27875

Merged
kdmccormick merged 3 commits intomasterfrom
kdmccormick/init-dot-py
Oct 21, 2021
Merged

ensure every python source dir has an __init__.py file#27875
kdmccormick merged 3 commits intomasterfrom
kdmccormick/init-dot-py

Conversation

@kdmccormick
Copy link
Member

@kdmccormick kdmccormick commented Jun 7, 2021

Description

Several Python source directories in edx-platform are quietly being skipped by pylint because they don’t have an __init__.py file. Furthermore, import-linter requires that every Python source dir have an __init__.py file.

This PR:

  • Adds in the missing __init__.py files.
  • Fixes or applies amnesty to all pylint violations now coming from directories that were missing __init__.py.
  • Adds a shell script & GitHub Action to ensure that every directory has an __init__.py file going forward.

Supporting information

See BOM-2593 for details.

Testing instructions

  • Run pylint locally on one of the directories that this PR fixes. Ensure it passes.
  • Add a pylint violation (eg, unused variable) to a file in that directory.
  • Run pylint locally on the directory again. Ensure it flags the violation you added.

Deadline

None. (On hold until Arbi-BOM is able to pick this work back up)

Sooner is better, though, since new edx-platform directories are regularly created, which will add to the pylint debt.

Other information

Christie took care of some of this already for Aperture-owned directories in https://github.com/edx/edx-platform/pull/27972

Prerequisite to https://github.com/edx/edx-platform/pull/27011 (import linting)

@kdmccormick kdmccormick force-pushed the kdmccormick/init-dot-py branch from 8eb56cf to 0f53ccd Compare June 8, 2021 13:37
@kdmccormick kdmccormick changed the base branch from kdmccormick/xmodule-no-cms to master June 8, 2021 13:40
@kdmccormick kdmccormick closed this Jun 8, 2021
@kdmccormick kdmccormick reopened this Jun 8, 2021
@kdmccormick kdmccormick force-pushed the kdmccormick/init-dot-py branch 4 times, most recently from e8c7399 to 92140b3 Compare June 8, 2021 14:07
@kdmccormick kdmccormick changed the title fix: add missing __init__.py files Ensure every Python source dir has an __init__.py file Jun 8, 2021
@kdmccormick kdmccormick changed the title Ensure every Python source dir has an __init__.py file ensure every python source dir has an __init__.py file Jun 8, 2021
@kdmccormick kdmccormick force-pushed the kdmccormick/init-dot-py branch from 92140b3 to b69d34f Compare June 8, 2021 14:46
@kdmccormick
Copy link
Member Author

jenkins run python

@kdmccormick kdmccormick force-pushed the kdmccormick/init-dot-py branch from b69d34f to 5d2a69b Compare June 9, 2021 13:17
@arch-bom-gocd-alerts
Copy link

📣 💥 Heads-up: You must either rebase onto master or merge master into your branch to avoid breaking the build.

We recently removed diff-quality and introduced lint-amnesty. This means that the automated quality check that has run on your branch doesn't work the same way it will on master. If you have introduced any quality failures, they might pass on the PR but then break the build on master.

This branch has been detected to not have commit 2e33565 as an ancestor. Here's how to see for yourself:

git merge-base --is-ancestor 2e335653 kdmccormick/init-dot-py && echo "You're all set" || echo "Please rebase onto master or merge master to your branch"

If you have any questions, please reach out to the Architecture team (either #edx-shared-architecture on Open edX Slack or #architecture on edX internal).

@kdmccormick kdmccormick force-pushed the kdmccormick/init-dot-py branch from 5d2a69b to cf315c4 Compare June 16, 2021 17:54
@kdmccormick kdmccormick force-pushed the kdmccormick/init-dot-py branch 2 times, most recently from 747558a to 4f09d26 Compare October 8, 2021 17:01
@UsamaSadiq UsamaSadiq force-pushed the kdmccormick/init-dot-py branch from 4f09d26 to d5a3500 Compare October 20, 2021 18:02
@UsamaSadiq UsamaSadiq force-pushed the kdmccormick/init-dot-py branch from 0f568fe to 7042912 Compare October 20, 2021 20:01
@UsamaSadiq UsamaSadiq marked this pull request as ready for review October 20, 2021 20:18
@edx-status-bot
Copy link

Your PR has finished running tests. There were no failures.

@UsamaSadiq
Copy link
Member

Tested the newly added directories to be successfully producing pylint warnings on local.

@kdmccormick
Copy link
Member Author

Thanks Usama!

@kdmccormick kdmccormick merged commit 9542725 into master Oct 21, 2021
@kdmccormick kdmccormick deleted the kdmccormick/init-dot-py branch October 21, 2021 13:54
@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants