Skip to content

Commit

Permalink
Merge pull request #3052 from behrmann/ruffformat
Browse files Browse the repository at this point in the history
Format with ruff
  • Loading branch information
DaanDeMeyer authored Sep 21, 2024
2 parents f2383b6 + 296d13f commit 347ccd0
Show file tree
Hide file tree
Showing 51 changed files with 1,907 additions and 1,424 deletions.
8 changes: 6 additions & 2 deletions .dir-locals.el
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@

((python-mode . ((indent-tabs-mode . nil)
(tab-width . 4)
(fill-column . 99)))
(fill-column . 109)))
(python-ts-mode . ((indent-tabs-mode . nil)
(tab-width . 4)
(fill-column . 109)))
(sh-mode . ((sh-basic-offset . 4)
(sh-indentation . 4)))
(markdown-mode . ((fill-column . 109)))
(nil . ((indent-tabs-mode . nil)
(tab-width . 4)
(fill-column . 79))) )
(fill-column . 79))))
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ charset = utf-8
indent_style = space
indent_size = 4

[*.{py,md}]
max_line_length = 109

[*.yaml,*.yml]
indent_size = 2
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,16 @@ jobs:
python3 -m pip install --break-system-packages codespell mypy reuse ruff
npm install -g pyright
- name: Run ruff
- name: Run ruff check
run: |
ruff --version
ruff check mkosi/ tests/ kernel-install/50-mkosi.install
- name: Run ruff format
run: |
ruff --version
ruff format --check mkosi/ tests/ kernel-install/50-mkosi.install
- name: Check that tabs are not used in code
run: sh -c '! git grep -P "\\t" "*.py"'

Expand Down
14 changes: 9 additions & 5 deletions kernel-install/50-mkosi.install
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ def main() -> None:
log_setup()

parser = argparse.ArgumentParser(
description='kernel-install plugin to build initrds or Unified Kernel Images using mkosi',
description="kernel-install plugin to build initrds or Unified Kernel Images using mkosi",
allow_abbrev=False,
usage='50-mkosi.install COMMAND KERNEL_VERSION ENTRY_DIR KERNEL_IMAGE INITRD…',
usage="50-mkosi.install COMMAND KERNEL_VERSION ENTRY_DIR KERNEL_IMAGE INITRD…",
)

parser.add_argument(
Expand Down Expand Up @@ -139,7 +139,11 @@ def main() -> None:
if context.layout != "uki" and context.initrds:
return

format = OutputFormat.uki if context.layout == "uki" and context.uki_generator == "mkosi" else OutputFormat.cpio
if context.layout == "uki" and context.uki_generator == "mkosi":
format = OutputFormat.uki
else:
format = OutputFormat.cpio

output = "initrd" if format == OutputFormat.cpio else "uki"

cmdline: list[PathString] = [
Expand All @@ -148,7 +152,7 @@ def main() -> None:
"--format", str(format),
"--output", output,
"--output-dir", context.staging_area,
]
] # fmt: skip

if context.verbose:
cmdline += ["--debug"]
Expand All @@ -167,5 +171,5 @@ def main() -> None:
(context.staging_area / f"{output}.initrd").unlink()


if __name__ == '__main__':
if __name__ == "__main__":
main()
Loading

0 comments on commit 347ccd0

Please sign in to comment.