[Koa Backport] Fix linting as it relates to import_shims, and vice versa - #25678
Merged
kdmccormick merged 3 commits intoNov 30, 2020
Merged
Conversation
The import_shims/ directory had thousands of pylint violations, but they didn't matter because we ignored the directory during linting. Now, that directory ignoring configuration seems to be problematic when running pylint on individual files locally. Also, it seems prudent to lint import_shims/ anyway, because there is still production code that relies on it.
In other words, when running pylint, do not enable the import shims. So, the old-style imports (`from student import models`) are invalid in the eye of pylint now. We do this because: * New sys.path-hacking in pylintrc seems to break the diff-quality tooling. * edx-platform should have no old-style imports, so pylint doesn't need to know about the import shims. * We actually *want* quality failures to happen if anyone reintroduces old-style imports to edx-platform.
Command: $ import_shims/regenerate_current_shims.sh
kdmccormick
marked this pull request as ready for review
November 24, 2020 17:39
Member
Author
Member
Author
|
Production issues have been resolved; they weren't related to this change. |
nedbat
approved these changes
Nov 30, 2020
Contributor
|
I've installed this code, and the LMS comes up, so let's merge it for more thorough community testing. |
sambapete
pushed a commit
to EDUlib/edx-platform
that referenced
this pull request
Apr 14, 2021
…rsa (openedx#25678) Should resolve "re.error: nothing to repeat at position 0" when running pylint locally. Changes: * Fix import_shims pylint violations * Include import_shims directory in linting * Stop shimming imports when running pylint * Regenerate import_shims (for koa.master)
sambapete
pushed a commit
to EDUlib/edx-platform
that referenced
this pull request
May 24, 2021
…rsa (openedx#25678) Should resolve "re.error: nothing to repeat at position 0" when running pylint locally. Changes: * Fix import_shims pylint violations * Include import_shims directory in linting * Stop shimming imports when running pylint * Regenerate import_shims (for koa.master)
sambapete
pushed a commit
to EDUlib/edx-platform
that referenced
this pull request
Jun 9, 2021
…rsa (openedx#25678) Should resolve "re.error: nothing to repeat at position 0" when running pylint locally. Changes: * Fix import_shims pylint violations * Include import_shims directory in linting * Stop shimming imports when running pylint * Regenerate import_shims (for koa.master)
sambapete
pushed a commit
to EDUlib/edx-platform
that referenced
this pull request
Jun 9, 2021
…rsa (openedx#25678) Should resolve "re.error: nothing to repeat at position 0" when running pylint locally. Changes: * Fix import_shims pylint violations * Include import_shims directory in linting * Stop shimming imports when running pylint * Regenerate import_shims (for koa.master)
sambapete
pushed a commit
to EDUlib/edx-platform
that referenced
this pull request
Aug 9, 2021
…rsa (openedx#25678) Should resolve "re.error: nothing to repeat at position 0" when running pylint locally. Changes: * Fix import_shims pylint violations * Include import_shims directory in linting * Stop shimming imports when running pylint * Regenerate import_shims (for koa.master)
sambapete
pushed a commit
to EDUlib/edx-platform
that referenced
this pull request
Aug 11, 2021
…rsa (openedx#25678) Should resolve "re.error: nothing to repeat at position 0" when running pylint locally. Changes: * Fix import_shims pylint violations * Include import_shims directory in linting * Stop shimming imports when running pylint * Regenerate import_shims (for koa.master)
sambapete
pushed a commit
to EDUlib/edx-platform
that referenced
this pull request
Jan 6, 2022
…rsa (openedx#25678) Should resolve "re.error: nothing to repeat at position 0" when running pylint locally. Changes: * Fix import_shims pylint violations * Include import_shims directory in linting * Stop shimming imports when running pylint * Regenerate import_shims (for koa.master)
sambapete
pushed a commit
to EDUlib/edx-platform
that referenced
this pull request
Jan 6, 2022
…rsa (openedx#25678) Should resolve "re.error: nothing to repeat at position 0" when running pylint locally. Changes: * Fix import_shims pylint violations * Include import_shims directory in linting * Stop shimming imports when running pylint * Regenerate import_shims (for koa.master)
sambapete
pushed a commit
to EDUlib/edx-platform
that referenced
this pull request
Jan 7, 2022
…rsa (openedx#25678) Should resolve "re.error: nothing to repeat at position 0" when running pylint locally. Changes: * Fix import_shims pylint violations * Include import_shims directory in linting * Stop shimming imports when running pylint * Regenerate import_shims (for koa.master)
sambapete
pushed a commit
to EDUlib/edx-platform
that referenced
this pull request
Jan 7, 2022
…rsa (openedx#25678) Should resolve "re.error: nothing to repeat at position 0" when running pylint locally. Changes: * Fix import_shims pylint violations * Include import_shims directory in linting * Stop shimming imports when running pylint * Regenerate import_shims (for koa.master)
sambapete
pushed a commit
to EDUlib/edx-platform
that referenced
this pull request
Feb 11, 2022
…rsa (openedx#25678) Should resolve "re.error: nothing to repeat at position 0" when running pylint locally. Changes: * Fix import_shims pylint violations * Include import_shims directory in linting * Stop shimming imports when running pylint * Regenerate import_shims (for koa.master)
sambapete
pushed a commit
to EDUlib/edx-platform
that referenced
this pull request
Feb 11, 2022
…rsa (openedx#25678) Should resolve "re.error: nothing to repeat at position 0" when running pylint locally. Changes: * Fix import_shims pylint violations * Include import_shims directory in linting * Stop shimming imports when running pylint * Regenerate import_shims (for koa.master)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@regisb @nedbat
Context
This is a port of https://github.com/edx/edx-platform/pull/25632 onto
open-release/koa.master.I believe it should be backported because pylint usage is currently partially broken on koa.master. For example:
The problematic line is
ignore-patterns = **/import_shims/**/*.pyinpylintrc, which was trying to exclude theimport_shims/directory tree from linting. This failure was not showing up in CI because that regex only breaks under certain conditions.For more context on what the heck import_shims is in the first place, see my forum post about edx-platform import changes.
This PR
Instead of trying to fix the regex, I decided it'd be better to actually fix all the linting violations within
import_shims/so that we don't have to exclude the directory tree at all. Furthermore, this PR removesimport_shims/lmsandimport_shims/studiofrom thesys.pathinpylintrc, meaning that pylint will complain if it encounters any deprecated edx-platform import paths.Notes for reviewers
I've broken this PR's changes into three commits. The first two (Fix import_shims pylint..., and Do not shim...) deserve actual review. The third one (Regenerate import_shims) is just the result of a script, and modifies hundreds of stub files in the same exact way. I recommend just glancing at that commit.
The first two commits are identical to what I committed to
master. For the third commit, I specifically re-generated the import shims for the set of modules that exist in Koa, which is slightly different than the set of modules that exist on master currently. Thus, this is not a direct cherry-pick of the original change.When merging, I recommend squash+merge, as the individual commits do not stand on their own as logical changes.
I have not run the validation suite on this change locally; I figured CI would take care of that. It looks like CI isn't running on my change, though, so let me know if I should do it myself.