Skip to content

Commit

Permalink
Change: Enable pylint rules for ruff
Browse files Browse the repository at this point in the history
Run pylint rules of ruff (error and warning rules) for finding
additional issues in our code.
  • Loading branch information
bjoernricks committed Oct 27, 2023
1 parent 0f2ca2f commit 3c4d056
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pontos/github/api/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ async def upload_file(
tasks = []
for file_path in files:
if isinstance(file_path, tuple):
file_path, content_type = file_path
file_path, content_type = file_path # noqa: PLW2901
else:
content_type = "application/octet-stream"

Expand Down
6 changes: 3 additions & 3 deletions pontos/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Foo:
if isinstance(value, dict):
default = None if hasattr(obj, key) else ModelAttribute()
prop = getattr(obj, key, default)
value = dotted_attributes(prop, value)
value = dotted_attributes(prop, value) # noqa: PLW2901

setattr(obj, key, value)

Expand Down Expand Up @@ -163,10 +163,10 @@ def from_dict(cls, data: Dict[str, Any]):
try:
if isinstance(value, list):
model_field_cls = type_hints.get(name)
value = [cls._get_value(model_field_cls, v) for v in value] # type: ignore # pylint: disable=line-too-long # noqa: E501
value = [cls._get_value(model_field_cls, v) for v in value] # type: ignore # pylint: disable=line-too-long # noqa: E501,PLW2901
elif value is not None:
model_field_cls = type_hints.get(name)
value = cls._get_value(model_field_cls, value) # type: ignore # pylint: disable=line-too-long # noqa: E501
value = cls._get_value(model_field_cls, value) # type: ignore # pylint: disable=line-too-long # noqa: E501,PLW2901
except (ValueError, TypeError) as e:
raise ModelError(
f"Error while creating {cls.__name__} model. Could not set "
Expand Down
4 changes: 2 additions & 2 deletions pontos/version/commands/_java.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
import json
import re
from pathlib import Path
from typing import Literal, Union, Dict, List, Any
from typing import Any, Dict, List, Literal, Union

from ._command import VersionCommand
from ..errors import VersionError
from ..version import Version, VersionUpdate
from ._command import VersionCommand


# This class is used for Java Version command(s)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ line_length = 80
[tool.ruff]
line-length = 80
target-version = "py39"
extend-select = ["I"]
extend-select = ["I", "PLE", "PLW"]

[tool.mypy]
files = "pontos"
Expand Down
8 changes: 3 additions & 5 deletions tests/version/commands/test_cargo.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
from typing import Iterator
import unittest

from contextlib import contextmanager
from pathlib import Path
from typing import Iterator

import tomlkit

from pontos.testing import temp_directory, temp_file
from pontos.version import VersionError
from pontos.version.schemes import PEP440VersioningScheme

from pontos.version.commands._cargo import CargoVersionCommand

from pontos.version.schemes import PEP440VersioningScheme

VERSION_EXAMPLE = """
[package]
Expand Down

0 comments on commit 3c4d056

Please sign in to comment.