Opened 8 months ago

Last modified 8 months ago

#7194 reviewing defect

tox is failing for buildtools, reporting flake8 errors

Reported by: kzar Assignee:
Priority: Unknown Milestone:
Module: Automation Keywords:
Cc: tlucas, sebastian Blocked By: #7196
Blocking: Platform: Unknown / Cross platform
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29975555/

Description (last modified by kzar)

Environment

How to reproduce

  1. Clone the buildtools repository, run tox.

Observed behaviour

While the tests all seem to pass, the following is output at the end:

py27 runtests: commands[2] | flake8
./releaseAutomation.py:146:17: W504 line break after binary operator
./releaseAutomation.py:151:17: W504 line break after binary operator
./ensure_dependencies.py:370:13: W504 line break after binary operator
./jshydra/abp_rewrite.py:29:33: C812 missing trailing comma
./jshydra/abp_rewrite.py:31:20: C812 missing trailing comma
./jshydra/abp_rewrite.py:47:39: C812 missing trailing comma
./jshydra/abp_rewrite.py:73:5: E722 do not use bare 'except'
./jshydra/autotest.py:58:1: E305 expected 2 blank lines after class or function definition, found 1
ERROR: InvocationError for command '/path/to/adblockpluschrome/buildtools/.tox/py27/bin/flake8' (exited with code 1)

Expected behaviour

Those error messages are not displayed.

Notes

  • Looking at it, jshydra is only there as it used to be a dependency of buildtools, and is also therefore being ignored by Git. Nevertheless, I figure we should still tell flake8 to skip checking it.
  • It seems that while newer versions of flake8 enforce the W504 line break after binary operator, older versions actually enforce the opposite W503 line break before binary operator rule! We've configured tox to use both a recent and old version of flake8, so we'll have to ignore at least one of these rules.

Change History (6)

comment:1 Changed 8 months ago by kzar

  • Description modified (diff)

comment:2 Changed 8 months ago by kzar

  • Description modified (diff)

comment:3 Changed 8 months ago by kzar

  • Blocked By 7196 added

comment:4 Changed 8 months ago by kzar

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:5 in reply to: ↑ description Changed 8 months ago by sebastian

Replying to kzar:

  • Looking at it, jshydra is only there as it used to be a dependency of buildtools, and is also therefore being ignored by Git. Nevertheless, I figure we should still tell flake8 to skip checking it.

The jsHydra dependency has been removed ages ago, and it feels like a hack to account for it in tox.ini going forward. But I admit ensure_dependencies.py keep ignoring gone dependencies isn't ideal. Ideally, hg status/git status should indicate and hg clean/git clean -f -d should remove untracked files from obsolete dependencies.

  • It seems that while newer versions of flake8 enforce the W504 line break after binary operator, older versions actually enforce the opposite W503 line break before binary operator rule! We've configured tox to use both a recent and old version of flake8, so we'll have to ignore at least one of these rules.

For reference, this is being discussed here.

comment:6 Changed 8 months ago by kzar

Sebastian requested we move the discussion about ignoring the jshydra directory here. First of all, I'll repeat my initial point from the codereview:

"Why not just delete the jshydra directory?"

Well, it'll keep getting created again when I am bisecting with old versions of the code.

Then to respond to Sebastian's argument:

The jsHydra dependency has been removed ages ago, and it feels like a hack to account for it in tox.ini going forward.

Well, I kind of disagree. For me this directory will keep showing up, and we never want to lint it, so explicitly ignoring it from linting makes sense. Also the change we're talking about is trivial, and unlikely to cause confusion:

  • tox.ini

    diff --git a/tox.ini b/tox.ini
    index 2b2c33d..1673374 100644
    a b skipsdist = true 
    66 
    77exclude = 
    88    node_modules, 
     9    jshydra, 
    910    .tox, 
    1011    *.pyc, 
    1112ignore = D1,C815 
Note: See TracTickets for help on using tickets.