All Projects → PyCQA → Doc8

PyCQA / Doc8

Licence: apache-2.0
Style checker for sphinx (or other) rst documentation.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Doc8

Tlint
Tighten linter for Laravel conventions
Stars: ✭ 274 (+160.95%)
Mutual labels:  linter, hacktoberfest
Clusterlint
A best practices checker for Kubernetes clusters. 🤠
Stars: ✭ 409 (+289.52%)
Mutual labels:  linter, hacktoberfest
Coala Bears
Bears for coala
Stars: ✭ 276 (+162.86%)
Mutual labels:  linter, hacktoberfest
Editorconfig Checker
A tool to verify that your files are in harmony with your .editorconfig
Stars: ✭ 119 (+13.33%)
Mutual labels:  linter, hacktoberfest
Pyflakes
A simple program which checks Python source files for errors
Stars: ✭ 991 (+843.81%)
Mutual labels:  linter, hacktoberfest
Spotbugs
SpotBugs is FindBugs' successor. A tool for static analysis to look for bugs in Java code.
Stars: ✭ 2,569 (+2346.67%)
Mutual labels:  linter, hacktoberfest
Verible
Verible is a suite of SystemVerilog developer tools, including a parser, style-linter, and formatter.
Stars: ✭ 384 (+265.71%)
Mutual labels:  linter, hacktoberfest
Isort
A Python utility / library to sort imports.
Stars: ✭ 4,377 (+4068.57%)
Mutual labels:  linter, hacktoberfest
Go Critic
The most opinionated Go source code linter for code audit.
Stars: ✭ 875 (+733.33%)
Mutual labels:  linter, hacktoberfest
Super Linter
Combination of multiple linters to install as a GitHub Action
Stars: ✭ 7,445 (+6990.48%)
Mutual labels:  linter, hacktoberfest
Abaplint
Standalone linter for ABAP
Stars: ✭ 111 (+5.71%)
Mutual labels:  linter, hacktoberfest
Vscode Gremlins
Gremlins tracker for Visual Studio Code: reveals invisible whitespace and other annoying characters
Stars: ✭ 78 (-25.71%)
Mutual labels:  linter, hacktoberfest
Wemake Python Styleguide
The strictest and most opinionated python linter ever!
Stars: ✭ 1,714 (+1532.38%)
Mutual labels:  linter, hacktoberfest
Revive
🔥 ~6x faster, stricter, configurable, extensible, and beautiful drop-in replacement for golint
Stars: ✭ 3,139 (+2889.52%)
Mutual labels:  linter, hacktoberfest
Undercover
Actionable code coverage - detects untested code blocks in recent changes
Stars: ✭ 574 (+446.67%)
Mutual labels:  linter, hacktoberfest
Psscriptanalyzer
Download ScriptAnalyzer from PowerShellGallery
Stars: ✭ 1,137 (+982.86%)
Mutual labels:  linter, hacktoberfest
Rubberduck
Every programmer needs a rubberduck. COM add-in for the VBA & VB6 IDE (VBE).
Stars: ✭ 1,287 (+1125.71%)
Mutual labels:  linter, hacktoberfest
Vagrant Librarian Puppet
A Vagrant plugin to install Puppet modules using Librarian-Puppet.
Stars: ✭ 104 (-0.95%)
Mutual labels:  hacktoberfest
Json Against Humanity
Finally, Cards Against Humanity as plain text and JSON.
Stars: ✭ 105 (+0%)
Mutual labels:  hacktoberfest
Libmtev
Mount Everest Application Framework
Stars: ✭ 104 (-0.95%)
Mutual labels:  hacktoberfest

.. image:: https://img.shields.io/pypi/v/doc8 :alt: PyPI :target: https://pypi.org/project/doc8/

.. image:: https://github.com/PyCQA/doc8/workflows/tox/badge.svg :target: https://github.com/PyCQA/doc8/actions :alt: CI

.. image:: https://img.shields.io/pypi/l/doc8 :alt: PyPI - License

.. image:: https://img.shields.io/github/last-commit/pycqa/doc8 :alt: GitHub last commit

==== doc8

