Commit e2dbb9de authored by Thiago Kenji Okada's avatar Thiago Kenji Okada
Browse files

nixos-rebuild-ng: add string concatenation linter

parent 8481fa78
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@ def get_parser() -> tuple[argparse.ArgumentParser, dict[str, argparse.ArgumentPa
        "--attr",
        "-A",
        help="Enable and build the NixOS system from nix file and use the "
        + "specified attribute path from file specified by the --file option",
        "specified attribute path from file specified by the --file option",
    )
    main_parser.add_argument(
        "--flake",
@@ -118,7 +118,7 @@ def get_parser() -> tuple[argparse.ArgumentParser, dict[str, argparse.ArgumentPa
        "--install-bootloader",
        action="store_true",
        help="Causes the boot loader to be (re)installed on the device specified "
        + "by the relevant configuration options",
        "by the relevant configuration options",
    )
    main_parser.add_argument(
        "--install-grub",
@@ -143,7 +143,7 @@ def get_parser() -> tuple[argparse.ArgumentParser, dict[str, argparse.ArgumentPa
        "--upgrade",
        action="store_true",
        help="Update the root user's channel named 'nixos' before rebuilding "
        + "the system and channels which have a file named '.update-on-nixos-rebuild'",
        "the system and channels which have a file named '.update-on-nixos-rebuild'",
    )
    main_parser.add_argument(
        "--upgrade-all",
@@ -187,7 +187,7 @@ def get_parser() -> tuple[argparse.ArgumentParser, dict[str, argparse.ArgumentPa
    main_parser.add_argument(
        "--image-variant",
        help="Selects an image variant to build from the "
        + "config.system.build.images attribute of the given configuration",
        "config.system.build.images attribute of the given configuration",
    )
    main_parser.add_argument("action", choices=Action.values(), nargs="?")

@@ -322,7 +322,7 @@ def reexec(
                # - Exec format error (e.g.: another OS/CPU arch)
                logger.warning(
                    "could not re-exec in a newer version of nixos-rebuild, "
                    + "using current version",
                    "using current version",
                    exc_info=logger.isEnabledFor(logging.DEBUG),
                )
                # We already run clean-up, let's re-exec in the current version
@@ -422,7 +422,7 @@ def execute(argv: list[str]) -> None:
                if args.image_variant not in variants:
                    raise NRError(
                        "please specify one of the following "
                        + "supported image variants via --image-variant:\n"
                        "supported image variants via --image-variant:\n"
                        + "\n".join(f"- {v}" for v in variants)
                    )

+1 −1
Original line number Diff line number Diff line
@@ -652,7 +652,7 @@ def switch_to_configuration(
    if r.returncode:
        logger.debug(
            "skipping systemd-run to switch configuration since systemd is "
            + "not working in target host"
            "not working in target host"
        )
        cmd = []

+3 −3
Original line number Diff line number Diff line
@@ -55,12 +55,12 @@ class Remote:
            if o in ["-t", "-tt", "RequestTTY=yes", "RequestTTY=force"]:
                logger.warning(
                    f"detected option '{o}' in NIX_SSHOPTS. SSH's TTY may "
                    + "cause issues, it is recommended to remove this option"
                    "cause issues, it is recommended to remove this option"
                )
                if not ask_sudo_password:
                    logger.warning(
                        "if you want to prompt for sudo password use "
                        + "'--ask-sudo-password' option instead"
                        "'--ask-sudo-password' option instead"
                    )


@@ -161,7 +161,7 @@ def run_wrapper(
        if sudo and remote and remote.sudo_password is None:
            logger.error(
                "while running command with remote sudo, did you forget to use "
                + "--ask-sudo-password?"
                "--ask-sudo-password?"
            )
        raise

+10 −9
Original line number Diff line number Diff line
@@ -39,37 +39,38 @@ ignore_missing_imports = true

[tool.ruff.lint]
extend-select = [
    # Enforce type annotations
    # enforce type annotations
    "ANN",
    # don't shadow built-in names
    "A",
    # Better list/set/dict comprehensions
    # better list/set/dict comprehensions
    "C4",
    # Check for debugger statements
    # check for debugger statements
    "T10",
    # ensure imports are sorted
    "I",
    # Automatically upgrade syntax for newer versions
    # automatically upgrade syntax for newer versions
    "UP",
    # detect common sources of bugs
    "B",
    # Ruff specific rules
    # ruff specific rules
    "RUF",
    # require `check` argument for `subprocess.run`
    "PLW1510",
    # check for needless exception names in raise statements
    "TRY201",
    # Pythonic naming conventions
    # pythonic naming conventions
    "N",
    # string concatenation rules
    "ISC001",
    "ISC002",
    "ISC003",
]
ignore = [
    # allow Any type
   "ANN401"
]

[tool.ruff.lint.per-file-ignores]
"tests/" = ["FA102"]

[tool.pytest.ini_options]
pythonpath = ["."]
addopts = "--import-mode=importlib"