diff --git a/Makefile b/Makefile index c4a5134..eabad53 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ lint: style: @echo "Applying code style ..." poetry run ruff format . - poetry run ruff . --fix + poetry run ruff check . --fix unit: @echo "Running unit tests ..." diff --git a/gcp_pilot/base.py b/gcp_pilot/base.py index 222626e..9247611 100644 --- a/gcp_pilot/base.py +++ b/gcp_pilot/base.py @@ -389,7 +389,7 @@ def inner_function(*args, **kwargs): if "errors" in errors: main_error = errors["errors"][0]["reason"] - exception_klass = _reasons.get(main_error, None) + exception_klass = _reasons.get(main_error) details = errors.get("message", "") if not exception_klass and "message" in errors: diff --git a/gcp_pilot/big_query.py b/gcp_pilot/big_query.py index 94b86f5..1d5eada 100644 --- a/gcp_pilot/big_query.py +++ b/gcp_pilot/big_query.py @@ -228,7 +228,7 @@ def _get_type(cls, variable: Any) -> str: } python_type = type(variable).__name__ - param_type = TYPES.get(python_type, None) + param_type = TYPES.get(python_type) if param_type is None: raise exceptions.ValidationError(f"Parameter with type {param_type} not supported") return param_type @@ -239,7 +239,7 @@ def _get_value(cls, variable: Any) -> Any: "Decimal": float, } python_type = type(variable).__name__ - param_type = TYPES.get(python_type, None) + param_type = TYPES.get(python_type) if param_type is not None: return param_type(variable) return variable diff --git a/pyproject.toml b/pyproject.toml index 218446b..3b31dbe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,11 +63,13 @@ pytest-timeout = "*" [tool.ruff] -select = ["RUF", "I", "PL", "F", "COM", "UP", "DJ", "T10", "T20", "DTZ", "SIM", "TID", "PTH", "ERA", "TRY"] -ignore = ["COM812","COM819", "PLR2004", "PLR0911", "PLR0912", "PLR0913", "PLR0915", "DJ001", "DJ001", "DJ008", "TRY003", "RUF012"] line-length = 120 target-version = "py311" +[tool.ruff.lint] +select = ["RUF", "I", "PL", "F", "COM", "UP", "DJ", "T10", "T20", "DTZ", "SIM", "TID", "PTH", "ERA", "TRY"] +ignore = ["COM812","COM819", "PLR2004", "PLR0911", "PLR0912", "PLR0913", "PLR0915", "DJ001", "DJ001", "DJ008", "TRY003", "RUF012"] + [tool.pytest.ini_options] addopts = "-n auto --reruns 2 --random-order --timeout 100 --cov"