Skip to content

[per_dir_config] Moved option parsing outside of linter #1886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pylint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

def run_pylint():
"""run pylint"""
from pylint.lint import Run
from pylint.lint import CLIRunner
try:
Run(sys.argv[1:])
CLIRunner().run(sys.argv[1:])
except KeyboardInterrupt:
sys.exit(1)

Expand Down
22 changes: 11 additions & 11 deletions pylint/checkers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import tokenize
import warnings

from pylint.config import OptionsProviderMixIn
from pylint.reporters import diff_string
from pylint.utils import register_plugins
from pylint.interfaces import UNDEFINED
Expand All @@ -69,7 +68,7 @@ def table_lines_from_stats(stats, old_stats, columns):
return lines


class BaseChecker(OptionsProviderMixIn):
class BaseChecker(object):
"""base class for checkers"""
# checker name (you may reuse an existing one)
name = None
Expand All @@ -84,13 +83,9 @@ class BaseChecker(OptionsProviderMixIn):
# mark this checker as enabled or not.
enabled = True

def __init__(self, linter=None):
"""checker instances should have the linter as argument
priority = -1

linter is an object implementing ILinter
"""
self.name = self.name.lower()
OptionsProviderMixIn.__init__(self)
def __init__(self, linter=None):
self.linter = linter

def add_message(self, msg_id, line=None, node=None, args=None, confidence=UNDEFINED,
Expand All @@ -115,8 +110,13 @@ def process_tokens(self, tokens):
raise NotImplementedError()


def initialize(linter):
"""initialize linter with checkers in this package """
register_plugins(linter, __path__[0])
def initialize(registry):
"""Register the checkers in this package.

:param registry: The registry to register checkers with.
:type registry: PluginRegistry
"""
register_plugins(registry, __path__[0])


__all__ = ('BaseChecker', 'initialize')
Loading