Git Hooks

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

  1. pip3 install -r requirements/integration.txt
  2. 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:

  1. tox -e pre-commit

Or by running pre-commit manually:

  1. pre-commit run --all-files

Linting

Python

We use Pylint for linting which can be invoked via:

  1. # for python
  2. 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

  1. cd superset-frontend
  2. npm ci
  3. npm run lint

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

  1. "eslint.workingDirectories": [
  2. "superset-frontend"
  3. ]