| # Licensed to the Apache Software Foundation (ASF) under one | |
| # or more contributor license agreements. See the NOTICE file | |
| # distributed with this work for additional information | |
| # regarding copyright ownership. The ASF licenses this file | |
| # to you under the Apache License, Version 2.0 (the | |
| # "License"); you may not use this file except in compliance | |
| # with the License. You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, | |
| # software distributed under the License is distributed on an | |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| # KIND, either express or implied. See the License for the | |
| # specific language governing permissions and limitations | |
| # under the License. | |
| # The ruff settings every workspace member shares. A member's | |
| # `pyproject.toml` pulls them in with | |
| # | |
| # [tool.ruff] | |
| # extend = "<relative path>/dev/shared/ruff.toml" | |
| # | |
| # and declares only what is its own on top. | |
| # | |
| # Path-based settings cannot live here. ruff resolves a relative path in an | |
| # extended file against *this* directory, not the member's, so `src`, | |
| # `extend-exclude` and `per-file-ignores` (`"tests/**" = …`) stay in each | |
| # member. A member's `per-file-ignores` table also replaces, rather than | |
| # merges with, one declared here. | |
| # | |
| # Rule selection does merge: a member's `ignore = [...]` adds to the list | |
| # below, and a member's `select` replaces it. | |
| line-length = 110 | |
| target-version = "py314" | |
| [lint] | |
| select = [ | |
| "E", | |
| "W", | |
| "F", | |
| "I", | |
| "B", | |
| "UP", | |
| "SIM", | |
| "C4", | |
| "RUF", | |
| # Every function fully annotated, which the workspace's mypy config | |
| # (`disallow_untyped_defs`, `disallow_incomplete_defs`) required. ruff | |
| # carries it because ty, the type checker replacing mypy, has no such rule. | |
| # `ANN401` (no `Any`) is left out: mypy allowed an explicit `Any`. | |
| "ANN001", | |
| "ANN002", | |
| "ANN003", | |
| "ANN201", | |
| "ANN202", | |
| "ANN204", | |
| "ANN206", | |
| ] | |
| ignore = [ | |
| # Line length is ruff-format's job; long strings and URLs stay intact. | |
| "E501", | |
| ] | |
| [lint.flake8-annotations] | |
| # As mypy: an `__init__` with annotated arguments needs no `-> None`. | |
| mypy-init-return = true |