Commit 5549b68f authored by Luke Mewburn's avatar Luke Mewburn
Browse files

globally disable ruff BLE001, EM102

Also skip 103705/* in ruff and ty (for now).
parent b2cc3d04
Loading
Loading
Loading
Loading
Loading
+25 −12
Changes for pyproject.toml: 25 added lines, 12 removed lines.
Original line number Original line Diff line number Diff line
@@ -29,18 +29,8 @@ output-prefer-rule-codes = true
[tool.ruff.lint]
[tool.ruff.lint]
# Only enable preview rules if listed in `select`.
# Only enable preview rules if listed in `select`.
explicit-preview-rules = true
explicit-preview-rules = true
ignore = [
  "COM812",     # missing-trailing-comma
  "CPY001",     # missing-copyright-notice
  "EM102",      # f-string-in-exception
  "G004",       # logging-f-string
  "S101",       # assert
  "TRY002",     # raise-vanilla-class
  "TRY003",     # raise-vanilla-args
  "T201",       # print
]

preview = true
preview = true

select = [
select = [
  "ALL",
  "ALL",
  "DOC102",     # docstring-extraneous-parameter
  "DOC102",     # docstring-extraneous-parameter
@@ -52,7 +42,22 @@ select = [
  "DOC502",     # docstring-extraneous-exception
  "DOC502",     # docstring-extraneous-exception
]
]


# Disable various ALL rules
ignore = [
  "BLE001",     # blind-except
  "COM812",     # missing-trailing-comma
  "CPY001",     # missing-copyright-notice
  "EM101",      # raw-string-in-exception
  "EM102",      # f-string-in-exception
  "G004",       # logging-f-string
  "S101",       # assert
  "TRY002",     # raise-vanilla-class
  "TRY003",     # raise-vanilla-args
  "T201",       # print
]

[tool.ruff.lint.per-file-ignores]
[tool.ruff.lint.per-file-ignores]

# Disable various checks except in testing/*/*.py
# Disable various checks except in testing/*/*.py
"!testing/*/*.py" = [
"!testing/*/*.py" = [
  "D",          # pydocstyle
  "D",          # pydocstyle
@@ -64,9 +69,17 @@ select = [
  "TD003",      # missing-todo-link
  "TD003",      # missing-todo-link
]
]


"!{testing/*/*.py,utils/*.py}" = [
# Disable checking 103705
"103705/*" = [
  "ALL",
  "ALL",
]
]


[tool.ruff.lint.pydocstyle]
[tool.ruff.lint.pydocstyle]
convention = "google"
convention = "google"

[tool.ty.src]

exclude = [
  "103705/*",                       # code needs modernising
  "utils/generate_change_notes.py"  # forgelib missing
]
+6 −6
Changes for testing/asn/asn_process.py: 6 added lines, 6 removed lines.
Original line number Original line Diff line number Diff line
@@ -2,7 +2,7 @@


"""Tool to validate ASN.1 in the repository."""
"""Tool to validate ASN.1 in the repository."""


# ruff: noqa: EM101 (raw-string-in-exception)

# ruff: noqa: N802 (invalid-function-name)
# ruff: noqa: N802 (invalid-function-name)
# ruff: noqa: N803 (invalid-argument-name)
# ruff: noqa: N803 (invalid-argument-name)
# ruff: noqa: N806 (non-lowercase-variable-in-function)
# ruff: noqa: N806 (non-lowercase-variable-in-function)
@@ -153,7 +153,7 @@ def compileAllTargets(asnFiles: dict[str, typing.Any]) -> dict[str, typing.Any]:
            results[str(target)] = {
            results[str(target)] = {
                "ok": True,
                "ok": True,
            }
            }
        except Exception as ex:  # noqa: BLE001 (blind-except)
        except Exception as ex:
            results[str(target)] = {"ok": False, "code": -1, "message": f"{ex!r}"}
            results[str(target)] = {"ok": False, "code": -1, "message": f"{ex!r}"}
            continue
            continue
    return results
    return results
@@ -192,7 +192,7 @@ def compatCheckFiles(asnFiles: dict[str, typing.Any]) -> dict[str, typing.Any]:
                    compareErrors = compatCheck.compare_files(
                    compareErrors = compatCheck.compare_files(
                        a_files=compatDeps, b_files=targetDeps
                        a_files=compatDeps, b_files=targetDeps
                    )
                    )
                except Exception as ex:  # noqa: BLE001 (blind-except)
                except Exception as ex:
                    compareErrors = [f"Compare exception: {ex}"]
                    compareErrors = [f"Compare exception: {ex}"]
                errors.extend(
                errors.extend(
                    [
                    [
@@ -212,7 +212,7 @@ def compatCheckFiles(asnFiles: dict[str, typing.Any]) -> dict[str, typing.Any]:
                "ok": len(errors) == 0,
                "ok": len(errors) == 0,
                "message": errors,
                "message": errors,
            }
            }
        except Exception as ex:  # noqa: BLE001 (blind-except)
        except Exception as ex:
            results[str(target)] = {"ok": False, "code": -1, "message": f"{ex!r}"}
            results[str(target)] = {"ok": False, "code": -1, "message": f"{ex!r}"}
            continue
            continue
    return results
    return results
@@ -258,7 +258,7 @@ def compatCheckCommits(asnFiles: dict[str, typing.Any]) -> dict[str, typing.Any]
                        asn_file=target,
                        asn_file=target,
                        dependencies=targetDeps,
                        dependencies=targetDeps,
                    )
                    )
                except Exception as ex:  # noqa: BLE001 (blind-except)
                except Exception as ex:
                    compareErrors = [f"Compare exception: {ex}"]
                    compareErrors = [f"Compare exception: {ex}"]
                commitErrors = []
                commitErrors = []
                commitErrors.extend(
                commitErrors.extend(
@@ -283,7 +283,7 @@ def compatCheckCommits(asnFiles: dict[str, typing.Any]) -> dict[str, typing.Any]
                "ok": len(errors) == 0,
                "ok": len(errors) == 0,
                "message": errors,
                "message": errors,
            }
            }
        except Exception as ex:  # noqa: BLE001 (blind-except)
        except Exception as ex:
            results[str(target)] = {"ok": False, "code": -1, "message": f"{ex!r}"}
            results[str(target)] = {"ok": False, "code": -1, "message": f"{ex!r}"}
            continue
            continue
    return results
    return results