aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVirgil Dupras <hsoft@hardcoded.net>2018-08-14 11:32:05 -0400
committerVirgil Dupras <hsoft@hardcoded.net>2018-08-14 11:32:05 -0400
commit8d0df18f0275376a5c7e6c133abaa99e7c05b737 (patch)
tree21a4c9131d67d3b180a165416fdbd2928d60a805
parentAdd (and fix) flake8 checks in tox (diff)
downloadgentoolkit-8d0df18f0275376a5c7e6c133abaa99e7c05b737.tar.gz
gentoolkit-8d0df18f0275376a5c7e6c133abaa99e7c05b737.tar.bz2
gentoolkit-8d0df18f0275376a5c7e6c133abaa99e7c05b737.zip
Remove pylint
As of now, pylint checks return a metric ton of warnings, which tells us that it hasn't been running lately. pylint is replaced by flake8 and its continuous run will enventually be ensured by a CI running tox on this project. The immediate goal, for now, is to have an easy command that checks as much as possible, but that *passes* so that we don't litter the project with more code that decrease quality.
-rw-r--r--README.dev10
-rw-r--r--pylintrc254
-rw-r--r--pym/gentoolkit/atom.py6
-rw-r--r--pym/gentoolkit/ekeyword/.pylintrc36
-rwxr-xr-xpym/gentoolkit/ekeyword/ekeyword.py1
-rwxr-xr-xpym/gentoolkit/ekeyword/ekeyword_unittest.py2
-rwxr-xr-xpym/gentoolkit/ekeyword/pylint49
-rw-r--r--pym/gentoolkit/enalyze/output.py6
-rw-r--r--pym/gentoolkit/equery/belongs.py2
-rw-r--r--pym/gentoolkit/equery/depends.py2
-rw-r--r--pym/gentoolkit/equery/files.py2
-rw-r--r--pym/gentoolkit/equery/meta.py6
-rw-r--r--pym/gentoolkit/helpers.py2
-rw-r--r--pym/gentoolkit/pprinter.py4
14 files changed, 5 insertions, 377 deletions
diff --git a/README.dev b/README.dev
index 5348867..e2df152 100644
--- a/README.dev
+++ b/README.dev
@@ -25,12 +25,12 @@ Adding or modifying code:
- If you add new code, best practice is to write a test for it.
- If you're modifying code that doesn't have a test and you can write a test
for it, please do.
-- Before committing your changes to a python file, please make sure it passes
- pylint with:
-pylint --rcfile=pylintrc yourfile.py
-- If pylint raises a warning or error that you don't agree with, it's probably
+- Before committing your changes, run "tox" to ensure that you didn't break
+ tests or introduced a flake8 error.
+- If flake8 raises a warning or error that you don't agree with, it's probably
better to just change your code. If you're sure you have a good reason for
- doing what you're doing, you can add an exception to our pylintrc.
+ doing what you're doing, you can add "# noqa" at the end of the line to
+ silence it.
Creating a release:
===================
diff --git a/pylintrc b/pylintrc
deleted file mode 100644
index dafdddb..0000000
--- a/pylintrc
+++ /dev/null
@@ -1,254 +0,0 @@
-# lint Python modules
-
-[MASTER]
-
-# Specify a configuration file.
-#rcfile=
-
-# Python code to execute, usually for sys.path manipulation such as
-# pygtk.require().
-#init-hook=
-
-# Profiled execution.
-profile=no
-
-# Add <file or directory> to the black list. It should be a base name, not a
-# path. You may set this option multiple times.
-ignore=CVS
-
-# Pickle collected data for later comparisons.
-persistent=yes
-
-# List of plugins (as comma separated values of python modules names) to load,
-# usually to register additional checkers.
-load-plugins=
-
-
-[MESSAGES CONTROL]
-
-# Enable the message, report, category or checker with the given id(s). You can
-# either give multiple identifier separated by comma (,) or put this option
-# multiple time.
-#enable=
-
-# Disable the message, report, category or checker with the given id(s). You
-# can either give multiple identifier separated by comma (,) or put this option
-# multiple time (only on the command line, not in the configuration file where
-# it should appear only once).
-#disable=
-# :W0704: *Except doesn't do anything*
-# :W0231: *__init__ method from base class %r is not called*
-# :R0903: *Too few public methods (%s/%s)*
-disable=W0704,W0231,R0903
-
-
-[REPORTS]
-
-# Set the output format. Available formats are text, parseable, colorized, msvs
-# (visual studio) and html
-# was output-format=text
-output-format=colorized
-
-# Include message's id in output
-# was include-ids=no
-include-ids=yes
-
-# Put messages in a separate file for each module / package specified on the
-# command line instead of printing them on stdout. Reports (if any) will be
-# written in a file name "pylint_global.[txt|html]".
-files-output=no
-
-# Tells whether to display a full report or only the messages
-reports=yes
-
-# Python expression which should return a note less than 10 (10 is the highest
-# note). You have access to the variables errors warning, statement which
-# respectively contain the number of errors / warnings messages and the total
-# number of statements analyzed. This is used by the global evaluation report
-# (RP0004).
-evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
-
-# Add a comment according to your evaluation note. This is used by the global
-# evaluation report (RP0004).
-comment=no
-
-
-[SIMILARITIES]
-
-# Minimum lines number of a similarity.
-min-similarity-lines=4
-
-# Ignore comments when computing similarities.
-ignore-comments=yes
-
-# Ignore docstrings when computing similarities.
-ignore-docstrings=yes
-
-
-[VARIABLES]
-
-# Tells whether we should check for unused import in __init__ files.
-init-import=no
-
-# A regular expression matching the beginning of the name of dummy variables
-# (i.e. not used).
-dummy-variables-rgx=_|dummy
-
-# List of additional names supposed to be defined in builtins. Remember that
-# you should avoid to define new builtins when possible.
-additional-builtins=
-
-
-[MISCELLANEOUS]
-
-# List of note tags to take in consideration, separated by a comma.
-notes=FIXME,XXX,TODO
-
-
-[TYPECHECK]
-
-# Tells whether missing members accessed in mixin class should be ignored. A
-# mixin class is detected if its name ends with "mixin" (case insensitive).
-ignore-mixin-members=yes
-
-# List of classes names for which member attributes should not be checked
-# (useful for classes with attributes dynamically set).
-ignored-classes=SQLObject
-
-# When zope mode is activated, add a predefined set of Zope acquired attributes
-# to generated-members.
-zope=no
-
-# List of members which are set dynamically and missed by pylint inference
-# system, and so shouldn't trigger E0201 when accessed.
-generated-members=REQUEST,acl_users,aq_parent
-
-
-[FORMAT]
-
-# Maximum number of characters on a single line.
-max-line-length=80
-
-# Maximum number of lines in a module
-max-module-lines=1000
-
-# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
-# tab).
-# was indent-string=' '
-indent-string="\t"
-
-
-[BASIC]
-
-# Required attributes for module, separated by a comma
-required-attributes=
-
-# List of builtins function names that should not be used, separated by a comma
-bad-functions=map,filter,apply,input
-
-# Regular expression which should only match correct module names
-module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
-
-# Regular expression which should only match correct module level names
-const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
-
-# Regular expression which should only match correct class names
-class-rgx=[A-Z_][a-zA-Z0-9]+$
-
-# Regular expression which should only match correct function names
-function-rgx=[a-z_][a-z0-9_]{2,30}$
-
-# Regular expression which should only match correct method names
-method-rgx=[a-z_][a-z0-9_]{2,30}$
-
-# Regular expression which should only match correct instance attribute names
-# was attr-rgx=[a-z_][a-z0-9_]{2,30}$
-attr-rgx=[a-z_][a-z0-9_]{1,30}$
-
-# Regular expression which should only match correct argument names
-# was argument-rgx=[a-z_][a-z0-9_]{2,30}$
-argument-rgx=[a-z_][a-z0-9_]{1,30}$
-
-# Regular expression which should only match correct variable names
-# was variable-rgx=[a-z_][a-z0-9_]{2,30}$
-variable-rgx=[a-z_][a-z0-9_]{1,30}$
-
-# Regular expression which should only match correct list comprehension /
-# generator expression variable names
-inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
-
-# Good variable names which should always be accepted, separated by a comma
-good-names=i,j,k,ex,Run,_
-
-# Bad variable names which should always be refused, separated by a comma
-bad-names=foo,bar,baz,toto,tutu,tata
-
-# Regular expression which should only match functions or classes name which do
-# not require a docstring
-# was no-docstring-rgx=__.*__
-no-docstring-rgx=_.*
-
-
-[IMPORTS]
-
-# Deprecated modules which should not be used, separated by a comma
-deprecated-modules=regsub,string,TERMIOS,Bastion,rexec
-
-# Create a graph of every (i.e. internal and external) dependencies in the
-# given file (report RP0402 must not be disabled)
-import-graph=
-
-# Create a graph of external dependencies in the given file (report RP0402 must
-# not be disabled)
-ext-import-graph=
-
-# Create a graph of internal dependencies in the given file (report RP0402 must
-# not be disabled)
-int-import-graph=
-
-
-[DESIGN]
-
-# Maximum number of arguments for function / method
-# was max-args=5
-max-args=10
-
-# Argument names that match this expression will be ignored. Default to name
-# with leading underscore
-ignored-argument-names=_.*
-
-# Maximum number of locals for function / method body
-max-locals=15
-
-# Maximum number of return / yield for function / method body
-# was max-returns=6
-max-returns=10
-
-# Maximum number of branch for function / method body
-max-branchs=12
-
-# Maximum number of statements in function / method body
-max-statements=50
-
-# Maximum number of parents for a class (see R0901).
-max-parents=7
-
-# Maximum number of attributes for a class (see R0902).
-# was max-attributes=7
-max-attributes=10
-
-# Minimum number of public methods for a class (see R0903).
-min-public-methods=2
-
-# Maximum number of public methods for a class (see R0904).
-max-public-methods=20
-
-
-[CLASSES]
-
-# List of interface methods to ignore, separated by a comma. This is used for
-# instance to not check methods defines in Zope's Interface base class.
-ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
-
-# List of method names used to declare (i.e. assign) instance attributes.
-defining-attr-methods=__init__,__new__,setUp
diff --git a/pym/gentoolkit/atom.py b/pym/gentoolkit/atom.py
index 7282fac..9d8a558 100644
--- a/pym/gentoolkit/atom.py
+++ b/pym/gentoolkit/atom.py
@@ -188,9 +188,6 @@ class Atom(portage.dep.Atom, CPV):
def __setattr__(self, name, value):
object.__setattr__(self, name, value)
- #R0911:121:Atom.intersects: Too many return statements (20/6)
- #R0912:121:Atom.intersects: Too many branches (23/12)
- # pylint: disable-msg=R0911,R0912
def intersects(self, other):
"""Check if a passed in package atom "intersects" this atom.
@@ -292,9 +289,6 @@ class Atom(portage.dep.Atom, CPV):
# If we get here at least one of us is a <, <=, > or >=:
if self.operator in ('<', '<=', '>', '>='):
- # pylint screwup:
- # E0601: Using variable 'ranged' before assignment
- # pylint: disable-msg=E0601
ranged, ranged.operator = self, self.operator
else:
ranged, ranged.operator = other, other.operator
diff --git a/pym/gentoolkit/ekeyword/.pylintrc b/pym/gentoolkit/ekeyword/.pylintrc
deleted file mode 100644
index cd5b31e..0000000
--- a/pym/gentoolkit/ekeyword/.pylintrc
+++ /dev/null
@@ -1,36 +0,0 @@
-[MESSAGES CONTROL]
-# Disable the message, report, category or checker with the given id(s). You
-# can either give multiple identifier separated by comma (,) or put this option
-# multiple times (only on the command line, not in the configuration file where
-# it should appear only once).
-disable=
- missing-docstring,
- too-many-lines,
- too-many-branches,
- too-many-statements,
- too-few-public-methods,
- too-many-instance-attributes,
- too-many-public-methods,
- too-many-locals,
- too-many-arguments,
- locally-enabled,
- locally-disabled,
- fixme,
- bad-continuation,
- invalid-name,
-
-[REPORTS]
-reports=no
-
-[FORMAT]
-max-line-length=80
-indent-string='\t'
-
-[SIMILARITIES]
-min-similarity-lines=20
-
-[VARIABLES]
-dummy-variables-rgx=_
-
-[DESIGN]
-max-parents=10
diff --git a/pym/gentoolkit/ekeyword/ekeyword.py b/pym/gentoolkit/ekeyword/ekeyword.py
index af37a9a..a1910ee 100755
--- a/pym/gentoolkit/ekeyword/ekeyword.py
+++ b/pym/gentoolkit/ekeyword/ekeyword.py
@@ -343,7 +343,6 @@ def process_ebuild(ebuild, ops, arch_status=None, verbose=0, quiet=0,
def portage_settings():
"""Return the portage settings we care about."""
# Portage creates the db member on the fly which confuses the linter.
- # pylint: disable=no-member
return portage.db['/']['vartree'].settings
diff --git a/pym/gentoolkit/ekeyword/ekeyword_unittest.py b/pym/gentoolkit/ekeyword/ekeyword_unittest.py
index de40e7a..5e66afe 100755
--- a/pym/gentoolkit/ekeyword/ekeyword_unittest.py
+++ b/pym/gentoolkit/ekeyword/ekeyword_unittest.py
@@ -3,8 +3,6 @@
# Distributed under the terms of the GNU General Public License v2
# Written by Mike Frysinger <vapier@gentoo.org>
-# pylint: disable=no-self-use
-
"""Unittests for ekeyword"""
from __future__ import print_function
diff --git a/pym/gentoolkit/ekeyword/pylint b/pym/gentoolkit/ekeyword/pylint
deleted file mode 100755
index 3a9a368..0000000
--- a/pym/gentoolkit/ekeyword/pylint
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-"""Run pylint with the right settings."""
-
-from __future__ import print_function
-
-import os
-import sys
-
-
-def find_all_modules(source_root):
- """Locate all python modules in the tree for scanning"""
- ret = []
-
- for root, _dirs, files in os.walk(source_root, topdown=False):
- # Add all of the .py modules in the tree.
- ret += [os.path.join(root, x) for x in files if x.endswith('.py')]
-
- # Add the main scripts that don't end in .py.
- ret += [os.path.join(source_root, x) for x in ('pylint',)]
-
- return ret
-
-
-def main(argv):
- """The main entry point"""
- source_root = os.path.dirname(os.path.realpath(__file__))
-
- if not argv:
- argv = find_all_modules(source_root)
-
- pympath = source_root
- pythonpath = os.environ.get('PYTHONPATH')
- if pythonpath is None:
- pythonpath = pympath
- else:
- pythonpath = pympath + ':' + pythonpath
- os.environ['PYTHONPATH'] = pythonpath
-
- pylintrc = os.path.join(source_root, '.pylintrc')
- cmd = ['pylint', '--rcfile', pylintrc]
- os.execvp(cmd[0], cmd + argv)
-
-
-if __name__ == '__main__':
- sys.exit(main(sys.argv[1:]))
diff --git a/pym/gentoolkit/enalyze/output.py b/pym/gentoolkit/enalyze/output.py
index fd7affa..3d63394 100644
--- a/pym/gentoolkit/enalyze/output.py
+++ b/pym/gentoolkit/enalyze/output.py
@@ -95,8 +95,6 @@ class AnalysisPrinter(CpvValueWrapper):
cpv = _pkgs.pop(0)
print(' '*52 + pp.cpv(cpv))
- # W0613: *Unused argument %r*
- # pylint: disable-msg=W0613
def print_use_quiet(self, key, active, default, count, pkgs):
"""Quietly prints a subset set of USE flag info..
"""
@@ -120,8 +118,6 @@ class AnalysisPrinter(CpvValueWrapper):
cpv = _pkgs.pop(0)
print(' '*37 + pp.cpv(cpv))
- # W0613: *Unused argument %r*
- # pylint: disable-msg=W0613
def print_keyword_quiet(self, key, stability, default, count, pkgs):
"""Quietly prints a subset set of USE flag info..
"""
@@ -129,8 +125,6 @@ class AnalysisPrinter(CpvValueWrapper):
hard_masked=stability=="-"))
print(self.prepend + _key,'.'*(20-len(key)), default, pp.number(count))
- # W0613: *Unused argument %r*
- # pylint: disable-msg=W0613
def _format_pkg(self, key, active, flags):
"""Determines the stats for key, formats it and
calls the pre-determined print function
diff --git a/pym/gentoolkit/equery/belongs.py b/pym/gentoolkit/equery/belongs.py
index 7c20658..8c16b89 100644
--- a/pym/gentoolkit/equery/belongs.py
+++ b/pym/gentoolkit/equery/belongs.py
@@ -54,8 +54,6 @@ class BelongsPrinter(object):
def __call__(self, pkg, cfile):
self.print_fn(pkg, cfile)
- # W0613: *Unused argument %r*
- # pylint: disable-msg=W0613
def print_quiet(self, pkg, cfile):
"Format for minimal output."
if self.name_only:
diff --git a/pym/gentoolkit/equery/depends.py b/pym/gentoolkit/equery/depends.py
index 93c2137..8ffc745 100644
--- a/pym/gentoolkit/equery/depends.py
+++ b/pym/gentoolkit/equery/depends.py
@@ -58,8 +58,6 @@ class DependPrinter(object):
pp.uprint(indent + pp.cpv(cpv), "(" + use_conditional +
sep + depatom + ")")
- # W0613: *Unused argument %r*
- # pylint: disable-msg=W0613
@staticmethod
def print_quiet(indent, cpv, use_conditional, depatom):
"""Quietly prints a subset set of dep strings."""
diff --git a/pym/gentoolkit/equery/files.py b/pym/gentoolkit/equery/files.py
index 9ef87cf..10c7fde 100644
--- a/pym/gentoolkit/equery/files.py
+++ b/pym/gentoolkit/equery/files.py
@@ -77,8 +77,6 @@ def print_help(with_description=True):
print(" " * 24, ', '.join(pp.emph(x) for x in FILTER_RULES))
-# R0912: *Too many branches (%s/%s)*
-# pylint: disable-msg=R0912
def display_files(contents):
"""Display the content of an installed package.
diff --git a/pym/gentoolkit/equery/meta.py b/pym/gentoolkit/equery/meta.py
index 81da14b..d08ab23 100644
--- a/pym/gentoolkit/equery/meta.py
+++ b/pym/gentoolkit/equery/meta.py
@@ -31,10 +31,6 @@ from gentoolkit.query import Query
# Globals
# =======
-# E1101: Module 'portage.output' has no $color member
-# portage.output creates color functions dynamically
-# pylint: disable-msg=E1101
-
QUERY_OPTS = {
'current': False,
'description': False,
@@ -293,8 +289,6 @@ def format_homepage(homepage):
return result
-# R0912: *Too many branches (%s/%s)*
-# pylint: disable-msg=R0912
def call_format_functions(best_match, matches):
"""Call information gathering functions and display the results."""
diff --git a/pym/gentoolkit/helpers.py b/pym/gentoolkit/helpers.py
index 8993fed..40235d5 100644
--- a/pym/gentoolkit/helpers.py
+++ b/pym/gentoolkit/helpers.py
@@ -414,8 +414,6 @@ def get_cpvs(predicate=None, include_installed=True):
yield cpv
-# pylint thinks this is a global variable
-# pylint: disable-msg=C0103
get_uninstalled_cpvs = partial(get_cpvs, include_installed=False)
diff --git a/pym/gentoolkit/pprinter.py b/pym/gentoolkit/pprinter.py
index 83f4859..610d72a 100644
--- a/pym/gentoolkit/pprinter.py
+++ b/pym/gentoolkit/pprinter.py
@@ -44,10 +44,6 @@ from portage import archlist
# Functions
# =========
-# output creates color functions on the fly, which confuses pylint.
-# E1101: *%s %r has no %r member*
-# pylint: disable-msg=E1101
-
def command(string):
"""Returns a program command string."""
return output.green(string)