doc8 is an opinionated style checker for rst__ (with basic support for plain text) styles of documentation.

__ http://docutils.sourceforge.net/docs/ref/rst/introduction.html

Quick start

::

pip install doc8

To run doc8, just invoke it against any documentation directory::

$ doc8 cool-project/docs

Usage

::

$ doc8  -h

usage: doc8 [-h] [--config path] [--allow-long-titles] [--ignore code]
            [--no-sphinx] [--ignore-path path] [--ignore-path-errors path]
            [--default-extension extension] [--file-encoding encoding]
            [--max-line-length int] [-e extension] [-v] [--version]
            [path [path ...]]

Check documentation for simple style requirements.

What is checked:
    - invalid RST format - D000
    - lines should not be longer than 79 characters - D001
      - RST exception: line with no whitespace except in the beginning
      - RST exception: lines with http or https urls
      - RST exception: literal blocks
      - RST exception: rst target directives
    - no trailing whitespace - D002
    - no tabulation for indentation - D003
    - no carriage returns (use unix newlines) - D004
    - no newline at end of file - D005

positional arguments:
  path                  Path to scan for doc files (default: current
                        directory).

optional arguments:
  -h, --help            show this help message and exit
  --config path         user config file location (default: doc8.ini, tox.ini,
                        pep8.ini, setup.cfg).
  --allow-long-titles   allow long section titles (default: false).
  --ignore code         ignore the given error code(s).
  --no-sphinx           do not ignore sphinx specific false positives.
  --ignore-path path    ignore the given directory or file (globs are
                        supported).
  --ignore-path-errors path
                        ignore the given specific errors in the provided file.
  --default-extension extension
                        default file extension to use when a file is found
                        without a file extension.
  --file-encoding encoding
                        set input files text encoding
  --max-line-length int
                        maximum allowed line length (default: 79).
  -e extension, --extension extension
                        check file extensions of the given type (default:
                        .rst, .txt).
  -q, --quiet           only print violations
  -v, --verbose         run in verbose mode.
  --version             show the version and exit.

INI file usage


Instead of using the CLI for options the following files will also be examined
for ``[doc8]`` sections that can also provide the same set of options. If
the ``--config path`` option is used, these files will **not** be scanned for
the current working directory and that configuration path will be used
instead.

* ``$CWD/doc8.ini``
* ``$CWD/tox.ini``
* ``$CWD/pep8.ini``
* ``$CWD/setup.cfg``

An example section that can be placed into one of these files::

    [doc8]

    ignore-path=/tmp/stuff,/tmp/other_stuff
    max-line-length=99
    verbose=1
    ignore-path-errors=/tmp/other_thing.rst;D001;D002

**Note:** The option names are the same as the command line ones (with the
only variation of this being the ``no-sphinx`` option which from the
configuration file will be ``sphinx`` instead).

Option conflict resolution

When the same option is passed on the command line and also via configuration files the following strategies are applied to resolve these types of conflicts.

====================== =========== ======== Option Overrides Merges ====================== =========== ======== allow-long-titles Yes No ignore-path-errors No Yes default-extension Yes No extension No Yes ignore-path No Yes ignore No Yes max-line-length Yes No file-encoding Yes No sphinx Yes No ====================== =========== ========

Note: In the above table the configuration file option when specified as overrides will replace the same option given via the command line. When merges is stated then the option will be combined with the command line option (for example by becoming a larger list or set of values that contains the values passed on the command line and the values passed via configuration).

API

It is also possible to use doc8 programmatically. To call doc8 from a Python project, use::

from doc8 import doc8

result = doc8(allow_long_titles=True, max_line_length=99)

The returned result will have the following attributes and methods:

  • result.files_selected - number of files selected
  • result.files_ignored - number of files ignored
  • result.error_counts - dict of {check_name: error_count}
  • result.total_errors - total number of errors found
  • result.errors - list of (check_name, filename, line_num, code, message) tuples
  • result.report() - returns a human-readable report as a string

The doc8 method accepts the same arguments as the executable. Simply replace hyphens with underscores.

Note: Calling doc8 in this way will not write to stdout, so the quiet and verbose options are ignored.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].