Skip to content

Commit

Permalink
lint: update ruff and fix linting
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Lowe <alex.lowe@canonical.com>
  • Loading branch information
lengau committed May 19, 2023
1 parent c322b37 commit 8b6e945
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
4 changes: 1 addition & 3 deletions craft_archives/os_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
class OsRelease:
"""A class to intelligently determine the OS on which we're running."""

def __init__(
self, *, os_release_file: Path = Path("/etc/os-release") # noqa: B008
) -> None:
def __init__(self, *, os_release_file: Path = Path("/etc/os-release")) -> None:
"""Create a new OsRelease instance.
:param str os_release_file: Path to os-release file to be parsed.
Expand Down
4 changes: 2 additions & 2 deletions craft_archives/repo/apt_sources_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
_DEFAULT_SOURCES_DIRECTORY = Path("/etc/apt/sources.list.d")


def _construct_deb822_source(
def _construct_deb822_source( # noqa: PLR0913
*,
architectures: Optional[List[str]] = None,
components: Optional[List[str]] = None,
Expand Down Expand Up @@ -87,7 +87,7 @@ def __init__(
self._sources_list_d = sources_list_d or _DEFAULT_SOURCES_DIRECTORY
self._keyrings_dir = keyrings_dir or apt_key_manager.KEYRINGS_PATH

def _install_sources(
def _install_sources( # noqa: PLR0913
self,
*,
architectures: Optional[List[str]] = None,
Expand Down
2 changes: 1 addition & 1 deletion craft_archives/repo/package_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def name(self) -> str:
def _path_non_empty(
cls, path: Optional[str], values: Dict[str, Any]
) -> Optional[str]:
if path is not None and path == "":
if path is not None and not path:
raise _create_validation_error(
url=values.get("url"),
message="Invalid path; Paths must be non-empty strings.",
Expand Down
2 changes: 1 addition & 1 deletion craft_archives/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __str__(self) -> str:


def get_os_platform(
filepath: Path = Path("/etc/os-release"), # noqa: B008
filepath: Path = Path("/etc/os-release"),
) -> OSPlatform:
"""Determine a system/release combo for an OS using /etc/os-release if available."""
system = platform.system()
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dev = [
dev-lint = [ # Static linting environment dependencies
"black==23.1.0",
"codespell[tomli]==2.2.4",
"ruff==0.0.254",
"ruff==0.0.267",
]
types = [ # Dependencies for typing. Both types packages and mypy itself.
"mypy[reports]==1.1.1",
Expand Down Expand Up @@ -190,7 +190,7 @@ extend-select = [
"S701", # jinja2 templates without autoescape
"B0", # Common mistakes and typos.
"RUF001", "RUF002", "RUF003", # Ambiguous unicode characters
"RUF004", # Keyword arguments must come after starred arguments
"B026", # Keyword arguments must come after starred arguments
"RUF005", # Encourages unpacking rather than concatenation
"RUF100", # #noqa directive that doesn't flag anything.
]
Expand Down

0 comments on commit 8b6e945

Please sign in to comment.