From 434016af045ddb90f9d62d91fd88a3b8db6eeb6d Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Fri, 25 May 2018 13:20:36 -0500 Subject: [PATCH 1/4] Fix prospector dependencies --- requirements/lint.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements/lint.txt b/requirements/lint.txt index bc27efe8f70..e325c6299f1 100644 --- a/requirements/lint.txt +++ b/requirements/lint.txt @@ -4,6 +4,7 @@ maxcdn # https://github.com/PyCQA/pylint-django/issues/117 astroid==1.6.1 pylint -prospector pylint-django +pylint-celery +prospector pyflakes From 79dfee4bdda7dcff4752541629483657f949af62 Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Fri, 25 May 2018 13:35:49 -0500 Subject: [PATCH 2/4] Fix whitespaces --- readthedocs/cdn/purge.py | 1 + readthedocs/core/validators.py | 1 + readthedocs/gold/admin.py | 1 + readthedocs/redirects/admin.py | 1 + 4 files changed, 4 insertions(+) diff --git a/readthedocs/cdn/purge.py b/readthedocs/cdn/purge.py index 76d56d99921..fcd02b5c883 100644 --- a/readthedocs/cdn/purge.py +++ b/readthedocs/cdn/purge.py @@ -21,6 +21,7 @@ def chunks(in_list, chunk_size): for i in range(0, len(in_list), chunk_size): yield in_list[i:i + chunk_size] + if CDN_USERNAME and CDN_KEY and CDN_SECRET and CDN_SERVICE == 'maxcdn': from maxcdn import MaxCDN api = MaxCDN(CDN_USERNAME, CDN_KEY, CDN_SECRET) diff --git a/readthedocs/core/validators.py b/readthedocs/core/validators.py index c8523f2d619..8ac10849d9c 100644 --- a/readthedocs/core/validators.py +++ b/readthedocs/core/validators.py @@ -46,6 +46,7 @@ def __call__(self, value): raise exc super(DomainNameValidator, self).__call__(idnavalue) + validate_domain_name = DomainNameValidator() diff --git a/readthedocs/gold/admin.py b/readthedocs/gold/admin.py index 10dc9987078..ecd512b75a8 100644 --- a/readthedocs/gold/admin.py +++ b/readthedocs/gold/admin.py @@ -11,4 +11,5 @@ class GoldAdmin(admin.ModelAdmin): list_display = ('user', 'level', 'modified_date', 'subscribed') list_filter = ('level',) + admin.site.register(GoldUser, GoldAdmin) diff --git a/readthedocs/redirects/admin.py b/readthedocs/redirects/admin.py index e522e1b0fec..35b4995b22b 100644 --- a/readthedocs/redirects/admin.py +++ b/readthedocs/redirects/admin.py @@ -10,4 +10,5 @@ class RedirectAdmin(admin.ModelAdmin): list_display = ['project', 'redirect_type', 'from_url', 'to_url'] raw_id_fields = ('project',) + admin.site.register(Redirect, RedirectAdmin) From d6e2f7d3beda2d5e0f310a1f7324cc166e96c50a Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Fri, 25 May 2018 13:45:15 -0500 Subject: [PATCH 3/4] Noqa --- readthedocs/core/management/commands/reindex_elasticsearch.py | 2 +- readthedocs/core/middleware.py | 2 +- readthedocs/doc_builder/environments.py | 2 +- readthedocs/search/parse_json.py | 3 +-- readthedocs/search/utils.py | 3 +-- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/readthedocs/core/management/commands/reindex_elasticsearch.py b/readthedocs/core/management/commands/reindex_elasticsearch.py index b736a1cd426..2cd86e7e389 100644 --- a/readthedocs/core/management/commands/reindex_elasticsearch.py +++ b/readthedocs/core/management/commands/reindex_elasticsearch.py @@ -44,7 +44,7 @@ def handle(self, *args, **options): log.info("Reindexing %s", version) try: commit = version.project.vcs_repo(version.slug).commit - except: # pylint: disable=bare-except + except: # noqa # An exception can be thrown here in production, but it's not # documented what the exception here is commit = None diff --git a/readthedocs/core/middleware.py b/readthedocs/core/middleware.py index a6034ccd047..1fbdaf422be 100644 --- a/readthedocs/core/middleware.py +++ b/readthedocs/core/middleware.py @@ -114,7 +114,7 @@ def process_request(self, request): log.debug(LOG_TEMPLATE.format( msg='CNAME detected: %s' % request.slug, **log_kwargs)) - except: + except: # noqa # Some crazy person is CNAMEing to us. 404. log.exception(LOG_TEMPLATE.format(msg='CNAME 404', **log_kwargs)) raise Http404(_('Invalid hostname')) diff --git a/readthedocs/doc_builder/environments.py b/readthedocs/doc_builder/environments.py index 4419af5c84e..e3a74e2f7a4 100644 --- a/readthedocs/doc_builder/environments.py +++ b/readthedocs/doc_builder/environments.py @@ -672,7 +672,7 @@ def __enter__(self): try: self.create_container() - except: # pylint: disable=broad-except + except: # noqa self.__exit__(*sys.exc_info()) raise return self diff --git a/readthedocs/search/parse_json.py b/readthedocs/search/parse_json.py index 4583822ac5e..a6044126530 100644 --- a/readthedocs/search/parse_json.py +++ b/readthedocs/search/parse_json.py @@ -35,8 +35,7 @@ def process_all_json_files(version, build_dir=True): if result: page_list.append(result) # we're unsure which exceptions can be raised - # pylint: disable=bare-except - except: + except: # noqa pass return page_list diff --git a/readthedocs/search/utils.py b/readthedocs/search/utils.py index c5e47b309a7..081104c201d 100644 --- a/readthedocs/search/utils.py +++ b/readthedocs/search/utils.py @@ -290,8 +290,7 @@ def parse_mkdocs_sections(content): 'content': h2_content, } # we're unsure which exceptions can be raised - # pylint: disable=bare-except - except: + except: # noqa log.exception('Failed indexing') From bb165b8c6d26e396c6724db2d91ad2000ee1a621 Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Tue, 29 May 2018 10:25:04 -0500 Subject: [PATCH 4/4] Pin lint dependencies --- requirements/lint.txt | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/requirements/lint.txt b/requirements/lint.txt index e325c6299f1..aea0ace0d5c 100644 --- a/requirements/lint.txt +++ b/requirements/lint.txt @@ -1,10 +1,8 @@ -r pip.txt -maxcdn -# astroid 1.6.2 breaks pylint-django -# https://github.com/PyCQA/pylint-django/issues/117 -astroid==1.6.1 -pylint -pylint-django -pylint-celery -prospector -pyflakes +maxcdn==0.0.7 +astroid==1.6.4 +pylint==1.9.1 +pylint-django==0.11.1 +pylint-celery==0.3 +prospector==0.12.10 +pyflakes==2.0.0