on master help sign in
build requirements: add a shell script static analysis tool

ShellCheck: https://github.com/koalaman/shellcheck Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>

commitbdf392093af92da7d8fc4e32b68ff0716700522d authorMarkus Heiser <markus.heiser@darmarit.de> dateWed 8 Jan 2020, 18:09 (7 years ago) parent22d05b3
4 files changed+50−15
Makefile+4−2 docs/admin/buildhosts.rst+41−9 docs/dev/makefile.rst+3−1 docs/dev/reST.rst+2−3
Makefile+4−2
@@ -70,12 +70,14 @@ $(GH_PAGES)::
7070# test
7171# ----
7272
73−PHONY += test test.pylint test.pep8 test.unit test.robot
73+PHONY += test test.sh test.pylint test.pep8 test.unit test.robot
7474
7575# TODO: balance linting with pylint
76−test: test.pep8 test.unit test.robot
76+test: test.pep8 test.unit test.sh test.robot
7777 - make pylint
7878
79+test.sh:
80+
7981test.pep8: pyenvinstall
8082 $(PY_ENV_ACT); ./manage.sh pep8_check
8183
docs/admin/buildhosts.rst+41−9
@@ -35,8 +35,17 @@ processing additional packages are needed. The XeTeX_ needed not only for PDF
3535creation, its also needed for :ref:`math` when HTML output is build.
3636
3737To be able to do :ref:`sphinx:math-support` without CDNs, the math are rendered
38−as images (``sphinx.ext.imgmath`` extension). If your docs build (``make
39−docs``) shows warnings like this::
38+as images (``sphinx.ext.imgmath`` extension).
39+
40+Here is the extract from the :origin:`docs/conf.py` file, setting math renderer
41+to ``imgmath``:
42+
43+.. literalinclude:: ../conf.py
44+ :language: python
45+ :start-after: # sphinx.ext.imgmath setup
46+ :end-before: # sphinx.ext.imgmath setup END
47+
48+If your docs build (``make docs``) shows warnings like this::
4049
4150 WARNING: dot(1) not found, for better output quality install \
4251 graphviz from http://www.graphviz.org
@@ -47,8 +56,6 @@ docs``) shows warnings like this::
4756you need to install additional packages on your build host, to get better HTML
4857output.
4958
50−.. _system requirements:
51−
5259.. tabs::
5360
5461 .. group-tab:: Ubuntu / debian
@@ -94,10 +101,35 @@ For PDF output you also need:
94101 texlive-collection-fontsrecommended texlive-collection-latex \
95102 dejavu-sans-fonts dejavu-serif-fonts dejavu-sans-mono-fonts
96103
97−.. _system requirements END:
104+.. _sh lint:
98105
99−.. literalinclude:: ../conf.py
100− :language: python
101− :start-after: # sphinx.ext.imgmath setup
102− :end-before: # sphinx.ext.imgmath setup END
106+Lint shell scripts
107+==================
108+
109+.. _ShellCheck: https://github.com/koalaman/shellcheck
110+
111+To lint shell scripts, we use ShellCheck_ - A shell script static analysis tool.
112+
113+.. SNIP sh lint requirements
114+
115+.. tabs::
116+
117+ .. group-tab:: Ubuntu / debian
118+
119+ .. code-block:: sh
120+
121+ $ sudo apt install shellcheck
122+
123+ .. group-tab:: Arch Linux
124+
125+ .. code-block:: sh
126+
127+ $ sudo pacman -S shellcheck
128+
129+ .. group-tab:: Fedora / RHEL
130+
131+ .. code-block:: sh
132+
133+ $ sudo dnf install ShellCheck
103134
135+.. SNAP sh lint requirements
docs/dev/makefile.rst+3−1
@@ -11,6 +11,8 @@ Makefile Targets
1111 Before looking deeper at the targets, first read about :ref:`makefile setup`
1212 and :ref:`make pyenv`.
1313
14+ To install system requirements follow :ref:`buildhosts`.
15+
1416With the aim to simplify development cycles, started with :pull:`1756` a
1517``Makefile`` based boilerplate was added. If you are not familiar with
1618Makefiles, we recommend to read gnu-make_ introduction.
@@ -170,7 +172,7 @@ e.g.:
170172
171173.. code:: sh
172174
173− $ make test.pep8 test.unit
175+ $ make test.pep8 test.unit test.sh
174176 . ./local/py3/bin/activate; ./manage.sh pep8_check
175177 [!] Running pep8 check
176178 . ./local/py3/bin/activate; ./manage.sh unit_tests
docs/dev/reST.rst+2−3
@@ -1312,9 +1312,8 @@ others are basic-tabs_ and code-tabs_. Below a *group-tab* example from
13121312
13131313.. literalinclude:: ../admin/buildhosts.rst
13141314 :language: reST
1315− :start-after: .. _system requirements:
1316− :end-before: .. _system requirements END:
1317−
1315+ :start-after: .. SNIP sh lint requirements
1316+ :end-before: .. SNAP sh lint requirements
13181317
13191318.. _math:
13201319