def __call__( self, parser: argparse.ArgumentParser, namespace: argparse.Namespace, values: Union[str, Sequence[Any], None], option_string: Optional[str] = "--full-documentation", ) -> None: utils.print_full_documentation(self.run.linter) sys.exit(0)
def __call__( self, parser: argparse.ArgumentParser, namespace: argparse.Namespace, values: str | Sequence[Any] | None, option_string: str | None = "--full-documentation", ) -> None: utils.print_full_documentation(self.run.linter) sys.exit(0)
def builder_inited(app): # PACKAGE/docs/exts/pylint_extensions.py --> PACKAGE/ base_path = os.path.dirname( os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) linter = PyLinter() linter.load_default_plugins() features = os.path.join(base_path, "doc", "technical_reference", "features.rst") with open(features, "w") as stream: stream.write("Pylint features\n") stream.write("===============\n\n") stream.write(".. generated by pylint --full-documentation\n\n") print_full_documentation(linter, stream)
def test_full_documentation(linter: PyLinter) -> None: out = StringIO() print_full_documentation(linter, out) output = out.getvalue() # A few spot checks only for re_str in ( # auto-generated text "^Pylint global options and switches$", "Verbatim name of the checker is ``variables``", # messages "^:undefined-loop-variable \\(W0631\\): *", # options "^:dummy-variables-rgx:", ): regexp = re.compile(re_str, re.MULTILINE) assert re.search(regexp, output)
def builder_inited(app: Optional[Sphinx]) -> None: # PACKAGE/docs/exts/pylint_extensions.py --> PACKAGE/ base_path = os.path.dirname( os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) linter = PyLinter() linter.load_default_plugins() features = os.path.join(base_path, "doc", "user_guide", "checkers", "features.rst") with open(features, "w", encoding="utf-8") as stream: stream.write(get_rst_title("Pylint features", "=")) stream.write(""" .. This file is auto-generated. Make any changes to the associated .. docs extension in 'doc/exts/pylint_features.py'. """) print_full_documentation(linter, stream, False)
def cb_full_documentation(self, option, optname, value, parser): """optik callback for printing full documentation""" print_full_documentation(self.linter) sys.exit(0)