diff --git a/README.md b/README.md index 001499d23d282..1afa5d9b152bd 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,6 @@ Come find us on the [development community chat](https://zulip.com/development-c [![coverage status](https://img.shields.io/codecov/c/github/zulip/zulip/main.svg)](https://codecov.io/gh/zulip/zulip) [![Mypy coverage](https://img.shields.io/badge/mypy-100%25-green.svg)][mypy-coverage] [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) -[![code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) [![GitHub release](https://img.shields.io/github/release/zulip/zulip.svg)](https://github.com/zulip/zulip/releases/latest) [![docs](https://readthedocs.org/projects/zulip/badge/?version=latest)](https://zulip.readthedocs.io/en/latest/) diff --git a/docs/contributing/code-style.md b/docs/contributing/code-style.md index ef23a6ecd693a..2e512b6ffabf3 100644 --- a/docs/contributing/code-style.md +++ b/docs/contributing/code-style.md @@ -61,9 +61,7 @@ lint checks in parallel, including: - JavaScript ([ESLint](https://eslint.org/), [Prettier](https://prettier.io/)) - Python ([mypy](http://mypy-lang.org/), - [ruff](https://github.com/astral-sh/ruff), - [Black](https://github.com/psf/black), - [isort](https://pycqa.github.io/isort/)) + [Ruff](https://docs.astral.sh/ruff/)) - templates - Puppet configuration - custom checks (e.g., trailing whitespace and spaces-not-tabs) @@ -139,15 +137,12 @@ rules about integrating third-party projects. ## Python-specific conventions and practices - Our Python code is formatted with - [Black](https://github.com/psf/black) and - [isort](https://pycqa.github.io/isort/). The [linter - tool](../testing/linters.md) enforces this by running Black and - isort in check mode, or in write mode with - `tools/lint --only=black,isort --fix`. You may find it helpful to - [integrate Black](https://black.readthedocs.io/en/stable/integrations/editors.html) - and - [isort](https://pycqa.github.io/isort/#installing-isorts-for-your-preferred-text-editor) - with your editor. + [Ruff](https://docs.astral.sh/ruff/). The [linter + tool](../testing/linters.md) enforces this by running Ruff in check + mode, or in write mode with + `tools/lint --only=ruff,ruff-format --fix`. You may find it helpful + to [integrate Ruff](https://docs.astral.sh/ruff/integrations/) with + your editor. - Don't put a shebang line on a Python file unless it's meaningful to run it as a script. (Some libraries can also be run as scripts, e.g., to run a test suite.) diff --git a/docs/testing/linters.md b/docs/testing/linters.md index 952c7c7fccd58..6c033f8bf0bb0 100644 --- a/docs/testing/linters.md +++ b/docs/testing/linters.md @@ -23,14 +23,12 @@ prevent common coding errors. We borrow some open source tools for much of our linting, and the links below will direct you to the official documentation for these projects. -- [Black](https://github.com/psf/black) - [ESLint](https://eslint.org) -- [isort](https://pycqa.github.io/isort/) - [mypy](http://mypy-lang.org/) - [Prettier](https://prettier.io/) - [Puppet](https://puppet.com/) (puppet provides its own mechanism for validating manifests) -- [ruff](https://github.com/astral-sh/ruff) +- [Ruff](https://docs.astral.sh/ruff/) - [stylelint](https://github.com/stylelint/stylelint) Zulip also uses some home-grown code to perform tasks like validating @@ -109,8 +107,8 @@ describes our test system in detail. Most of our lint checks get performed by `./tools/lint`. These include the following checks: -- Check Python code with ruff. -- Check Python formatting with Black and isort. +- Check Python code with Ruff. +- Check Python formatting with Ruff. - Check JavaScript and TypeScript code with ESLint. - Check CSS, JavaScript, TypeScript, and YAML formatting with Prettier. - Check Python code for custom Zulip rules. @@ -131,7 +129,7 @@ The rest of this document pertains to the checks that occur in `./tools/lint`. Zulip has a script called `lint` that lives in our "tools" directory. It is the workhorse of our linting system, although in some cases it -dispatches the heavy lifting to other components such as ruff, +dispatches the heavy lifting to other components such as Ruff, eslint, and other home grown tools. You can find the source code [here](https://github.com/zulip/zulip/blob/main/tools/lint). @@ -176,13 +174,12 @@ sense (e.g., a link in a comment to an extremely long URL). #### Python code -Our Python code is formatted using Black (using the options in the -`[tool.black]` section of `pyproject.toml`) and isort (using the -options in `.isort.cfg`). The `lint` script enforces this by running -Black and isort in check mode, or in write mode with `--fix`. +Our Python code is formatted using +[Ruff](https://docs.astral.sh/ruff/) (using the options in the +`[tool.ruff]` section of `pyproject.toml`). The `lint` script enforces +this by running Ruff in check mode, or in write mode with `--fix`. -The bulk of our Python linting gets outsourced to the "ruff" tool, -which is configured in the `tool.ruff` section of `pyproject.toml`. +The bulk of our Python linting also gets outsourced to Ruff. Zulip also has custom regex-based rules that it applies to Python code. Look for `python_rules` in the source code for `lint`. Note that we diff --git a/tools/setup/emoji/generate_emoji_names b/tools/setup/emoji/generate_emoji_names index 2b0ea235dbe93..631841f4b4abb 100755 --- a/tools/setup/emoji/generate_emoji_names +++ b/tools/setup/emoji/generate_emoji_names @@ -214,7 +214,7 @@ def main() -> None: f.write("}\n") print( - "\n\nDone! You should run the linter to format emoji_names.py with `./tools/lint --fix -m --only black`" + "\n\nDone! You should run the linter to format emoji_names.py with `./tools/lint --fix -m --only ruff-format`" )