doc/exts/pylint_extensions.py
def builder_inited(app):
    """Output full documentation in ReST format for all extension modules"""
    # PACKAGE/docs/exts/pylint_extensions.py --> PACKAGE/
    base_path = os.path.dirname(
        os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    )
    # PACKAGE/ --> PACKAGE/pylint/extensions
    ext_path = os.path.join(base_path, "pylint", "extensions")
    modules = []
    doc_files = {}
    for filename in os.listdir(ext_path):
        name, ext = os.path.splitext(filename)
        if name[0] == "_" or name in DEPRECATED_MODULES:
            continue
        if ext == ".py":
            modules.append("pylint.extensions.%s" % name)
        elif ext == ".rst":
            doc_files["pylint.extensions." + name] = os.path.join(ext_path, filename)
    modules.sort()
    if not modules:
        sys.exit("No Pylint extensions found?")

    linter = PyLinter()
    linter.load_plugin_modules(modules)

    extensions_doc = os.path.join(
        base_path, "doc", "technical_reference", "extensions.rst"
    )
    with open(extensions_doc, "w") as stream:
        stream.write("Optional Pylint checkers in the extensions module\n")
        stream.write("=================================================\n\n")
        stream.write("Pylint provides the following optional plugins:\n\n")
        for module in modules:
            stream.write("- :ref:`{}`\n".format(module))
        stream.write("\n")
        stream.write(
            "You can activate any or all of these extensions "
            "by adding a ``load-plugins`` line to the ``MASTER`` "
            "section of your ``.pylintrc``, for example::\n"
        )
        stream.write(
            "\n    load-plugins=pylint.extensions.docparams,"
            "pylint.extensions.docstyle\n\n"
        )
        by_module = get_plugins_info(linter, doc_files)
        for module, info in sorted(by_module.items()):
            linter._print_checker_doc(info["name"], info, stream=stream)
def builder_inited(app):
    """Output full documentation in ReST format for all extension modules"""
    # PACKAGE/docs/exts/pylint_extensions.py --> PACKAGE/
    base_path = os.path.dirname(
        os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    )
    # PACKAGE/ --> PACKAGE/pylint/extensions
    ext_path = os.path.join(base_path, "pylint", "extensions")
    modules = []
    doc_files = {}
    for filename in os.listdir(ext_path):
        name, ext = os.path.splitext(filename)
        if name[0] == "_" or name in DEPRECATED_MODULES:
            continue
        if ext == ".py":
            modules.append("pylint.extensions.%s" % name)
        elif ext == ".rst":
            doc_files["pylint.extensions." + name] = os.path.join(ext_path, filename)
    modules.sort()
    if not modules:
        sys.exit("No Pylint extensions found?")

    linter = PyLinter()
    linter.load_plugin_modules(modules)

    extensions_doc = os.path.join(
        base_path, "doc", "technical_reference", "extensions.rst"
    )
    with open(extensions_doc, "w") as stream:
        stream.write("Optional Pylint checkers in the extensions module\n")
        stream.write("=================================================\n\n")
        stream.write("Pylint provides the following optional plugins:\n\n")
        for module in modules:
            stream.write("- :ref:`{}`\n".format(module))
        stream.write("\n")
        stream.write(
            "You can activate any or all of these extensions "
            "by adding a ``load-plugins`` line to the ``MASTER`` "
            "section of your ``.pylintrc``, for example::\n"
        )
        stream.write(
            "\n    load-plugins=pylint.extensions.docparams,"
            "pylint.extensions.docstyle\n\n"
        )
        by_module = get_plugins_info(linter, doc_files)
        for module, info in sorted(by_module.items()):
            linter._print_checker_doc(info["name"], info, stream=stream)
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__ ) ) ) ) # PACKAGE/ --> PACKAGE/pylint/extensions ext_path = os . path . join ( base_path , "pylint" , "extensions" ) modules = [ ] doc_files = { } for filename in os . listdir ( ext_path ) : name , ext = os . path . splitext ( filename ) if name [ 0 ] == "_" or name in DEPRECATED_MODULES : continue if ext == ".py" : modules . append ( "pylint.extensions.%s" % name ) elif ext == ".rst" : doc_files [ "pylint.extensions." + name ] = os . path . join ( ext_path , filename ) modules . sort ( ) if not modules : sys . exit ( "No Pylint extensions found?" ) linter = PyLinter ( ) linter . load_plugin_modules ( modules ) extensions_doc = os . path . join ( base_path , "doc" , "technical_reference" , "extensions.rst" ) with open ( extensions_doc , "w" ) as stream : stream . write ( "Optional Pylint checkers in the extensions module\n" ) stream . write ( "=================================================\n\n" ) stream . write ( "Pylint provides the following optional plugins:\n\n" ) for module in modules : stream . write ( "- :ref:`{}`\n" . format ( module ) ) stream . write ( "\n" ) stream . write ( "You can activate any or all of these extensions " "by adding a ``load-plugins`` line to the ``MASTER`` " "section of your ``.pylintrc``, for example::\n" ) stream . write ( "\n    load-plugins=pylint.extensions.docparams," "pylint.extensions.docstyle\n\n" ) by_module = get_plugins_info ( linter , doc_files ) for module , info in sorted ( by_module . items ( ) ) : linter . _print_checker_doc ( info [ "name" ] , info , stream = stream )
Output full documentation in ReST format for all extension modules
Output full documentation in ReST format for all extension modules