Skip to content

Resolving lint warnings and errors #1522

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

Merged
merged 17 commits into from
Jul 31, 2015
Merged

Resolving lint warnings and errors #1522

merged 17 commits into from
Jul 31, 2015

Conversation

gregmuellegger
Copy link
Contributor

This resolves (nearly) all lint errors. For reviewing this PR keep in mind that my intend was always to just fix the warnings and not do any other refactoring. If you see a semantic change in the PR, please report!

All changes that required changing the semantics were proposed as other PRs:

These warnings are still left:

Messages
========

core/management/commands/build_files.py
  Line: 46
    pylint: no-value-for-parameter / No value for argument 'commit' in function call (col 16)

doc_builder/backends/__init__.py
  Line: 1
    pylint: cyclic-import / Cyclic import (core.forms -> core.models)

The first one is discussed in #1512

For the second one, I have not idea how to resolve it. The UserProfile.get_form method imports from .forms import UserProfileForm which is surely the cause for the warning, but the actual reported file that this error occurs in is always different for every run of tox -e lint ...

@ericholscher
Copy link
Member

Big 👍

@@ -32,7 +32,7 @@
class ProjectResource(ModelResource, SearchMixin):
users = fields.ToManyField('readthedocs.api.base.UserResource', 'users')

class Meta:
class Meta(object):
Copy link
Member

Choose a reason for hiding this comment

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

This feels un-djangoy -- have they suggested doing this now, or is this just to make the linter happy?

Copy link
Member

Choose a reason for hiding this comment

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

Also seems there are a bunch of other places where we're doing it and it isn't alerting. Is it special casing Django model's and forms, but not the api stuff?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The linter complains if python old-style classes are used. Django makes the Meta classes into new style classes automatically since this ticket: https://code.djangoproject.com/ticket/7342

The restframework however does not. So that's why we made them new-styles classes here by hand. I think of it as "future-proofing" as all classes will be new style classes in Python 3, so we do some testing in that regard here if we make the switch now.

@ericholscher
Copy link
Member

We: the circular import, do we actually use the get_form method on the UserProfileForm?

https://github.com/rtfd/readthedocs.org/blob/master/readthedocs/core/models.py#L29-L31 is the issue, but yea, it doesn't break prod, so I'm not sure what the best course of action is.

@ericholscher
Copy link
Member

We could do a janky string-based import, but that's just working around the linter, not changing the logic. Perhaps we can just silence the linter?

@ericholscher
Copy link
Member

Gonna merge this, but curious about the Meta stuff -- this will rot quickly, so want to get it in.

ericholscher added a commit that referenced this pull request Jul 31, 2015
Resolving lint warnings and errors
@ericholscher ericholscher merged commit 1f2c785 into master Jul 31, 2015
@gregmuellegger gregmuellegger deleted the lint-cleanup branch August 3, 2015 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: work in progress Pull request is not ready for full review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants