Skip to content

Commit

Permalink
Ignore TRY003 (too long exception message) globally
Browse files Browse the repository at this point in the history
  • Loading branch information
laurensWe committed May 28, 2024
1 parent ee36431 commit 9200036
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ build-backend = "poetry.core.masonry.api"
line-length = 120
target-version = "py311"
src = ["tad","tests"]
ignore = ["TRY003"]

[tool.ruff.format]
line-ending = "lf"
Expand Down
2 changes: 1 addition & 1 deletion tad/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def SQLALCHEMY_DATABASE_URI(self) -> str:
@model_validator(mode="after")
def _enforce_database_rules(self: SelfSettings) -> SelfSettings:
if self.ENVIRONMENT != "local" and self.APP_DATABASE_SCHEME == "sqlite":
raise SettingsError("SQLite is not supported in production") # noqa: TRY003
raise SettingsError("SQLite is not supported in production")
return self


Expand Down
2 changes: 1 addition & 1 deletion tad/migrations/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def run_migrations_online():
"""
configuration = config.get_section(config.config_ini_section)
if configuration is None:
raise Exception("Failed to get configuration section") # noqa: TRY003, TRY002
raise Exception("Failed to get configuration section") # noqa: TRY002
configuration["sqlalchemy.url"] = get_url()
connectable = engine_from_config(
configuration,
Expand Down
2 changes: 1 addition & 1 deletion tad/services/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class WriteService(ABC):
def __init__(self, location: str, filename: str) -> None:
self.location = location
if not filename.endswith(".yaml"):
raise ValueError(f"Filename {filename} must end with .yaml instead of .{filename.split('.')[-1]}") # noqa: TRY003
raise ValueError(f"Filename {filename} must end with .yaml instead of .{filename.split('.')[-1]}")
self.filename = filename

@abstractmethod
Expand Down
2 changes: 1 addition & 1 deletion tests/core/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

def test_environment_settings():
with pytest.raises(SettingsError) as exc_info:
raise SettingsError("Wrong settings") # noqa: TRY003
raise SettingsError("Wrong settings")

assert exc_info.value.message == "Wrong settings"

0 comments on commit 9200036

Please sign in to comment.