Skip to main content

Sphinx extension to lint shell code blocks

Project description

PyPI version License Python versions supported Format

https://travis-ci.org/pmacosta/sphinxcontrib-shellcheck.svg?branch=master Windows continuous integration Continuous integration coverage

sphinxcontrib-shellcheck

The shellcheck Sphinx builder is an extension that uses the shellcheck utility to lint shell code in the documentation.

Interpreter

The extension has been developed and tested with Python 2.7, 3.5, 3.6 and 3.7 under Linux (Debian, Ubuntu), and Microsoft Windows

Installation

The extension is on PyPI, so:

$ pip install sphinxcontrib-shellcheck

Add the shellcheck extension to the extension list in your Sphinx conf.py file to enable it:

extensions = [
    ...
    "sphinxcontrib.shellcheck",
    ...
]

Usage

For example, if a reStructuredText file example.rst has the following content:

Follow these instructions:

    .. code-block:: bash

        $ github_user=myname
        $ git clone \
              https://github.com/"${github_user}"/ \
              myrepo.git
        Cloning into 'myrepo'...
        ...
        $ cd myrepo
        $ export MYREPO_DIR=${PWD}
        $ echo "${myvar}"

And all will be good

Then with the extension installed:

$ sphinx-build -b shellcheck . _build example.rst
Running Sphinx v1.8.3
making output directory...
building [mo]: targets for 0 po files that are specified
building [shellcheck]: 1 source files given on command line
updating environment: 4 added, 0 changed, 0 removed
reading sources... [100%] index
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
example.rst
Line 11, column 11 [2164]: Use cd ... || exit in case cd fails.
Line 13, column 17 [2154]: myvar is referenced but not assigned.
build succeeded.

Look for any errors in the above output or in _build/shellcheck/output.txt

Configuration variables

These are the configurable variables of the extension:

  • shellcheck_dialects (list of strings): shell dialects to be linted. The default dialects are those supported by shellcheck, ["sh", "bash", "dash", "ksh"], and only a subset of these is valid.

  • shellcheck_executable (string): name of the shellcheck executable (potentially full path to it too). The default is "shellcheck".

  • shellcheck_prompt (string): single character representing the terminal prompt. The default is $.

  • shellcheck_debug (integer): flag that indicates whether debug information shall be printed via the Sphinx logger (1) or not (0). The default is 0. This configuration option is only useful while developing the extension.

These configuration variables can be overriden via the Sphinx configuration file conf.py, or via the -D option of the sphinx-build command. For example:

$ sphinx-build -b shellcheck \
   -D shellcheck_dialects=bash,ksh \
   -D shellcheck_executable=shellcheck-stable \
   -D shellcheck_prompt=$ \
   -D shellcheck_debug=1 \
   . _build example.rst

License

The MIT License (MIT)

Copyright (c) 2018-2019, Pablo Acosta-Serafini All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of the <organization> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Changelog

  • 1.0.5 [January 4, 2019] Initial public release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinxcontrib-shellcheck-1.0.5.tar.gz (34.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

sphinxcontrib_shellcheck-1.0.5-py37-none-any.whl (9.5 kB view details)

Uploaded Python 3.7

sphinxcontrib_shellcheck-1.0.5-py36-none-any.whl (13.1 kB view details)

Uploaded Python 3.6

sphinxcontrib_shellcheck-1.0.5-py35-none-any.whl (13.1 kB view details)

Uploaded Python 3.5

sphinxcontrib_shellcheck-1.0.5-py27-none-any.whl (13.1 kB view details)

Uploaded Python 2.7

File details

Details for the file sphinxcontrib-shellcheck-1.0.5.tar.gz.

File metadata

  • Download URL: sphinxcontrib-shellcheck-1.0.5.tar.gz
  • Upload date:
  • Size: 34.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.4 CPython/2.7.13

File hashes

Hashes for sphinxcontrib-shellcheck-1.0.5.tar.gz
Algorithm Hash digest
SHA256 a2a1af40dd116f7c9446be035a6cb81a1a94aa16ca45e6774b8b85b4810b840b
MD5 e6a009904a3144a1a252c412d0ae80b5
BLAKE2b-256 9aacbc9826fc48c2050f9bbcf352d77300b09b3d58694988be1b0cc0d9cfcfac

See more details on using hashes here.

File details

Details for the file sphinxcontrib_shellcheck-1.0.5-py37-none-any.whl.

File metadata

  • Download URL: sphinxcontrib_shellcheck-1.0.5-py37-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3.7
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.4 CPython/2.7.13

File hashes

Hashes for sphinxcontrib_shellcheck-1.0.5-py37-none-any.whl
Algorithm Hash digest
SHA256 9970c6de484b86766f1e4343e5e12cf1702d127b4dce3958fc775f78ccc36168
MD5 a5c76df3b03b1cf92bb011d8447f1b35
BLAKE2b-256 d3ae1978ea47eadd7bf48eaf6d0153114f9c49b8da1718a53cd9632ee1fe8be6

See more details on using hashes here.

File details

Details for the file sphinxcontrib_shellcheck-1.0.5-py36-none-any.whl.

File metadata

  • Download URL: sphinxcontrib_shellcheck-1.0.5-py36-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3.6
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.4 CPython/2.7.13

File hashes

Hashes for sphinxcontrib_shellcheck-1.0.5-py36-none-any.whl
Algorithm Hash digest
SHA256 49b01df46ecbc78f5bd464fed3a9635c8ead4fc1c093099e30c752a42febe987
MD5 c0e8a8f4fcf8fd32235fef81c9301a46
BLAKE2b-256 c82fbdfdb28fdcf118e90d5d4ffda3e2d25f91169aff8369abc7ace4a7dd446a

See more details on using hashes here.

File details

Details for the file sphinxcontrib_shellcheck-1.0.5-py35-none-any.whl.

File metadata

  • Download URL: sphinxcontrib_shellcheck-1.0.5-py35-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3.5
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.4 CPython/2.7.13

File hashes

Hashes for sphinxcontrib_shellcheck-1.0.5-py35-none-any.whl
Algorithm Hash digest
SHA256 6145a5462bc70d189ab39e81048ae11270c78d408b86725490fc440018f46c77
MD5 69b34ad7d33e5e026b7edddc92f5f0c1
BLAKE2b-256 8f1a34ebaacd339e6b831c5a9c5178172775bc3e77b62df64379e163ebc8e31e

See more details on using hashes here.

File details

Details for the file sphinxcontrib_shellcheck-1.0.5-py27-none-any.whl.

File metadata

  • Download URL: sphinxcontrib_shellcheck-1.0.5-py27-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 2.7
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.4 CPython/2.7.13

File hashes

Hashes for sphinxcontrib_shellcheck-1.0.5-py27-none-any.whl
Algorithm Hash digest
SHA256 0bc11a7e6a1d4c9f8927251aff677178be45db7fa8936206187750b0db800695
MD5 d558de1bd5f2be3daf1c86f491e5fe8d
BLAKE2b-256 2c00654a4290776fb7ba1d115f6a988e4e74112e2fe302af2865e57177a23d8e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page