Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pyflakes to linting setup. #192

Closed
sallner opened this issue Jun 18, 2021 · 2 comments · Fixed by #233
Closed

Add pyflakes to linting setup. #192

sallner opened this issue Jun 18, 2021 · 2 comments · Fixed by #233
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@sallner
Copy link
Contributor

sallner commented Jun 18, 2021

In the test to the secrets an undefined variable secrets occurred.

def test_decrypt_missing_key(monkeypatch):
monkeypatch.setitem(os.environ, "GNUPGHOME", '/tmp')
with pytest.raises(subprocess.CalledProcessError):
EncryptedConfigFile(encrypted_file)
f = secrets.__enter__()
f.read()

I would propose to add pyflakes to the linting chain, to ensure those kind of errors do not happen.

A run over the current codebase resulted in the following output.

[batou]$pyflakes src/
src/batou/deploy.py:9:1 'batou.ConfigurationError' imported but unused
src/batou/deploy.py:9:1 'batou.DeploymentError' imported but unused
src/batou/deploy.py:9:1 'batou.FileLockedError' imported but unused
src/batou/deploy.py:13:1 '.environment.MissingEnvironment' imported but unused
src/batou/remote_core.py:392:47 undefined name 'e'
src/batou/conftest.py:7:12 local variable 'FIXTURE' is assigned to but never used
src/batou/utils.py:111:25 '...'.format(...) has unused arguments at position(s): 0, 1
src/batou/fixtures.py:2:1 'subprocess' imported but unused
src/batou/secrets/encryption.py:7:1 'shlex' imported but unused
src/batou/secrets/edit.py:2:1 'glob' imported but unused
src/batou/secrets/tests/test_secrets.py:64:13 undefined name 'secrets'
src/batou/tests/test_remote.py:40:5 local variable 'd' is assigned to but never used
src/batou/tests/test_remote_core.py:111:70 local variable 'f' is assigned to but never used
src/batou/tests/test_utils.py:60:39 local variable 'f' is assigned to but never used
``

@ctheune ctheune added this to the batou 2 - future milestone Aug 19, 2021
@ctheune ctheune added the enhancement New feature or request label Aug 19, 2021
@sallner
Copy link
Contributor Author

sallner commented Sep 13, 2021

When working on #184 I actually run into the problem with the test mentioned above. I actually encountered a NameError in this test now. I would like to prioritize this issue higher.

@ctheune ctheune modified the milestones: batou 2 - future, batou 2.3 Sep 13, 2021
@ctheune ctheune self-assigned this Sep 19, 2021
@ctheune
Copy link
Member

ctheune commented Sep 19, 2021

I started working on this and I'm running into some interesting things about the linter setup: depending on the way we call the (now) three main tools (flake8, isort, yapf) we seem to get different results:

  • from my editor
  • from precommit
  • from precommit when run through tox

In general I think we need to try to convince all tools to use the settings in setup.cfg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants