Skip to content
Snippets Groups Projects

Fix lint issues

Merged Daniel Silverstone requested to merge danielsilverstone-ct/fix-lint-issues into master

Description

There are a large number of pylint related issues raised by newer pylint versions. This MR attempts to address them.

In order to make it easier to deal with adding/removing changes, there are a large number of commits in this MR, though they may be partially squashed together toward the end of things.

In addition, there's one or two minor bugs which show up as part of the linting effort. These are also corrected here.

Edited by Daniel Silverstone

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • added 15 commits

    • 37e32bbe - _yaml.py: Quieten a lint in Python < 3.6
    • a96175cd - _yamlcache.py: Correct bug in `YamlCache._get_filepath()`
    • bdc99787 - _yamlcache.py: Correct braino in variable name
    • a5cf9781 - _yamlcache.py: Remove unused imports
    • 460bde90 - buildelement.py: Quieten a lint about `__commands`
    • 1de42941 - element.py: Simplify some conditions with `in (foo, bar)`
    • 5249fcea - element.py: Silence pylint warning about abstract method
    • 8e6aa97c - plugin.py: use dict.get() instead of an if statement
    • d67252ae - source.py: Quiet several pylint issues with abstract methods
    • ca589f81 - source.py: Remove unused local variable
    • d839b6e9 - source.py: Remove unused variable
    • 04e45f22 - utils.py: Disable lint warning about popen
    • 45a66c11 - utils.py: Group stat imports
    • de1e0a52 - _artifactcache/artifactcache.py: Remove superfluous parens
    • a3271709 - _artifactcache/artifactcache.py: Silence lint issues

    Compare with previous version

  • added 34 commits

    • b1921cac - _yaml.py: Quieten a lint in Python < 3.6
    • 814847eb - _yamlcache.py: Correct bug in `YamlCache._get_filepath()`
    • 42e4f2ca - _yamlcache.py: Correct braino in variable name
    • 3c98a723 - _yamlcache.py: Remove unused imports
    • 958b4c93 - buildelement.py: Quieten a lint about `__commands`
    • f6f7295c - element.py: Simplify some conditions with `in (foo, bar)`
    • 0e573080 - element.py: Silence pylint warning about abstract method
    • b58a7bf6 - plugin.py: use dict.get() instead of an if statement
    • 0e156637 - source.py: Quiet several pylint issues with abstract methods
    • 9187dd90 - source.py: Remove unused local variable
    • 02e5a88b - source.py: Remove unused variable
    • d079b9c0 - utils.py: Disable lint warning about popen
    • ce5464b4 - utils.py: Group stat imports
    • 3a006fa5 - _artifactcache/artifactcache.py: Remove superfluous parens
    • c626b6af - _artifactcache/artifactcache.py: Silence lint issues
    • d3efe1ee - _frontend/app.py: Remove unused import of `resource`
    • 6ddc8503 - _frontend/status.py: Reorder imports
    • bf8f0d02 - _fuse/{hardlinks,mount}.py: Remove dangerous use of {} in defaults
    • cfe43295 - _fuse/mount.py: Deal with abstract method lint issue
    • 91c2a611 - _options/optionbool.py: Refactor conditions
    • 03ead512 - _platform/darwin.py: Remove useless __init__()
    • f56d40e5 - _platform/darwin.py: Remove unused imports
    • 9ba6adca - _platform/linux.py: Remove unused imports
    • a5e8f626 - _platform/linux.py: Simplify return statement
    • b3755d67 - _scheduler/jobs/job.py: Correct lint issue around abstract method
    • 55c56c0e - _scheduler/queue/pullqueue.py: Remove unused return value
    • 987a57fa - _scheduler/queue/trackqueue.py: Remove unused import
    • fe4da576 - plugins/source/git.py: Rationalised unused return values
    • 47bc1d7a - sandbox/_mount.py: Do not use dict literals in argument defaults
    • d9d28852 - sandbox/_mounter.py: Remove useless inheritance on `object`
    • 3ddb72b2 - sandbox/_sandboxbwrap.py: Disable lint about dict.get
    • 8480765b - sandbox/_sandboxchroot.py: Silence warning about unused variable
    • 463670a1 - sandbox/_sandboxchroot.py: Silence warning about preexec_fn
    • 63597319 - sandbox/_sandboxchroot.py: Silence warning about dict.get

    Compare with previous version

  • Tristan Maat
  • Tristan Maat
  • Tristan Maat
  • We can probably get rid of the handful of # pylint: disable=assignment-from-no-return by using @abc around the code base. Looking at how many of those exceptions we need, this might well be worthwhile. Definitely a new MR/issue, but still worth noting.

    Otherwise, very nice. Code climate report says code quality improved :)

    Edited by Tristan Maat
  • added 5 commits

    • f228c739 - _artifactcache/cascache.py: Refactor slightly for indentation
    • 2a7da007 - _artifactcache/cascache.py: Silence len(SEQUENCE) as condition warnings
    • 4b1b0ebf - _artifactcache/cascache.py: Prepare attributes in __init__
    • ae99dbca - _artifactcache/cascache.py: Remove unused imports
    • 1812262f - _artifactcache/cascache.py: Cleanup lint warning about indexing

    Compare with previous version

  • added 40 commits

    • 121e0924 - _yaml.py: use `in (a,b)` to simply boolean checks
    • 6e46c7d6 - _yaml.py: Quieten a lint in Python < 3.6
    • 41c15df3 - _yamlcache.py: Correct bug in `YamlCache._get_filepath()`
    • 8dcee6ec - _yamlcache.py: Correct braino in variable name
    • 493f701b - _yamlcache.py: Remove unused imports
    • a347a529 - buildelement.py: Quieten a lint about `__commands`
    • 4a7206f3 - element.py: Simplify some conditions with `in (foo, bar)`
    • b7108be3 - element.py: Silence pylint warning about abstract method
    • 3677638b - plugin.py: use dict.get() instead of an if statement
    • 37836004 - source.py: Quiet several pylint issues with abstract methods
    • 81d7b331 - source.py: Remove unused local variable
    • d8a74cdd - source.py: Remove unused variable
    • 1bb0c9e3 - utils.py: Disable lint warning about popen
    • 1eae552d - utils.py: Group stat imports
    • 8a207eff - _artifactcache/artifactcache.py: Remove superfluous parens
    • f74827e0 - _artifactcache/artifactcache.py: Silence lint issues
    • 55f422bd - _frontend/app.py: Remove unused import of `resource`
    • 369fd3b7 - _frontend/status.py: Reorder imports
    • fdd67cd1 - _fuse/{hardlinks,mount}.py: Remove dangerous use of {} in defaults
    • 360c9c04 - _fuse/mount.py: Deal with abstract method lint issue
    • dc32a5f3 - _options/optionbool.py: Refactor conditions
    • f6a12d9d - _platform/darwin.py: Remove useless __init__()
    • b4686769 - _platform/darwin.py: Remove unused imports
    • d93ae474 - _platform/linux.py: Remove unused imports
    • b4baea03 - _platform/linux.py: Simplify return statement
    • 65c96957 - _scheduler/jobs/job.py: Correct lint issue around abstract method
    • 548943ea - _scheduler/queue/pullqueue.py: Remove unused return value
    • 99d0f463 - _scheduler/queue/trackqueue.py: Remove unused import
    • 090ea902 - plugins/source/git.py: Rationalised unused return values
    • bc1bdcf1 - sandbox/_mount.py: Do not use dict literals in argument defaults
    • de31ff95 - sandbox/_mounter.py: Remove useless inheritance on `object`
    • 06ba3e8a - sandbox/_sandboxbwrap.py: Disable lint about dict.get
    • ff3e41f9 - sandbox/_sandboxchroot.py: Silence warning about unused variable
    • b88c6937 - sandbox/_sandboxchroot.py: Silence warning about preexec_fn
    • 73aca8f7 - sandbox/_sandboxchroot.py: Silence warning about dict.get
    • 8163f755 - _artifactcache/cascache.py: Refactor slightly for indentation
    • 6c1f1445 - _artifactcache/cascache.py: Silence len(SEQUENCE) as condition warnings
    • 9947678c - _artifactcache/cascache.py: Prepare attributes in __init__
    • 5ca5a2a3 - _artifactcache/cascache.py: Remove unused imports
    • 88069579 - _artifactcache/cascache.py: Cleanup lint warning about indexing

    Compare with previous version

  • added 8 commits

    • 61bb0bc2 - sandbox/_sandboxchroot.py: Silence warning about unused variable
    • 5d748dca - sandbox/_sandboxchroot.py: Silence warning about preexec_fn
    • a50f791e - sandbox/_sandboxchroot.py: Silence warning about dict.get
    • b5b6bdef - _artifactcache/cascache.py: Refactor slightly for indentation
    • 2d301ab7 - _artifactcache/cascache.py: Silence len(SEQUENCE) as condition warnings
    • 7484e010 - _artifactcache/cascache.py: Prepare attributes in __init__
    • a0fc6a42 - _artifactcache/cascache.py: Remove unused imports
    • 8b30f377 - _artifactcache/cascache.py: Cleanup lint warning about indexing

    Compare with previous version

  • Daniel Silverstone resolved all discussions

    resolved all discussions

  • Daniel Silverstone unmarked as a Work In Progress

    unmarked as a Work In Progress

  • mentioned in issue #722 (closed)

  • added 39 commits

    • 01df2f2e - _yaml.py: Quieten a lint in Python < 3.6
    • 6e62c649 - _yamlcache.py: Correct bug in `YamlCache._get_filepath()`
    • 75063a74 - _yamlcache.py: Correct braino in variable name
    • f6202ad9 - _yamlcache.py: Remove unused imports
    • 86972c79 - buildelement.py: Quieten a lint about `__commands`
    • 33d04b59 - element.py: Simplify some conditions with `in (foo, bar)`
    • b07e7b0a - element.py: Silence pylint warning about abstract method
    • 6b5d9d81 - plugin.py: use dict.get() instead of an if statement
    • 480f33ac - source.py: Quiet several pylint issues with abstract methods
    • 3fa43cf9 - source.py: Remove unused local variable
    • bdb071a6 - source.py: Remove unused variable
    • 13577ad8 - utils.py: Disable lint warning about popen
    • 27944d80 - utils.py: Group stat imports
    • 14d78ea2 - _artifactcache/artifactcache.py: Remove superfluous parens
    • f9166fee - _artifactcache/artifactcache.py: Silence lint issues
    • 1b9ce37a - _frontend/app.py: Remove unused import of `resource`
    • 46961c13 - _frontend/status.py: Reorder imports
    • 0ddc853c - _fuse/{hardlinks,mount}.py: Remove dangerous use of {} in defaults
    • ff42b4fa - _fuse/mount.py: Deal with abstract method lint issue
    • 4a5a832b - _options/optionbool.py: Refactor conditions
    • 114d0643 - _platform/darwin.py: Remove useless __init__()
    • 7ec09556 - _platform/darwin.py: Remove unused imports
    • cc7ca161 - _platform/linux.py: Remove unused imports
    • 43f600d7 - _platform/linux.py: Simplify return statement
    • cbce53d3 - _scheduler/jobs/job.py: Correct lint issue around abstract method
    • d7365df7 - _scheduler/queue/pullqueue.py: Remove unused return value
    • 975a79c2 - _scheduler/queue/trackqueue.py: Remove unused import
    • aa946c93 - plugins/source/git.py: Rationalised unused return values
    • 75b6fd3b - sandbox/_mount.py: Do not use dict literals in argument defaults
    • a4dd0b96 - sandbox/_mounter.py: Remove useless inheritance on `object`
    • dc38e116 - sandbox/_sandboxbwrap.py: Disable lint about dict.get
    • e25f2346 - sandbox/_sandboxchroot.py: Silence warning about unused variable
    • 3b1538b5 - sandbox/_sandboxchroot.py: Silence warning about preexec_fn
    • e74e3799 - sandbox/_sandboxchroot.py: Silence warning about dict.get
    • 604fc0f7 - _artifactcache/cascache.py: Refactor slightly for indentation
    • b4fd5701 - _artifactcache/cascache.py: Silence len(SEQUENCE) as condition warnings
    • 7c1e8c51 - _artifactcache/cascache.py: Prepare attributes in __init__
    • 228ece7a - _artifactcache/cascache.py: Remove unused imports
    • 51fdd412 - _artifactcache/cascache.py: Cleanup lint warning about indexing

    Compare with previous version

  • This looks good to me. In terms of commit history, I'd prefer grouping bugs by type or file (don't mind which) and keeping bug fixes as separate commits.

    Edited by Phil Dawson
    • Resolved by Daniel Silverstone

      We can probably get rid of the handful of # pylint: disable=assignment-from-no-return by using @abc around the code base. Looking at how many of those exceptions we need, this might well be worthwhile. Definitely a new MR/issue, but still worth noting.

      I don't like requiring disable=assignment-from-no-return for this common pattern. If @abc indeed works for this, shouldn't this be a rather simple improvement and better done as part of this MR?

      Edited by Jürg Billeter
  • Jürg Billeter
  • Looks good to me overall.

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading