| # 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 ty settings every workspace member shares. | |
| # | |
| # ty has no `extend`, and `ty check --config-file` *replaces* a member's own | |
| # `[tool.ty]` rather than merging with it. So this file is not passed to ty: | |
| # `tools/dev/run-workspace-check.sh` turns it into command-line flags | |
| # (`--error <rule>`, `--error-on-warning`), which do merge, and a member's | |
| # `[tool.ty]` keeps only what is its own (the paths it checks or excludes). | |
| # Only the three tables below are read; anything else here is an error. | |
| # | |
| # A flag outranks a member's `[tool.ty.rules]`, so a member cannot relax a | |
| # rule set here. It can tighten one, or set a rule this file leaves alone. | |
| # ty's default rule levels, plus these, which mypy's config enforced | |
| # (`warn_unused_ignores`, `warn_redundant_casts`) or which catch a name that | |
| # exists on only some paths through the code. | |
| [rules] | |
| unused-ignore-comment = "error" | |
| unused-type-ignore-comment = "error" | |
| redundant-cast = "error" | |
| possibly-unresolved-reference = "error" | |
| possibly-missing-attribute = "error" | |
| possibly-missing-import = "error" | |
| # A method that overrides a base-class method says so (`@typing.override`, | |
| # 3.12+), so renaming the base method breaks loudly instead of silently. | |
| missing-override-decorator = "error" | |
| [analysis] | |
| # Every suppression is an explicit `# ty: ignore[<rule>]`, which | |
| # `unused-ignore-comment` above checks. ty cannot tell whether a coded | |
| # `# type: ignore[<mypy code>]` is still needed, so it would honour a stale one | |
| # for good, hiding whatever ty finds on that line. | |
| respect-type-ignore-comments = false | |
| [terminal] | |
| # A warning fails the run as an error does: nothing is merely advisory. | |
| error-on-warning = true |