From 22a554fe25e1fca47b9ccf9fda569a1df0082eca Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Aug 29 2016 09:46:12 +0000 Subject: Move the pylint ignore from using the identifier to using the unique name This makes these lines much easier to read/understand Thanks @puiterwijk :) --- diff --git a/pagure/__init__.py b/pagure/__init__.py index f9873b5..4437e6b 100644 --- a/pagure/__init__.py +++ b/pagure/__init__.py @@ -371,7 +371,6 @@ def inject_variables(): ) -# pylint: disable=W0613 @APP.before_request def set_session(): """ Set the flask session as permanent. """ @@ -557,7 +556,7 @@ if APP.config.get('PAGURE_AUTH', None) == 'local': APP.after_request(login._send_session_cookie) -# pylint: disable=W0613 +# pylint: disable=unused-argument @APP.teardown_request def shutdown_session(exception=None): """ Remove the DB session at the end of each request. """ diff --git a/pagure/api/__init__.py b/pagure/api/__init__.py index cfadddd..9529adc 100644 --- a/pagure/api/__init__.py +++ b/pagure/api/__init__.py @@ -10,14 +10,10 @@ API namespace version 0. """ -# invalid-name -# pylint: disable=C0103 -# too-few-public-methods -# pylint: disable=R0903 -# no-member -# pylint: disable=E1101 -# too-many-locals -# pylint: disable=R0914 +# pylint: disable=invalid-name +# pylint: disable=too-few-public-methods +# pylint: disable=no-member +# pylint: disable=too-many-locals import codecs import functools diff --git a/pagure/doc_utils.py b/pagure/doc_utils.py index 7423dde..8eaa0d1 100644 --- a/pagure/doc_utils.py +++ b/pagure/doc_utils.py @@ -26,7 +26,7 @@ def modify_rst(rst, view_file_url=None): ) # We catch Exception if we want :-p - # pylint: disable=W0703 + # pylint: disable=broad-except try: # The rst features we need were introduced in this version minimum = [0, 9] diff --git a/pagure/forms.py b/pagure/forms.py index cff4e58..5572513 100644 --- a/pagure/forms.py +++ b/pagure/forms.py @@ -8,13 +8,16 @@ """ +# pylint: disable=too-few-public-methods +# pylint: disable=no-init +# pylint: disable=super-on-old-class + import re import flask import flask_wtf as wtf import wtforms import tempfile -# pylint: disable=R0903,W0232,E1002 import pagure diff --git a/pagure/internal/__init__.py b/pagure/internal/__init__.py index 46e8506..6ac1b29 100644 --- a/pagure/internal/__init__.py +++ b/pagure/internal/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ - (c) 2015 - Copyright Red Hat Inc + (c) 2015-2016 - Copyright Red Hat Inc Authors: Pierre-Yves Chibon @@ -10,6 +10,9 @@ Internal endpoints. """ +# pylint: disable=no-member + + import shutil import tempfile import os @@ -49,8 +52,6 @@ MERGE_OPTIONS = { } } -# pylint: disable=E1101 - def localonly(function): ''' Decorator used to check if the request is local or not. diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index 522281d..10086e5 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -8,16 +8,11 @@ """ -# too-many-branches -# pylint: disable=R0912 -# too-many-arguments -# pylint: disable=R0913 -# too-many-locals -# pylint: disable=R0914 -# too-many-statements -# pylint: disable=R0915 -# too-many-lines -# pylint: disable=C0302 +# pylint: disable=too-many-branches +# pylint: disable=too-many-arguments +# pylint: disable=too-many-locals +# pylint: disable=too-many-statements +# pylint: disable=too-many-lines try: diff --git a/pagure/lib/git.py b/pagure/lib/git.py index 90ef234..048a64d 100644 --- a/pagure/lib/git.py +++ b/pagure/lib/git.py @@ -8,6 +8,13 @@ """ +# pylint: disable=too-many-branches +# pylint: disable=too-many-arguments +# pylint: disable=too-many-locals +# pylint: disable=too-many-statements +# pylint: disable=no-member +# pylint: disable=too-many-lines + import datetime import hashlib @@ -30,20 +37,6 @@ from pagure.lib import model from pagure.lib.repo import PagureRepo -# too-many-branches -# pylint: disable=R0912 -# too-many-arguments -# pylint: disable=R0913 -# too-many-locals -# pylint: disable=R0914 -# too-many-statements -# pylint: disable=R0915 -# no-member -# pylint: disable=E1101 -# C0302 -# pylint: disable=C0302 - - def commit_to_patch(repo_obj, commits): ''' For a given commit (PyGit2 commit object) of a specified git repo, returns a string representation of the changes the commit did in a diff --git a/pagure/lib/lib_ci.py b/pagure/lib/lib_ci.py index f976737..0e390e6 100644 --- a/pagure/lib/lib_ci.py +++ b/pagure/lib/lib_ci.py @@ -10,8 +10,7 @@ """ -# too-many-locals -# pylint: disable=R0914 +# pylint: disable=too-many-locals import pagure.exceptions import pagure.lib diff --git a/pagure/lib/link.py b/pagure/lib/link.py index 5236478..bb66234 100644 --- a/pagure/lib/link.py +++ b/pagure/lib/link.py @@ -8,8 +8,7 @@ """ -# too-many-arguments -# pylint: disable=R0913 +# pylint: disable=too-many-arguments import re diff --git a/pagure/lib/model.py b/pagure/lib/model.py index ba2b0da..0ca61e3 100644 --- a/pagure/lib/model.py +++ b/pagure/lib/model.py @@ -40,16 +40,12 @@ BASE = declarative_base(metadata=MetaData(naming_convention=CONVENTION)) ERROR_LOG = logging.getLogger('pagure.model') -# invalid-name - hit w/ all the id field we use -# pylint: disable=C0103 -# too-few-public-methods -# pylint: disable=R0903 -# no-init -# pylint: disable=W0232 -# no-member -# pylint: disable=E1101 -# too-many-lines -# pylint: disable=C0302 +# hit w/ all the id field we use +# pylint: disable=invalid-name +# pylint: disable=too-few-public-methods +# pylint: disable=no-init +# pylint: disable=no-member +# pylint: disable=too-many-lines def create_tables(db_url, alembic_ini=None, acls=None, debug=False): @@ -78,7 +74,7 @@ def create_tables(db_url, alembic_ini=None, acls=None, debug=False): # engine.execute(collection_package_create_view(driver=engine.driver)) if db_url.startswith('sqlite:'): # Ignore the warning about con_record - # pylint: disable=W0613 + # pylint: disable=unused-argument def _fk_pragma_on_connect(dbapi_con, _): # pragma: no cover ''' Tries to enforce referential constraints on sqlite. ''' dbapi_con.execute('pragma foreign_keys=ON') @@ -89,7 +85,7 @@ def create_tables(db_url, alembic_ini=None, acls=None, debug=False): # version table, "stamping" it with the most recent rev: # Ignore the warning missing alembic - # pylint: disable=F0401 + # pylint: disable=import-error from alembic.config import Config from alembic import command alembic_cfg = Config(alembic_ini) diff --git a/pagure/lib/notify.py b/pagure/lib/notify.py index 3b85667..40ea3f0 100644 --- a/pagure/lib/notify.py +++ b/pagure/lib/notify.py @@ -9,10 +9,8 @@ pagure notifications. """ -# too-many-branches -# pylint: disable=R0912 -# too-many-arguments -# pylint: disable=R0913 +# pylint: disable=too-many-branches +# pylint: disable=too-many-arguments import datetime @@ -38,9 +36,9 @@ if pagure.APP.config['EVENTSOURCE_SOURCE']: def fedmsg_publish(*args, **kwargs): # pragma: no cover ''' Try to publish a message on the fedmsg bus. ''' # We catch Exception if we want :-p - # pylint: disable=W0703 + # pylint: disable=broad-except # Ignore message about fedmsg import - # pylint: disable=F0401 + # pylint: disable=import-error kwargs['modname'] = 'pagure' try: import fedmsg diff --git a/pagure/login_forms.py b/pagure/login_forms.py index c5e5a38..494f01f 100644 --- a/pagure/login_forms.py +++ b/pagure/login_forms.py @@ -10,13 +10,14 @@ # # pylint cannot import flask extension correctly -# pylint: disable=E0611,F0401 +# pylint: disable=no-name-in-module +# pylint: disable=import-error # # The forms here don't have specific methods, they just inherit them. -# pylint: disable=R0903 +# pylint: disable=too-few-public-methods # # We apparently use old style super in our __init__ -# pylint: disable=E1002 +# pylint: disable=super-on-old-class # # Couple of our forms do not even have __init__ -# pylint: disable=W0232 +# pylint: disable=no-init import flask_wtf as wtf diff --git a/pagure/ui/admin.py b/pagure/ui/admin.py index e458051..951c67f 100644 --- a/pagure/ui/admin.py +++ b/pagure/ui/admin.py @@ -8,8 +8,7 @@ """ -# no-member -# pylint: disable=E1101 +# pylint: disable=no-member from functools import wraps diff --git a/pagure/ui/app.py b/pagure/ui/app.py index 58133fa..071e5c1 100644 --- a/pagure/ui/app.py +++ b/pagure/ui/app.py @@ -24,7 +24,7 @@ from pagure import (APP, SESSION, login_required, # Application -# pylint: disable=E1101 +# pylint: disable=no-member @APP.route('/browse/projects', endpoint='browse_projects') diff --git a/pagure/ui/filters.py b/pagure/ui/filters.py index a32c774..e0a558b 100644 --- a/pagure/ui/filters.py +++ b/pagure/ui/filters.py @@ -8,12 +8,9 @@ """ -# too-many-branches -# pylint: disable=R0912 -# too-many-arguments -# pylint: disable=R0913 -# too-many-locals -# pylint: disable=R0914 +# pylint: disable=too-many-branches +# pylint: disable=too-many-arguments +# pylint: disable=too-many-locals import datetime diff --git a/pagure/ui/fork.py b/pagure/ui/fork.py index 8fe6cd4..6845a86 100644 --- a/pagure/ui/fork.py +++ b/pagure/ui/fork.py @@ -8,18 +8,14 @@ """ -# too-many-return-statements -# pylint: disable=R0911 -# too-many-branches -# pylint: disable=R0912 -# too-many-arguments -# pylint: disable=R0913 -# too-many-locals -# pylint: disable=R0914 -# too-many-statements -# pylint: disable=R0915 -# too-many-lines -# pylint: disable=C0302 +# pylint: disable=too-many-return-statements +# pylint: disable=too-many-branches +# pylint: disable=too-many-arguments +# pylint: disable=too-many-locals +# pylint: disable=too-many-statements +# pylint: disable=too-many-lines +# pylint: disable=no-member + import flask import os @@ -37,7 +33,6 @@ from pagure import (APP, SESSION, LOG, login_required, is_repo_admin, __get_file_in_tree) -# pylint: disable=E1101 def _get_parent_repo_path(repo): diff --git a/pagure/ui/groups.py b/pagure/ui/groups.py index c60caac..e3110fd 100644 --- a/pagure/ui/groups.py +++ b/pagure/ui/groups.py @@ -7,8 +7,8 @@ Pierre-Yves Chibon """ -# no-member -# pylint: disable=E1101 + +# pylint: disable=no-member import flask diff --git a/pagure/ui/issues.py b/pagure/ui/issues.py index 6652bab..e5436fa 100644 --- a/pagure/ui/issues.py +++ b/pagure/ui/issues.py @@ -8,16 +8,11 @@ """ -# no-member -# pylint: disable=E1101 -# too-many-lines -# pylint: disable=C0302 -# too-many-branches -# pylint: disable=R0912 -# too-many-locals -# pylint: disable=R0914 -# too-many-statements -# pylint: disable=R0915 +# pylint: disable=no-member +# pylint: disable=too-many-lines +# pylint: disable=too-many-branches +# pylint: disable=too-many-locals +# pylint: disable=too-many-statements import flask @@ -913,7 +908,7 @@ def upload_issue(repo, issueid, username=None): flask.g.fas_user.username)) form = pagure.forms.UploadFileForm() - # pylint: disable=E1101 + if form.validate_on_submit(): filestream = flask.request.files['filestream'] new_filename = pagure.lib.git.add_file_to_git( diff --git a/pagure/ui/login.py b/pagure/ui/login.py index accbd00..e9118c7 100644 --- a/pagure/ui/login.py +++ b/pagure/ui/login.py @@ -9,8 +9,7 @@ """ -# no-member -# pylint: disable=E1101 +# pylint: disable=no-member import datetime diff --git a/pagure/ui/plugins.py b/pagure/ui/plugins.py index 14e3c98..2c41394 100644 --- a/pagure/ui/plugins.py +++ b/pagure/ui/plugins.py @@ -8,10 +8,8 @@ """ -# too-many-branches -# pylint: disable=R0912 -# no-member -# pylint: disable=E1101 +# pylint: disable=too-many-branches +# pylint: disable=no-member import flask diff --git a/pagure/ui/repo.py b/pagure/ui/repo.py index 6fc7491..da6d644 100644 --- a/pagure/ui/repo.py +++ b/pagure/ui/repo.py @@ -8,20 +8,13 @@ """ -# no-member -# pylint: disable=E1101 -# too-many-lines -# pylint: disable=C0302 -# too-many-branches -# pylint: disable=R0912 -# too-many-locals -# pylint: disable=R0914 -# too-many-statements -# pylint: disable=R0915 -# bare-except -# pylint: disable=W0702 -# broad-except -# pylint: disable=W0703 +# pylint: disable=no-member +# pylint: disable=too-many-lines +# pylint: disable=too-many-branches +# pylint: disable=too-many-locals +# pylint: disable=too-many-statements +# pylint: disable=bare-except +# pylint: disable=broad-except import datetime diff --git a/tests/__init__.py b/tests/__init__.py index 6aec3f9..0d7ed46 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -131,7 +131,7 @@ class Modeltests(unittest.TestCase): self.gitrepo = None self.gitrepos = None - # pylint: disable=C0103 + # pylint: disable=invalid-name def setUp(self): """ Set up the environnment, ran before every tests. """ # Clean up eventual git repo left in the present folder. @@ -184,7 +184,7 @@ class Modeltests(unittest.TestCase): # Prevent unit-tests to send email, globally pagure.APP.config['EMAIL_SEND'] = False - # pylint: disable=C0103 + # pylint: disable=invalid-name def tearDown(self): """ Remove the test.db database if there is one. """ self.session.close() @@ -216,7 +216,7 @@ class FakeGroup(object): self.group_type = 'cla' -# pylint: disable=R0903 +# pylint: disable=too-few-public-methods class FakeUser(object): """ Fake user used to test the fedocallib library. """