Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Fixing flake8 in travis and flake8 errors #3019

Merged
merged 2 commits into from Jul 3, 2017
Merged

Fixing flake8 in travis and flake8 errors #3019

merged 2 commits into from Jul 3, 2017

Conversation

daviddavis
Copy link
Contributor

Error:

$ git diff HEAD^ '*.py' | flake8 --diff --config flake8.cfg
fatal: ambiguous argument '*.py': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
The command "git diff HEAD^ '*.py' | flake8 --diff --config flake8.cfg" exited with 0.

Also, I recommend against running flake8 against the diff instead of all files. Doing so may not pick up some flake8 errors. For example, if a function call gets removed and it's the last one in the file, then the unused import warning won't get raised as the import line isn't part of the diff.

@mention-bot
Copy link

@daviddavis, thanks for your PR! By analyzing the history of the files in this pull request, we identified @bmbouter, @asmacdo and @dralley to be potential reviewers.

Copy link
Contributor

@asmacdo asmacdo left a comment

Choose a reason for hiding this comment

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

Thanks @daviddavis!

@@ -20,8 +20,8 @@ before_script:
- psql -U postgres -c "CREATE USER pulp WITH SUPERUSER LOGIN;"
- psql -U postgres -c "CREATE DATABASE pulp OWNER pulp;"
script:
# flake8 the diff
- "git diff HEAD^ '*.py' | flake8 --diff --config flake8.cfg"
Copy link
Contributor

Choose a reason for hiding this comment

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

We originally did it this way because most of pulp failed flake8. I'm happy with this change assuming this passes when merged.

@@ -38,7 +37,7 @@ def sync(repo_name, importer_name):
"""
importer = models.Importer.objects.get(name=importer_name, repository__name=repo_name).cast()
if not importer.feed_url:
raise ValueError_("An importer must have a 'feed_url' attribute to sync.")
raise ValueError(_("An importer must have a 'feed_url' attribute to sync."))
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for this! You just saved me some time!

pulp-dev.py Outdated
@@ -362,7 +362,7 @@ def install(opts):
os.system('chmod 3775 /var/cache/pulp')
Copy link
Contributor

Choose a reason for hiding this comment

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

Pretty sure this whole file is unused in Pulp 3. Want to remove in a separate commit on the same PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

As evidence, this Python 2 would have failed.

@@ -1,3 +1,5 @@
# TODO: fix flake8 undefined name errors on this file
Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove this since you ignored server/*

@@ -6,7 +6,7 @@
import celery

from pulp.common import tags
from pulp.common.error_codes import PLP0002, PLP0003
from pulp.common.error_codes import PLP0002
Copy link
Contributor

Choose a reason for hiding this comment

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

Undo this change as well. I think we should not add any changes to server/* even to make it flake8. It might imply that this code is not dead in the 3.0-dev line.

@@ -35,7 +35,7 @@ def increment(version):

def main():
Copy link
Contributor

Choose a reason for hiding this comment

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

@pcreech, @dkliban, can we remove the rel-eng directory from pulp 3?

Error:

$ git diff HEAD^ '*.py' | flake8 --diff --config flake8.cfg
fatal: ambiguous argument '*.py': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
The command "git diff HEAD^ '*.py' | flake8 --diff --config flake8.cfg" exited with 0.
Copy link
Contributor

@asmacdo asmacdo left a comment

Choose a reason for hiding this comment

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

Thanks @daviddavis for good style :shipit:

@@ -64,7 +64,7 @@ def _queue_reserved_task(name, inner_task_id, resource_id, inner_args, inner_kwa
concurrently with yours.
inner_args (tuple): The positional arguments to pass on to the task.
inner_kwargs (dict): The keyword arguments to pass on to the task.
options (dict): For all options accepted by apply_async please visit: http://docs.celeryproject.org/en/latest/reference/celery.app.task.html#celery.app.task.Task.apply_async #NOQA
options (dict): For all options accepted by apply_async please visit: http://docs.celeryproject.org/en/latest/reference/celery.app.task.html#celery.app.task.Task.apply_async # NOQA
Copy link
Contributor

Choose a reason for hiding this comment

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

since we use lowercase #noqa elsewhere, it would be better to keep it consistent.

Copy link
Contributor

@asmacdo asmacdo 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 consistency with NOQA

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants