summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Nowikowski <godfryd@gmail.com>2014-07-25 17:55:29 +0200
committerMichal Nowikowski <godfryd@gmail.com>2014-07-25 17:55:29 +0200
commit5fcc617e122508512b3dc40921f1d56fc53c355f (patch)
treeb5fdab549848f3253c40b90c3cce6e69db35777b
parent48dbb9e19ecd4f38fef6570498898cf529556577 (diff)
downloadpylint-5fcc617e122508512b3dc40921f1d56fc53c355f.tar.gz
backout of 85a5e49
-rw-r--r--checkers/format.py34
-rw-r--r--test/functional/line_endings.args2
-rw-r--r--test/functional/line_endings.py4
-rw-r--r--test/functional/line_endings.txt0
4 files changed, 3 insertions, 37 deletions
diff --git a/checkers/format.py b/checkers/format.py
index 858dff7..c07ff32 100644
--- a/checkers/format.py
+++ b/checkers/format.py
@@ -104,13 +104,7 @@ MSGS = {
'bracket or block opener.'),
{'old_names': [('C0323', 'no-space-after-operator'),
('C0324', 'no-space-after-comma'),
- ('C0322', 'no-space-before-operator')]}),
- 'C0327': ('Mixed line endings LF and CRLF',
- 'mixed-line-endings',
- 'Used when there are mixed (LF and CRLF) newline signs in a file.'),
- 'C0328': ('Unexpected line ending format. There is \'%s\' while it should be \'%s\'.',
- 'unexpected-line-ending-format',
- 'Used when there is different newline sign than expected.'),
+ ('C0322', 'no-space-before-operator')]})
}
@@ -153,7 +147,7 @@ def _column_distance(token1, token2):
def _last_token_on_line_is(tokens, line_end, token):
return (
line_end > 0 and tokens.token(line_end-1) == token or
- line_end > 1 and tokens.token(line_end-2) == token
+ line_end > 1 and tokens.token(line_end-2) == token
and tokens.type(line_end-1) == tokenize.COMMENT)
@@ -453,10 +447,6 @@ class FormatChecker(BaseTokenChecker):
{'type': 'int', 'metavar': '<int>', 'default': 4,
'help': 'Number of spaces of indent required inside a hanging '
' or continued line.'}),
- ('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.'}),
)
def __init__(self, linter=None):
@@ -464,7 +454,6 @@ class FormatChecker(BaseTokenChecker):
self._lines = None
self._visited_lines = None
self._bracket_stack = [None]
- self._last_line_ending = None
def _pop_token(self):
self._bracket_stack.pop()
@@ -742,7 +731,7 @@ class FormatChecker(BaseTokenChecker):
self.new_line(TokenWrapper(tokens), idx-1, idx+1)
else:
self.new_line(TokenWrapper(tokens), idx-1, idx)
-
+
if tok_type == tokenize.NEWLINE:
# a program statement, or ENDMARKER, will eventually follow,
# after some (possibly empty) run of tokens of the form
@@ -752,7 +741,6 @@ class FormatChecker(BaseTokenChecker):
check_equal = True
self._process_retained_warnings(TokenWrapper(tokens), idx)
self._current_line.next_logical_line()
- self._check_line_ending(token, line_num)
elif tok_type == tokenize.INDENT:
check_equal = False
self.check_indent_level(token, indents[-1]+1, line_num)
@@ -794,22 +782,6 @@ class FormatChecker(BaseTokenChecker):
if line_num > self.config.max_module_lines:
self.add_message('too-many-lines', args=line_num, line=1)
- def _check_line_ending(self, line_ending, line_num):
- # check if line endings are mixed
- if self._last_line_ending is not None:
- if line_ending != self._last_line_ending:
- self.add_message('mixed-line-endings', line=line_num)
-
- self._last_line_ending = line_ending
-
- # check if line ending is as expected
- expected = self.config.expected_line_ending_format
- if expected:
- 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)
-
-
def _process_retained_warnings(self, tokens, current_pos):
single_line_block_stmt = not _last_token_on_line_is(tokens, current_pos, ':')
diff --git a/test/functional/line_endings.args b/test/functional/line_endings.args
deleted file mode 100644
index 95532ea..0000000
--- a/test/functional/line_endings.args
+++ /dev/null
@@ -1,2 +0,0 @@
-[Format]
-expected-line-ending-format=LF
diff --git a/test/functional/line_endings.py b/test/functional/line_endings.py
deleted file mode 100644
index c8c7141..0000000
--- a/test/functional/line_endings.py
+++ /dev/null
@@ -1,4 +0,0 @@
-"mixing line endings are not welcome"
-
-CONST = 1
-
diff --git a/test/functional/line_endings.txt b/test/functional/line_endings.txt
deleted file mode 100644
index e69de29..0000000
--- a/test/functional/line_endings.txt
+++ /dev/null