Statick analysis plugins for Web (css, html, js) files.
Project description
Statick Web Plugins
This is a set of plugins for Statick that will discover Web (HTML, CSS, JavaScript) files and perform static analysis on those files.
Custom exceptions can be applied the same way they are with Statick exceptions.
Table of Contents
Installation
The recommended method to install these Statick plugins is via pip:
python3 -m pip install statick-web
You can also clone the repository and use it locally.
Usage
Make sure you install all the dependencies from apt/npm. See the Actions file to see exactly which commands work for various operating systems. Pay particular attention to which packages are installed locally and globally.
Pip Install
The most common usage is to use statick and statick-web from pip. In that case your directory structure will look like the following:
project-root
|- web-project
|- statick-config
To run with the default configuration for the statick-web tools use:
statick web-project/ --output-directory statick-output/ --profile web-profile.yaml
Pip Install and Custom Configuration
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 web-project, such that the directory structure is:
project-root
|- web-project
|- statick-config
|- rsc
|- exceptions.yaml
|- statick-output
For this setup you will run the following:
statick web-project/ --output-directory statick-output/ --user-paths web-project/statick-config/ --profile web-profile.yaml
Source Install and Custom Configuration
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
|- web-project
|- statick-config
|- rsc
|- exceptions.yaml
|- statick-output
|- statick
|- statick-web
Using the example where we want to override the default exceptions with custom ones in the web-project, the command to run would be:
./statick/statick web-project/ --output-directory statick-output/ --user-paths statick-web/,web-project/statick-config/ --profile web-profile.yaml
Existing Plugins
Discovery Plugins
Note that if a file exists without the extension listed it can still be discovered if the file
command identifies it
as a specific file type.
This type of discovery must be supported by the discovery plugin and only works on operating systems where the file
command exists.
File Type | Extensions |
---|---|
css | .css |
html | .html |
javascript | .js |
Tool Plugins
Tool | About |
---|---|
eslint | Find and fix problems in your JavaScript code. |
htmllint | An unofficial html5 linter and validator. |
jshint | JSHint is a community-driven tool that detects errors and potential problems in JavaScript code. |
stylelint | A mighty, modern linter that helps you avoid errors and enforce conventions in your styles. |
Contributing
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.
Mypy
Statick Web 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 Web 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.
Formatting
Statick code is formatted using black. To fix locally use
python3 -m pip install black
black src tests
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file statick-web-0.1.3.tar.gz
.
File metadata
- Download URL: statick-web-0.1.3.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ca783142c81ab8f51f06ebb0bc6894b6933ec39a304ed551218f6e361cc59dc |
|
MD5 | 9ef93704d19cc533c2bca72556dcb2db |
|
BLAKE2b-256 | da35b1338430ad8c828a29679123c8d226f0035bfddecbdca740d34c188ba974 |
File details
Details for the file statick_web-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: statick_web-0.1.3-py3-none-any.whl
- Upload date:
- Size: 19.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9f53cdf6bdf2aa2b663cbbbb259c565c8550a2b008ca5a9f058f1d9f9bc2f24 |
|
MD5 | 86e86062902b52290dacdab26ca647d7 |
|
BLAKE2b-256 | 8bd44bc46cf9bf3898f2500d846587b334a074b0751ccfacd193aa6f7d7a1854 |