This is a set of plugins for Statick that will discover documentation related files and perform static analysis on those files.
Custom exceptions can be applied the same way they are with Statick exceptions.
The recommended method to install these Statick plugins is via pip:
python3 -m pip install statick-md
You can also clone the repository and use it locally.
Make sure you install all the dependencies from apt/npm:
cat install.txt | xargs sudo apt-get install -y
cat npm-deps.txt | xargs sudo npm install -g
Markdownlint-cli has occasionally changed defaults via an upgrade that results in lots of new warnings.
To mitigate this you can pin the version of markdownlint-cli in npm-deps.txt by changing markdownlint-cli
to markdownlint-cli@0.19
.
The most common usage is to use statick and statick-md from pip. In that case your directory structure will look like the following:
project-root
|- md-project
|- statick-output
To run with the default configuration for the statick-md tools use:
statick md-project/ --output-directory statick-output/ --profile md-profile.yaml --config md-config.yaml
There are times when you will want to have a custom Statick configuration. This is usually done to run a different set of tools than are called out in the default profile, or to add exceptions. For this case you will have to add the new Statick configuration somewhere. This example will have custom exceptions in the md-project, such that the directory structure is:
project-root
|- md-project
|- statick-config
|- rsc
|- exceptions.yaml
|- statick-output
For this setup you will run the following:
statick md-project/ --output-directory statick-output/ --user-paths md-project/statick-config/ --profile md-profile.yaml --config md-config.yaml
The last type of setup will be to have all of the tools available from cloning repositories, not installing from pip. The directory structure will look like:
project-root
|- md-project
|- statick-config
|- rsc
|- exceptions.yaml
|- statick-output
|- statick
|- statick-md
Using the example where we want to override the default exceptions with custom ones in the md-project, the command to run would be:
./statick/statick md-project/ --output-directory statick-output/ --user-paths statick-md/,statick-md/src/statick_md,md-project/statick-config/ --profile md-profile.yaml --config md-config.yaml
File Type | Extensions |
---|---|
markdown | .md |
reStructuredText | .rst |
Tool | About |
---|---|
markdownlint | A Node.js style checker and lint tool for Markdown/CommonMark files. |
proselint | A linter for prose. |
rstcheck | Checks syntax of reStructuredText and code blocks nested within it. |
rst-lint | Checks syntax of reStructuredText and code blocks nested within it. |
write-good | Naive linter for English prose. |
If you write a new feature for Statick or are fixing a bug, you are strongly encouraged to add unit tests for your contribution. In particular, it is much easier to test whether a bug is fixed (and identify future regressions) if you can add a small unit test which replicates the bug.
Before submitting a change, please run tox to check that you have not introduced any regressions or violated any code style guidelines.
Statick Markdown uses mypy to check that type hints are being followed properly. Type hints are described in PEP 484 and allow for static typing in Python. To determine if proper types are being used in Statick Markdown the following command will show any errors, and create several types of reports that can be viewed with a text editor or web browser.
python3 -m pip install mypy
mkdir report
mypy --ignore-missing-imports --strict --html-report report/ --txt-report report src
It is hoped that in the future we will generate coverage reports from mypy and use those to check for regressions.
Statick code is formatted using black. To fix locally use
python3 -m pip install black
black src tests