Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(369)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/python_unittest.py

Issue 2010173003: Enable pylint warnings on presubmit checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update unit test, pylintrc, and remove unused argument lines. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) 1 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org)
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions 4 # modification, are permitted provided that the following conditions
5 # are met: 5 # are met:
6 # 1. Redistributions of source code must retain the above copyright 6 # 1. Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # 2. Redistributions in binary form must reproduce the above copyright 8 # 2. Redistributions in binary form must reproduce the above copyright
9 # notice, this list of conditions and the following disclaimer in the 9 # notice, this list of conditions and the following disclaimer in the
10 # documentation and/or other materials provided with the distribution. 10 # documentation and/or other materials provided with the distribution.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 def _mock_handle_style_error(line_number, category, confidence, 50 def _mock_handle_style_error(line_number, category, confidence,
51 message): 51 message):
52 error = (line_number, category, confidence, message) 52 error = (line_number, category, confidence, message)
53 errors.append(error) 53 errors.append(error)
54 54
55 current_dir = os.path.dirname(__file__) 55 current_dir = os.path.dirname(__file__)
56 file_path = os.path.join(current_dir, "python_unittest_input.py") 56 file_path = os.path.join(current_dir, "python_unittest_input.py")
57 57
58 checker = PythonChecker(file_path, _mock_handle_style_error) 58 checker = PythonChecker(file_path, _mock_handle_style_error)
59 checker.check(lines=[]) 59 checker.check()
60 60
61 self.assertEqual(errors, [ 61 print errors
62 (4, "pep8/W291", 5, "trailing whitespace"), 62
63 (4, "pylint/E1601(print-statement)", 5, "[] print statement used"), 63 self.assertEqual(
64 (4, "pylint/E0602(undefined-variable)", 5, "[] Undefined variable 'e rror'"), 64 [
65 ]) 65 (2, 'pep8/W291', 5, 'trailing whitespace'),
66 (3, 'pep8/E261', 5, 'at least two spaces before inline comment') ,
67 (3, 'pep8/E262', 5, "inline comment should start with '# '"),
68 (2, 'pylint/C0303(trailing-whitespace)', 5, '[] Trailing whitesp ace'),
qyearsley 2016/05/29 21:00:33 Note that pylint and pep8 both print warnings abou
69 (2, 'pylint/E1601(print-statement)', 5, '[] print statement used '),
70 (2, 'pylint/E0602(undefined-variable)', 5, u"[] Undefined variab le 'error'"),
71 (3, 'pylint/W0611(unused-import)', 5, '[] Unused import math'),
qyearsley 2016/05/29 21:00:33 After this CL, warnings about unused imports etc.
72 ],
73 errors)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698