Commit 22d96a86 by Calen Pennington Committed by GitHub

Merge pull request #56 from edx/pin-pylint-version

Pin pylint and astroid versions
parents 38c5645a 5896c493
...@@ -4,7 +4,7 @@ from __future__ import print_function ...@@ -4,7 +4,7 @@ from __future__ import print_function
import pkg_resources import pkg_resources
def list_main(argv_unused): def list_main(argv_unused): # pylint: disable=unused-argument
""" """
list list
List the FILENAMEs that edx_lint can provide. List the FILENAMEs that edx_lint can provide.
......
...@@ -106,7 +106,7 @@ def write_main(argv): ...@@ -106,7 +106,7 @@ def write_main(argv):
# pkg_resources always reads binary data (in both python2 and python3). # pkg_resources always reads binary data (in both python2 and python3).
# ConfigParser.read_string only exists in python3, so we have to wrap the string # ConfigParser.read_string only exists in python3, so we have to wrap the string
# from pkg_resources in a cStringIO so that we can pass it into ConfigParser.readfp. # from pkg_resources in a cStringIO so that we can pass it into ConfigParser.readfp.
cfg.readfp(cStringIO(resource_string), resource_name) # pylint: disable=deprecated-method cfg.readfp(cStringIO(resource_string), resource_name)
if os.path.exists(tweaks_name): if os.path.exists(tweaks_name):
print("Applying local tweaks from %s" % tweaks_name) print("Applying local tweaks from %s" % tweaks_name)
......
...@@ -264,7 +264,8 @@ disable= ...@@ -264,7 +264,8 @@ disable=
bad-indentation, bad-indentation,
lowercase-l-suffix, lowercase-l-suffix,
unused-wildcard-import, unused-wildcard-import,
global-statement global-statement,
no-else-return,
# These are disabled by pylint by default # These are disabled by pylint by default
apply-builtin, apply-builtin,
......
...@@ -273,7 +273,8 @@ disable = ...@@ -273,7 +273,8 @@ disable =
bad-indentation, bad-indentation,
lowercase-l-suffix, lowercase-l-suffix,
unused-wildcard-import, unused-wildcard-import,
global-statement global-statement,
no-else-return,
apply-builtin, apply-builtin,
backtick, backtick,
...@@ -439,4 +440,4 @@ int-import-graph = ...@@ -439,4 +440,4 @@ int-import-graph =
[EXCEPTIONS] [EXCEPTIONS]
overgeneral-exceptions = Exception overgeneral-exceptions = Exception
# 6eb8ad6e6d8cfc8d0aaa08b832cbd7b957662448 # aebe69bb7440000dc1b4b9c5b162438a75e22d9d
git+https://github.com/cpennington/astroid.git@edx#egg=astroid pylint==1.7.1
git+https://github.com/PyCQA/pylint.git@master#egg=pylint astroid==1.5.2
pylint-django>=0.7.2,<1.0.0 pylint-django>=0.7.2,<1.0.0
pylint-celery==0.3 pylint-celery==0.3
six>=1.10.0,<2.0.0 six>=1.10.0,<2.0.0
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
import os import os
import unittest import unittest
import re
def load_tests(unused_loader, tests, unused_pattern): # pylint: disable=unused-argument
def load_tests(unused_loader, tests, unused_pattern):
"""Loads tests for the pylint test loader. """Loads tests for the pylint test loader.
This function is automatically run by pylint's test runner, and is called This function is automatically run by pylint's test runner, and is called
...@@ -13,7 +13,49 @@ def load_tests(unused_loader, tests, unused_pattern): ...@@ -13,7 +13,49 @@ def load_tests(unused_loader, tests, unused_pattern):
""" """
# Have to import this in the function, because the module does # Have to import this in the function, because the module does
# initialization on import! ugh. # initialization on import! ugh.
from pylint.testutils import make_tests, LintTestUsingFile, cb_test_gen, linter from pylint.testutils import LintTestUsingFile, linter, get_tests_info
# Inline functions that was deleted from pylint core
def cb_test_gen(base_class):
"""Inlined from pylint"""
def call(input_dir, msg_dir, module_file, messages_file, dependencies):
"""Inlined from pylint"""
class LintTC(base_class):
"""Inlined from pylint"""
module = module_file.replace('.py', '')
output = messages_file
depends = dependencies or None
INPUT_DIR = input_dir
MSG_DIR = msg_dir
return LintTC
return call
def make_tests(input_dir, msg_dir, filter_rgx, callbacks):
"""generate tests classes from test info
return the list of generated test classes
"""
if filter_rgx:
is_to_run = re.compile(filter_rgx).search
else:
is_to_run = lambda x: 1
tests = []
for module_file, messages_file in (
get_tests_info(input_dir, msg_dir, 'func_', '')
):
if not is_to_run(module_file) or module_file.endswith(('.pyc', "$py.class")):
continue
base = module_file.replace('func_', '').replace('.py', '')
dependencies = get_tests_info(input_dir, msg_dir, base, '.py')
for callback in callbacks:
test = callback(input_dir, msg_dir, module_file, messages_file,
dependencies)
if test:
tests.append(test)
return tests
# Load our plugin. # Load our plugin.
linter.load_plugin_modules(['edx_lint.pylint']) linter.load_plugin_modules(['edx_lint.pylint'])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment