summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Balint <balint.mihai@gmail.com>2015-02-28 17:13:21 +0200
committerMihai Balint <balint.mihai@gmail.com>2015-02-28 17:13:21 +0200
commitf0ad39a389c2ff9933f143f20c62e118c13b0b56 (patch)
tree80e9bfebcb55541711b16bddbbec060aa5c0af18
parentd76f63fc0429585bf759c8dd5e31e853d373245d (diff)
downloadpylint-f0ad39a389c2ff9933f143f20c62e118c13b0b56.tar.gz
start removing checks from disabled list, fix code to make sure these pass: C0102,C0112,C0121,C0202,C0203,C0204,C0301
-rw-r--r--pylint/checkers/format.py22
-rwxr-xr-xpylint/epylint.py3
-rw-r--r--pylint/lint.py12
-rw-r--r--pylintrc4
4 files changed, 25 insertions, 16 deletions
diff --git a/pylint/checkers/format.py b/pylint/checkers/format.py
index 6fd6491..8c496ac 100644
--- a/pylint/checkers/format.py
+++ b/pylint/checkers/format.py
@@ -353,21 +353,22 @@ class ContinuedLineState(object):
def _continuation_inside_bracket(self, bracket, pos):
"""Extracts indentation information for a continued indent."""
indentation = _get_indent_length(self._tokens.line(pos))
- if self._is_block_opener and self._tokens.start_col(pos+1) - indentation == self._block_indent_size:
+ token_start = self._tokens.start_col(pos)
+ next_token_start = self._tokens.start_col(pos + 1)
+ if self._is_block_opener and next_token_start - indentation == self._block_indent_size:
return _ContinuedIndent(
CONTINUED_BLOCK,
bracket,
pos,
- _Offsets(self._tokens.start_col(pos)),
- _BeforeBlockOffsets(self._tokens.start_col(pos+1),
- self._tokens.start_col(pos+1) + self._continuation_size))
+ _Offsets(token_start),
+ _BeforeBlockOffsets(next_token_start, next_token_start + self._continuation_size))
else:
return _ContinuedIndent(
CONTINUED,
bracket,
pos,
- _Offsets(self._tokens.start_col(pos)),
- _Offsets(self._tokens.start_col(pos+1)))
+ _Offsets(token_start),
+ _Offsets(next_token_start))
def pop_token(self):
self._cont_stack.pop()
@@ -442,7 +443,8 @@ class FormatChecker(BaseTokenChecker):
('expected-line-ending-format',
{'type': 'choice', 'metavar': '<empty or LF or CRLF>', 'default': '',
'choices': ['', 'LF', 'CRLF'],
- 'help': 'Expected format of line ending, e.g. empty (any line ending), LF or CRLF.'}),
+ 'help': ('Expected format of line ending, '
+ 'e.g. empty (any line ending), LF or CRLF.')}),
)
def __init__(self, linter=None):
@@ -796,10 +798,12 @@ class FormatChecker(BaseTokenChecker):
# check if line ending is as expected
expected = self.config.expected_line_ending_format
if expected:
- line_ending = reduce(lambda x, y: x + y if x != y else x, line_ending, "") # reduce multiple \n\n\n\n to one \n
+ # reduce multiple \n\n\n\n to one \n
+ line_ending = reduce(lambda x, y: x + y if x != y else x, line_ending, "")
line_ending = 'LF' if line_ending == '\n' else 'CRLF'
if line_ending != expected:
- self.add_message('unexpected-line-ending-format', args=(line_ending, expected), line=line_num)
+ self.add_message('unexpected-line-ending-format', args=(line_ending, expected),
+ line=line_num)
def _process_retained_warnings(self, tokens, current_pos):
diff --git a/pylint/epylint.py b/pylint/epylint.py
index 4fd683e..3d73ecd 100755
--- a/pylint/epylint.py
+++ b/pylint/epylint.py
@@ -1,4 +1,5 @@
-# -*- coding: utf-8; mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=python:et:sw=4:ts=4:sts=4
+# -*- coding: utf-8; mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4
+# -*- vim:fenc=utf-8:ft=python:et:sw=4:ts=4:sts=4
# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
# http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
diff --git a/pylint/lint.py b/pylint/lint.py
index 7274c78..2ebd733 100644
--- a/pylint/lint.py
+++ b/pylint/lint.py
@@ -217,7 +217,8 @@ if multiprocessing is not None:
try:
results_queue.put(result)
except Exception as ex:
- print("internal error with sending report for module %s" % file_or_module, file=sys.stderr)
+ print("internal error with sending report for module %s" %
+ file_or_module, file=sys.stderr)
print(ex, file=sys.stderr)
results_queue.put({})
@@ -630,7 +631,8 @@ class PyLinter(configuration.OptionsManagerMixIn,
except KeyError:
meth = self._bw_options_methods[opt]
# found a "(dis|en)able-msg" pragma deprecated suppresssion
- self.add_message('deprecated-pragma', line=start[0], args=(opt, opt.replace('-msg', '')))
+ self.add_message('deprecated-pragma', line=start[0],
+ args=(opt, opt.replace('-msg', '')))
for msgid in textutils.splitstrip(value):
# Add the line where a control pragma was encountered.
if opt in control_pragmas:
@@ -638,7 +640,8 @@ class PyLinter(configuration.OptionsManagerMixIn,
try:
if (opt, msgid) == ('disable', 'all'):
- self.add_message('deprecated-pragma', line=start[0], args=('disable=all', 'skip-file'))
+ self.add_message('deprecated-pragma', line=start[0],
+ args=('disable=all', 'skip-file'))
self.add_message('file-ignored', line=start[0])
self._ignore_file = True
return
@@ -830,7 +833,8 @@ class PyLinter(configuration.OptionsManagerMixIn,
self.current_file = ast_node.file # pylint: disable=maybe-no-member
self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
# warn about spurious inline messages handling
- for msgid, line, args in self.file_state.iter_spurious_suppression_messages(self.msgs_store):
+ spurious_messages = self.file_state.iter_spurious_suppression_messages(self.msgs_store)
+ for msgid, line, args in spurious_messages:
self.add_message(msgid, line, None, args)
# notify global end
self.stats['statement'] = walker.nbstatements
diff --git a/pylintrc b/pylintrc
index 876746b..5c0f487 100644
--- a/pylintrc
+++ b/pylintrc
@@ -28,7 +28,7 @@ include-ids=no
symbols=no
# Use multiple processes to speed up Pylint.
-jobs=1
+jobs=2
# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
@@ -60,7 +60,7 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
-disable=C0102,C0103,C0111,C0112,C0121,C0202,C0203,C0204,C0301,C0302,C0303,C0304,C0321,C0325,C0326,C0327,C0328,C0330,C0401,C0402,C0403,C1001,E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0106,E0107,E0108,E0109,E0110,E0111,E0202,E0203,E0211,E0213,E0221,E0222,E0235,E0236,E0237,E0238,E0239,E0601,E0602,E0603,E0604,E0611,E0701,E0702,E0710,E0711,E0712,E1001,E1002,E1003,E1004,E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1126,E1127,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303,E1304,E1305,E1306,E1310,E1601,E1602,E1603,E1604,E1605,E1606,E1607,E1608,F0001,F0002,F0003,F0010,F0202,F0220,F0401,I0001,I0010,I0011,I0012,I0013,I0020,I0021,I0022,R0201,R0401,R0801,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,R0921,R0922,R0923,W0101,W0102,W0104,W0105,W0106,W0107,W0108,W0109,W0110,W0120,W0122,W0123,W0141,W0142,W0150,W0199,W0201,W0211,W0212,W0221,W0222,W0223,W0231,W0232,W0233,W0234,W0301,W0311,W0312,W0332,W0401,W0402,W0403,W0404,W0406,W0410,W0511,W0512,W0601,W0602,W0603,W0604,W0611,W0612,W0613,W0614,W0621,W0622,W0623,W0631,W0632,W0633,W0640,W0702,W0703,W0704,W0710,W0711,W1001,W1111,W1201,W1202,W1300,W1301,W1302,W1303,W1304,W1305,W1306,W1307,W1401,W1402,W1501,W1502,W1503,W1504,W1601,W1602,W1603,W1604,W1605,W1606,W1607,W1608,W1609,W1610,W1611,W1612,W1613,W1614,W1615,W1616,W1617,W1618,W1619,W1620,W1621,W1622,W1623,W1624,W1625,W1626,W1627,W1628,W1629,W1630,W1632,W1633,W1634,W1635,W1636,W1637,W1638,W1639
+disable=C0103,C0111,C0302,C0303,C0304,C0321,C0325,C0326,C0327,C0328,C0330,C0401,C0402,C0403,C1001,E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0106,E0107,E0108,E0109,E0110,E0111,E0202,E0203,E0211,E0213,E0221,E0222,E0235,E0236,E0237,E0238,E0239,E0601,E0602,E0603,E0604,E0611,E0701,E0702,E0710,E0711,E0712,E1001,E1002,E1003,E1004,E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1126,E1127,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303,E1304,E1305,E1306,E1310,E1601,E1602,E1603,E1604,E1605,E1606,E1607,E1608,F0001,F0002,F0003,F0010,F0202,F0220,F0401,I0001,I0010,I0011,I0012,I0013,I0020,I0021,I0022,R0201,R0401,R0801,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,R0921,R0922,R0923,W0101,W0102,W0104,W0105,W0106,W0107,W0108,W0109,W0110,W0120,W0122,W0123,W0141,W0142,W0150,W0199,W0201,W0211,W0212,W0221,W0222,W0223,W0231,W0232,W0233,W0234,W0301,W0311,W0312,W0332,W0401,W0402,W0403,W0404,W0406,W0410,W0511,W0512,W0601,W0602,W0603,W0604,W0611,W0612,W0613,W0614,W0621,W0622,W0623,W0631,W0632,W0633,W0640,W0702,W0703,W0704,W0710,W0711,W1001,W1111,W1201,W1202,W1300,W1301,W1302,W1303,W1304,W1305,W1306,W1307,W1401,W1402,W1501,W1502,W1503,W1504,W1601,W1602,W1603,W1604,W1605,W1606,W1607,W1608,W1609,W1610,W1611,W1612,W1613,W1614,W1615,W1616,W1617,W1618,W1619,W1620,W1621,W1622,W1623,W1624,W1625,W1626,W1627,W1628,W1629,W1630,W1632,W1633,W1634,W1635,W1636,W1637,W1638,W1639
[REPORTS]