How to use doc8 - 10 common examples

To help you get started, we’ve selected a few doc8 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PyCQA / doc8 / doc8 / __main__.py View on Github external
# a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

import sys

from doc8 import main


sys.exit(main.main())
github PyCQA / doc8 / doc8 / main.py View on Github external
def fetch_checks(cfg):
    base = [
        checks.CheckValidity(cfg),
        checks.CheckTrailingWhitespace(cfg),
        checks.CheckIndentationNoTab(cfg),
        checks.CheckCarriageReturn(cfg),
        checks.CheckMaxLineLength(cfg),
        checks.CheckNewlineEndOfFile(cfg),
    ]
    mgr = extension.ExtensionManager(
        namespace="doc8.extension.check", invoke_on_load=True, invoke_args=(cfg.copy(),)
    )
    addons = []
    for e in mgr:
        addons.append(e.obj)
    return base + addons
github PyCQA / doc8 / doc8 / checks.py View on Github external
def __init__(self, cfg):
        super(CheckMaxLineLength, self).__init__(cfg)
        self._max_line_length = self._cfg["max_line_length"]
        self._allow_long_titles = self._cfg["allow_long_titles"]
github PyCQA / doc8 / doc8 / main.py View on Github external
def fetch_checks(cfg):
    base = [
        checks.CheckValidity(cfg),
        checks.CheckTrailingWhitespace(cfg),
        checks.CheckIndentationNoTab(cfg),
        checks.CheckCarriageReturn(cfg),
        checks.CheckMaxLineLength(cfg),
        checks.CheckNewlineEndOfFile(cfg),
    ]
    mgr = extension.ExtensionManager(
        namespace="doc8.extension.check", invoke_on_load=True, invoke_args=(cfg.copy(),)
    )
    addons = []
    for e in mgr:
        addons.append(e.obj)
    return base + addons
github PyCQA / doc8 / doc8 / checks.py View on Github external
def __init__(self, cfg):
        super(CheckNewlineEndOfFile, self).__init__(cfg)
github PyCQA / doc8 / doc8 / checks.py View on Github external
def __init__(self, cfg):
        super(CheckValidity, self).__init__(cfg)
        self._sphinx_mode = cfg.get("sphinx")
github PyCQA / doc8 / doc8 / main.py View on Github external
def fetch_checks(cfg):
    base = [
        checks.CheckValidity(cfg),
        checks.CheckTrailingWhitespace(cfg),
        checks.CheckIndentationNoTab(cfg),
        checks.CheckCarriageReturn(cfg),
        checks.CheckMaxLineLength(cfg),
        checks.CheckNewlineEndOfFile(cfg),
    ]
    mgr = extension.ExtensionManager(
        namespace="doc8.extension.check", invoke_on_load=True, invoke_args=(cfg.copy(),)
    )
    addons = []
    for e in mgr:
        addons.append(e.obj)
    return base + addons
github PyCQA / doc8 / doc8 / main.py View on Github external
try:
                reports = set(c.REPORTS)
            except AttributeError:
                pass
            else:
                reports = reports - targeted_ignoreables
                if not reports:
                    if cfg.get("verbose"):
                        print(
                            "  Skipping check '%s', determined to only"
                            " check ignoreable codes" % check_name
                        )
                    continue
            if cfg.get("verbose"):
                print("  Running check '%s'" % check_name)
            if isinstance(c, checks.ContentCheck):
                for line_num, code, message in c.report_iter(f):
                    if code in targeted_ignoreables:
                        continue
                    if not isinstance(line_num, (float, int)):
                        line_num = "?"
                    if cfg.get("verbose"):
                        print(
                            "    - %s:%s: %s %s" % (f.filename, line_num, code, message)
                        )
                    else:
                        print("%s:%s: %s %s" % (f.filename, line_num, code, message))
                    error_counts[check_name] += 1
            elif isinstance(c, checks.LineCheck):
                for line_num, line in enumerate(f.lines_iter(), 1):
                    for code, message in c.report_iter(line):
                        if code in targeted_ignoreables:
github PyCQA / doc8 / doc8 / main.py View on Github external
if cfg.get("verbose"):
                print("  Running check '%s'" % check_name)
            if isinstance(c, checks.ContentCheck):
                for line_num, code, message in c.report_iter(f):
                    if code in targeted_ignoreables:
                        continue
                    if not isinstance(line_num, (float, int)):
                        line_num = "?"
                    if cfg.get("verbose"):
                        print(
                            "    - %s:%s: %s %s" % (f.filename, line_num, code, message)
                        )
                    else:
                        print("%s:%s: %s %s" % (f.filename, line_num, code, message))
                    error_counts[check_name] += 1
            elif isinstance(c, checks.LineCheck):
                for line_num, line in enumerate(f.lines_iter(), 1):
                    for code, message in c.report_iter(line):
                        if code in targeted_ignoreables:
                            continue
                        if cfg.get("verbose"):
                            print(
                                "    - %s:%s: %s %s"
                                % (f.filename, line_num, code, message)
                            )
                        else:
                            print(
                                "%s:%s: %s %s" % (f.filename, line_num, code, message)
                            )
                        error_counts[check_name] += 1
            else:
                raise TypeError("Unknown check type: %s, %s" % (type(c), c))
github PyCQA / doc8 / doc8 / main.py View on Github external
def fetch_checks(cfg):
    base = [
        checks.CheckValidity(cfg),
        checks.CheckTrailingWhitespace(cfg),
        checks.CheckIndentationNoTab(cfg),
        checks.CheckCarriageReturn(cfg),
        checks.CheckMaxLineLength(cfg),
        checks.CheckNewlineEndOfFile(cfg),
    ]
    mgr = extension.ExtensionManager(
        namespace="doc8.extension.check", invoke_on_load=True, invoke_args=(cfg.copy(),)
    )
    addons = []
    for e in mgr:
        addons.append(e.obj)
    return base + addons