Skip to content

Commit df52689

Browse files
lordmauveagjohnson
authored andcommitted
Fix lint errors for oauth app (#2869)
1 parent 1704825 commit df52689

File tree

5 files changed

+19
-12
lines changed

5 files changed

+19
-12
lines changed

prospector-more.yml

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ ignore-paths:
1313
- donate/
1414
- gold/
1515
- notifications/
16-
- oauth/
1716
- payments/
1817
- privacy/
1918
- profiles/

readthedocs/oauth/admin.py

+8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
1+
"""Admin configuration for the OAuth app."""
2+
13
from django.contrib import admin
24

35
from .models import RemoteRepository, RemoteOrganization
46

57

68
class RemoteRepositoryAdmin(admin.ModelAdmin):
9+
10+
"""Admin configuration for the RemoteRepository model."""
11+
712
raw_id_fields = ('users',)
813

914

1015
class RemoteOrganizationAdmin(admin.ModelAdmin):
16+
17+
"""Admin configuration for the RemoteOrganization model."""
18+
1119
raw_id_fields = ('users',)
1220

1321

readthedocs/oauth/services/bitbucket.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def create_repository(self, fields, privacy=DEFAULT_PRIVACY_LEVEL,
107107
account=self.account,
108108
)
109109
if repo.organization and repo.organization != organization:
110-
log.debug('Not importing %s because mismatched orgs' %
110+
log.debug('Not importing %s because mismatched orgs',
111111
fields['name'])
112112
return None
113113
else:
@@ -139,7 +139,7 @@ def create_repository(self, fields, privacy=DEFAULT_PRIVACY_LEVEL,
139139
repo.save()
140140
return repo
141141
else:
142-
log.debug('Not importing %s because mismatched type' %
142+
log.debug('Not importing %s because mismatched type',
143143
fields['name'])
144144

145145
def create_organization(self, fields):

readthedocs/oauth/services/github.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def create_repository(self, fields, privacy=DEFAULT_PRIVACY_LEVEL,
9494
)
9595
repo.users.add(self.user)
9696
if repo.organization and repo.organization != organization:
97-
log.debug('Not importing %s because mismatched orgs' %
97+
log.debug('Not importing %s because mismatched orgs',
9898
fields['name'])
9999
return None
100100
else:
@@ -116,7 +116,7 @@ def create_repository(self, fields, privacy=DEFAULT_PRIVACY_LEVEL,
116116
repo.save()
117117
return repo
118118
else:
119-
log.debug('Not importing %s because mismatched type' %
119+
log.debug('Not importing %s because mismatched type',
120120
fields['name'])
121121

122122
def create_organization(self, fields):
@@ -214,7 +214,6 @@ def setup_webhook(self, project):
214214
except (RequestException, ValueError):
215215
log.error('GitHub webhook creation failed for project: %s',
216216
project, exc_info=True)
217-
pass
218217
else:
219218
log.error('GitHub webhook creation failed for project: %s',
220219
project)
@@ -224,7 +223,7 @@ def setup_webhook(self, project):
224223
except ValueError:
225224
debug_data = resp.content
226225
log.debug('GitHub webhook creation failure response: %s',
227-
resp.json())
226+
debug_data)
228227
return (False, resp)
229228

230229
def update_webhook(self, project, integration):
@@ -259,15 +258,15 @@ def update_webhook(self, project, integration):
259258
except (RequestException, ValueError):
260259
log.error('GitHub webhook update failed for project: %s',
261260
project, exc_info=True)
262-
pass
263261
else:
264262
log.error('GitHub webhook update failed for project: %s',
265263
project)
266264
try:
267-
log.debug('GitHub webhook creation failure response: %s',
268-
resp.json())
265+
debug_data = resp.json()
269266
except ValueError:
270-
pass
267+
debug_data = resp.content
268+
log.debug('GitHub webhook creation failure response: %s',
269+
debug_data)
271270
return (False, resp)
272271

273272
@classmethod

readthedocs/oauth/utils.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""Support code for OAuth, including webhook support."""
12
import logging
23

34
from django.contrib import messages
@@ -36,7 +37,7 @@ def attach_webhook(project, request=None):
3637

3738
user_accounts = service.for_user(request.user)
3839
for account in user_accounts:
39-
success, resp = account.setup_webhook(project)
40+
success, __ = account.setup_webhook(project)
4041
if success:
4142
messages.success(request, _('Webhook activated'))
4243
project.has_valid_webhook = True

0 commit comments

Comments
 (0)