Skip to content

Commit bb57a00

Browse files
authored
[docs] Add new Python Linting section (#3737)
- Remove the old CI section which was stale. - Document all the basic Ruff commands.
1 parent d5ab133 commit bb57a00

File tree

1 file changed

+16
-5
lines changed
  • docs/docs-site/content/developer/development

1 file changed

+16
-5
lines changed

docs/docs-site/content/developer/development/_index.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -664,14 +664,25 @@ For js run:
664664

665665
npm run test-coverage
666666

667-
### Continuous Integration (CI)
667+
### Python Linting
668668

669-
[CircleCi](https://circleci.com/gh/cloudera/hue) automatically run the unit tests (Python, Javascript, linting) on branch updates and pull requests. Branches containing `ci-commit-master` will try to be auto pushed to master if the run is green and the Github permissions match.
670-
This logic is described in the [config.yml](https://github.com/cloudera/hue/tree/master/.circleci).
669+
Hue uses [Ruff](https://docs.astral.sh/ruff/) for linting its backend codebase. The Ruff related configs can be found in the [pyproject.toml](https://github.com/cloudera/hue/blob/master/pyproject.toml) file present at the project root.
671670

672-
The runs happen in an image based on [latest Hue's image](https://hub.docker.com/u/gethue/).
671+
The Github Action CI checks are also leveraging the Ruff linting on branch updates and pull requests.
673672

674-
Note: until the `desktop/ext-py` dependencies are moved to a `requirement.txt`, adding new Python modules will require adding them first to the Docker image by building a Hue branch which has them.
673+
To manually check for linting violations **on the modified files**, run:
674+
675+
./build/env/bin/hue runruff check
676+
677+
The above command will lint all the files modified w.r.t `origin/master` by default and to change the base branch for finding all modified files, simply add the `--diff-branch=<new_base_branch>` argument like below:
678+
679+
./build/env/bin/hue runruff check --diff-branch=<new_base_branch>
680+
681+
Ruff can also autofix most of the flagged violations:
682+
683+
./build/env/bin/hue/runruff check --fix
684+
685+
Some flagged violations can't be autofixed by Ruff and requires manual fixing. Other Ruff supported commands are listed [here](https://docs.astral.sh/ruff/configuration/#full-command-line-interface)
675686

676687
### Integration tests
677688

0 commit comments

Comments
 (0)