lint shell代码块的sphinx扩展

sphinxcontrib-shellcheck的Python项目详细描述


PyPI versionLicensePython versions supportedFormat

Continuous integration test statusContinuous integration test coverage

SphinxContrib外壳检查

shellcheck sphinx生成器是一个扩展,它使用shellcheck实用程序在 文档。

口译员

扩展已经用Python2.7、3.5、3.6和3.7开发和测试过了 在linux(debian,ubuntu)、apple macos和microsoft windows下

安装

分机在PyPI, 所以:

$ pip install sphinxcontrib-shellcheck

将shellcheck扩展添加到sphinx的扩展列表中 conf.py启用它的文件:

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

用法

例如,如果structuredtext文件example.rst具有以下内容 内容:

Follow these instructions:

    ..code-block::bash

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

And all will be good

然后安装扩展:

$ 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

配置变量

这些是扩展的可配置变量:

  • shellcheck_方言list of strings):要 毛绒的。默认方言是shellcheck,["sh", "bash", "dash", "ksh"]支持的方言,并且只有其中的一个子集有效。
  • shellcheck_可执行文件string):shellcheck可执行文件的名称 (可能也是完整的路径)。默认值是"shellcheck"
  • shellcheck_promptstring):表示终端的单个字符 迅速。默认值是$
  • shellcheck\u debuginteger):指示是否调试的标志 信息应通过狮身人面像记录器(1)打印或不打印 (0)。默认值是0。此配置选项仅 在开发扩展时有用。

这些配置变量可以通过sphinx配置文件重写 conf.py,或者通过sphinx-build命令的-D选项。为了 示例:

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

许可证

麻省理工学院许可证(MIT)

版权所有(c)2018-2019,Pablo Acosta Serafini 保留所有权利。

以源和二进制形式重新分配和使用,有无 如果满足以下条件,则允许修改:

  • 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.

本软件由版权所有者和贡献者“按原样”提供,并且 任何明示或默示保证,包括但不限于 对特定用途的适销性和适合性的保证 否认。在任何情况下,版权所有人均不对任何 直接、间接、附带、特殊、惩戒性或后果性损害 (包括但不限于替代货物或服务的采购; 使用、数据或利润的损失;或营业中断),无论是何种原因造成的 论任何责任理论,无论是合同责任、严格责任还是侵权责任 (包括疏忽或其他)以任何方式产生的 软件,即使被告知有这种损坏的可能性。

变更日志

    在错误发生时,正确地设置退出代码(< 2019年3月27日>)
  • 1.0.9[2019年3月18日]更改调试参数默认状态
  • 1.0.8[2019年3月17日]包管理更新
  • 1.0.7[2019年3月17日]包管理更新
  • 1.0.6【2019年3月17日】增加了ShellCheck最低版本的检查。更新的 软件包管理和测试框架
  • 1.0.5【2019年1月4日】首次公开发行

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java InputStream对象在声明后关闭   java未定义名为“transactionManager”的bean重命名transactionManager   java“jar”命令何时会拒绝将类添加到java中。jar文件?   java JPA标准依赖WHERE子句   安卓中从SD卡读取文本文件时出现java错误   java直接启用类似位置的权限   使用@WebMvcTest和Mockito-BDDMockito对SpringBoot-RestController进行java测试   java JSESSIONID存储在哪里?   java jtextarea鼠标事件覆盖容器鼠标事件   java DRL无法解析动态加载的类   java是从一个方法返回多个对象的最简单方法   java自定义按钮/编辑框是否不可见?   java GUI如何在保存用户输入的同时在面板或框架之间切换   swing Java自定义JSlider不会更新   GridBagLayout中的java超过1个JPanel   java从ProjectReactor中的flux中采样除第一个元素外的所有元素   Java泛型和泛型类型   Java代码生成宽指令的jvm