Skip to content
This repository was archived by the owner on Apr 20, 2025. It is now read-only.

Conversation

@cclauss
Copy link

@cclauss cclauss commented Dec 11, 2018

$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics

E901,E999,F821,F822,F823 are the "showstopper" flake8 issues that can halt the runtime with a SyntaxError, NameError, etc. Most other flake8 issues are merely "style violations" -- useful for readability but they do not effect runtime safety.

  • F821: undefined name name
  • F822: undefined name name in __all__
  • F823: local variable name referenced before assignment
  • E901: SyntaxError or IndentationError
  • E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree

@coveralls
Copy link

coveralls commented Dec 11, 2018

Coverage Status

Coverage decreased (-0.1%) to 90.29% when pulling 09c403f on cclauss:patch-1 into 1659432 on sybrenstuvel:master.

@cclauss
Copy link
Author

cclauss commented Dec 11, 2018

Gotta love coverage! Adding tests in a non-code file lowers your score.

@sybrenstuvel
Copy link
Owner

I've merged half this branch, and added Python 3.7 support to Travis-CI (and removed Python 2.7 and 3.4 while I was at it). I also added MyPy, but not yet flake8.

@sybrenstuvel
Copy link
Owner

Added flake8 as dependency and fixed the things it reported in f2c3b4f

@cclauss
Copy link
Author

cclauss commented Aug 4, 2019

Unsure how to resolve conflicts. Both pyenv and poetry or just one of them?

@sybrenstuvel
Copy link
Owner

Only Poetry. I've never used pyenv. Did you mean pipenv? I kicked that out today in favour of Poetry.

The config for flask8 can be put in the [flake8] section of setup.cfg. That way invocations don't have to list specific settings like the maximum line length or allowed complexity. I think we can break the build for any flake8 error/warning. Currently it runs without any of those on my machine.

@cclauss
Copy link
Author

cclauss commented Aug 4, 2019

Ready for review.

Copy link
Owner

@sybrenstuvel sybrenstuvel left a comment

Choose a reason for hiding this comment

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

Thanks for the cleanup. I still have quite a few questions, though.

@@ -1,29 +1,19 @@
dist: bionic
language: python
dist: bionic # required for Python >= 3.7
Copy link
Owner

Choose a reason for hiding this comment

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

Why remove the comment and move the line? I added the comment for a reason.

Copy link
Author

Choose a reason for hiding this comment

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

That comment was important when trusty was the default distro on Travis CI because trusty did not support Python 3.7.

But now that xenial is the default distro, the comment is no longer needed because both xenial and bionic fully support Python 3.7 https://blog.travis-ci.com/2019-04-15-xenial-default-build-environment

Copy link
Owner

Choose a reason for hiding this comment

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

Reasoning like this should be part of the commit message.

cache: pip

# Environment changes have to be manually synced with 'tox.ini'.
# See: https://github.com/travis-ci/travis-ci/issues/3024
Copy link
Owner

Choose a reason for hiding this comment

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

Why is this comment removed? Again, it was there for a reason.

Copy link
Author

Choose a reason for hiding this comment

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

That issue was closed in 2015.

Copy link
Owner

Choose a reason for hiding this comment

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

That's irrelevant. Both files still list the same environments, and should still be kept in sync. If that's no longer necessary, only one of the files should have the list of environments, not both. Either properly handle this (in a separate commit, as it has nothing to do with getting flake8 to run in CI) or don't touch it.

.travis.yml Outdated
#- python: pypy3.5
# dist: xenial # Bionic has no Python 3.5

before_install: pip install --upgrade pip
Copy link
Owner

Choose a reason for hiding this comment

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

Why is this necessary?

Copy link
Author

Choose a reason for hiding this comment

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

Because Travis provides an older version of pip and pip is going thru rapid innovation these daze. There is hope that pip will add a real dependency resolver in the near term.

Copy link
Owner

Choose a reason for hiding this comment

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

Would be good to add a comment to this effect, including which version of Pip is now installed by default.

.travis.yml Outdated
after_success:
- poetry run coveralls
before_script: flake8 .
script: poetry run py.test tests/
Copy link
Owner

Choose a reason for hiding this comment

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

The script and after_success sections haven't changed, you just moved it to one line. Please only include actual changes in the commit, and leave cleanups for another PR. This only makes the diff harder to read.

Copy link
Author

Choose a reason for hiding this comment

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

It is more important that the file is concise and easier to read than the diff. The diff will be read once, but the file hopefully many times.

Copy link
Owner

@sybrenstuvel sybrenstuvel Aug 4, 2019

Choose a reason for hiding this comment

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

I disagree with that. Cleanups should go in a separate commit. Diffs are definitely read more than once.

.travis.yml Outdated

after_success:
- poetry run coveralls
before_script: flake8 .
Copy link
Owner

Choose a reason for hiding this comment

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

Is flake8 installed by default? Personally I'd rather run it with poetry run flake8 ., so that it's running the same version in Travis-CI as you'd get when running locally. Makes things a bit easier to control.

Copy link
Author

Choose a reason for hiding this comment

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

poetry is installing flake8.

If poetry is also going to run flake8 then this line can be removed. I am not a user of poetry (yet).

Copy link
Owner

Choose a reason for hiding this comment

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

But without poetry run in front of it, it's not going to magically run from the Poetry-managed virtualenv.

max-line-length = 100
max-complexity = 10

[pep8]
Copy link
Owner

Choose a reason for hiding this comment

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

Do other tools that inspect the [pep8] section all have a fallback to the [flake8] section?

Copy link
Author

Choose a reason for hiding this comment

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

"pep8" was changed to "pycodestyle" several years ago at the BDFL's request. flake8 is a superset of pycodestyle so it does everything pycodestyle did and much more besides.

Copy link
Owner

Choose a reason for hiding this comment

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

Even then, such cleanups should go in a different commit. Getting flake8 to run in CI has little to do with removing unused bits of config.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants