跳到主要内容

Git Hooks

Superset uses Git pre-commit hooks courtesy of pre-commit. To install run the following:

pip3 install -r requirements/integration.txt
pre-commit install

A series of checks will now run when you make a git commit.

Alternatively it is possible to run pre-commit via tox:

tox -e pre-commit

Or by running pre-commit manually:

pre-commit run --all-files

Linting

Python

We use Pylint for linting which can be invoked via:

# for python
tox -e pylint

In terms of best practices please avoid blanket disablement of Pylint messages globally (via .pylintrc) or top-level within the file header, albeit there being a few exceptions. Disablement should occur inline as it prevents masking issues and provides context as to why said message is disabled.

Additionally, the Python code is auto-formatted using Black which is configured as a pre-commit hook. There are also numerous editor integrations

TypeScript

cd superset-frontend
npm ci
npm run lint

If using the eslint extension with vscode, put the following in your workspace settings.json file:

"eslint.workingDirectories": [
"superset-frontend"
]