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数据库插入失败   java在对失败的测试用例截图时出错,并且它没有附加到扩展报告中   java FragmentPagerAdapter总是从第一页开始   java内存泄漏,当我将数据从一个树存储库复制到另一个ext js 4.1时   java确保带有特定注释的字段是“私有的”   Java如何将UTC毫秒转换为UTC日期   开源Java:Solaris上的AWT   java为什么BufferedReader只读取第一行?   执行数据库查询时,java JTable不会刷新   java 7中的下划线和二进制文字。!!!??   java使用STaX将xml转换为另一个xml需要很多时间   hadoop如何使用JavaAPI从hbase中的表中选择特定列   使用JLabel的java拖放   用于“绘制”pdf文件的pdf生成Java库   java getResourceAsStream返回null?   java在目标帧中打开窗口   滚动对象时,java鼠标光标不会改变   java有人能解释二进制搜索树中的递归delete()并帮我转换它吗