コード例 #1
0
ファイル: utils.py プロジェクト: ConsultingMD/mlflow
def get_pylint_msg_ids():
    from pylint.constants import MSG_TYPES

    res = subprocess.run(["pylint", "--list-msgs"], stdout=subprocess.PIPE, check=True)
    stdout = res.stdout.decode("utf-8")
    letters = "".join(MSG_TYPES.keys())
    return set(re.findall(rf"\(([{letters}][0-9]{{4}})\)", stdout))
コード例 #2
0
 def open(self):
     """initialize counters"""
     self.stats = {"by_module": {}, "by_msg": {}}
     MANAGER.always_load_extensions = self.config.unsafe_load_any_extension
     MANAGER.max_inferable_values = self.config.limit_inference_results
     MANAGER.extension_package_whitelist.update(self.config.extension_pkg_whitelist)
     for msg_cat in MSG_TYPES.values():
         self.stats[msg_cat] = 0
コード例 #3
0
 def set_current_module(self, modname, filepath=None):
     """set the name of the currently analyzed module and
     init statistics for it
     """
     if not modname and filepath is None:
         return
     self.reporter.on_set_current_module(modname, filepath)
     self.current_name = modname
     self.current_file = filepath or modname
     self.stats["by_module"][modname] = {}
     self.stats["by_module"][modname]["statement"] = 0
     for msg_cat in MSG_TYPES.values():
         self.stats["by_module"][modname][msg_cat] = 0
コード例 #4
0
from pylint.lint import PyLinter
from pylint.message import MessageDefinition
from pylint.utils import get_rst_title

PYLINT_BASE_PATH = Path(__file__).resolve().parent.parent.parent
"""Base path to the project folder."""

PYLINT_MESSAGES_PATH = PYLINT_BASE_PATH / "doc/user_guide/messages"
"""Path to the messages documentation folder."""

PYLINT_MESSAGES_DATA_PATH = PYLINT_BASE_PATH / "doc" / "data" / "messages"
"""Path to the folder with data for the messages documentation."""

MSG_TYPES_DOC = {
    k: v if v != "info" else "information"
    for k, v in MSG_TYPES.items()
}


class MessageData(NamedTuple):
    checker: str
    id: str
    name: str
    definition: MessageDefinition
    good_code: str
    bad_code: str
    details: str
    related_links: str
    checker_module_name: str
    checker_module_path: str
    shared: bool = False