Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
024dd81
ruff: use single quotes for multiline strings
yuwata Feb 20, 2026
70a5871
ruff: do not warn about too long line and lambda assignment
yuwata Feb 21, 2026
d22033c
ycm: apply "ruff format" and "ruff check --fix"
yuwata Feb 19, 2026
71e7a03
hwdb/acpi-update: apply "ruff format"
yuwata Feb 19, 2026
51c2458
hwdb/ids_parser: apply "ruff format" and "ruff check --fix"
yuwata Feb 20, 2026
d4c0f7c
hwdb/parse_hwdb: apply "ruff format" and "ruff check --fix"
yuwata Feb 19, 2026
be3b78c
man/90-rearrange-path: apply "ruff format" and "ruff check --fix"
yuwata Feb 19, 2026
04da08a
man/check-os-release-simple: apply "ruff format"
yuwata Feb 19, 2026
40dc908
man/check-os-release: apply "ruff format"
yuwata Feb 19, 2026
41fbbba
man/notify-example: apply "ruff format"
yuwata Feb 19, 2026
def3f20
filesystem-sets: apply "ruff format" and "ruff check --fix"
yuwata Feb 19, 2026
7c2c235
fuzz-bootspec: apply "ruff format"
yuwata Feb 19, 2026
3232f93
generate-syscall: apply "ruff format" and "ruff check --fix"
yuwata Feb 19, 2026
2f67c83
log-generator: apply "ruff format" and "ruff check --fix"
yuwata Feb 19, 2026
2f24b62
ethtool-link-mode: apply "ruff format"
yuwata Feb 19, 2026
5409017
generate-dns_type: apply "ruff format" and "ruff check --fix"
yuwata Feb 19, 2026
0f53fe2
generate-syscall-list: apply "ruff check --fix"
yuwata Feb 19, 2026
be41868
test_ukify: apply "ruff format"
yuwata Feb 19, 2026
138c6d7
create-sys-script: apply "ruff format" and "ruff check --fix"
yuwata Feb 19, 2026
4a9aba8
generate-directives: apply "ruff check --fix"
yuwata Feb 19, 2026
3982a24
TEST-04-JOURNAL: apply "ruff format"
yuwata Feb 19, 2026
be8b41e
networkd-test: apply "ruff format" and "ruff check --fix"
yuwata Feb 19, 2026
acbf435
rule-syntax-check: apply "ruff format" and "ruff check --fix"
yuwata Feb 19, 2026
54929e4
run-unit-tests: apply "ruff format"
yuwata Feb 19, 2026
9ff1746
sd-script: apply "ruff format" and "ruff check --fix"
yuwata Feb 19, 2026
a72ed6a
sys-script: apply "ruff format" and "ruff check --fix"
yuwata Feb 20, 2026
3ca02dc
test-network: drop old kernel support and workaround for fixed kernel…
yuwata Feb 20, 2026
0a2cec9
test-network: assume the test is running with newer udevd
yuwata Feb 21, 2026
dd1520f
test-network: drop old ip command support
yuwata Feb 21, 2026
e865345
test-network: apply "ruff format" and "ruff check --fix"
yuwata Feb 19, 2026
8ca6364
test-shutdown: apply "ruff format"
yuwata Feb 19, 2026
74865a7
test-tmpfiles: apply "ruff format" and "ruff check --fix"
yuwata Feb 19, 2026
5fe76c1
test-udev: apply "ruff format" and "ruff check --fix"
yuwata Feb 19, 2026
b52911b
TEST-69-SHUTDOWN: apply "ruff format"
yuwata Feb 19, 2026
6cb23c1
analyze-dump-sort: apply "ruff format"
yuwata Feb 19, 2026
c4bbc02
catalog-report: apply "ruff format"
yuwata Feb 19, 2026
142d5eb
check-efi-alignment: apply "ruff format"
yuwata Feb 19, 2026
9b73d13
check-version-history: apply "ruff format" and "ruff check --fix"
yuwata Feb 19, 2026
0edd286
dbus-exporter: apply "ruff format" and "ruff check --fix"
yuwata Feb 19, 2026
f5d94c3
dump-auxv: apply "ruff format"
yuwata Feb 19, 2026
f1be21c
elf2efi: apply "ruff format" and "ruff check --fix"
yuwata Feb 19, 2026
9b10f1a
fetch-distro: apply "ruff format"
yuwata Feb 19, 2026
15b6eaa
fetch-mkosi: apply "ruff format" and "ruff check --fix"
yuwata Feb 19, 2026
7d1addf
find-unused-library-symbols: apply "ruff format" and "ruff check --fix"
yuwata Feb 19, 2026
a3e864b
gdb-sd_dump_hashmaps: apply "ruff format" and "ruff check --fix"
yuwata Feb 19, 2026
695c856
generate-gperfs: apply "ruff format"
yuwata Feb 19, 2026
608760b
list-discoverable-partitions: apply "ruff format"
yuwata Feb 19, 2026
903f85d
make-directive-index: apply "ruff format"
yuwata Feb 19, 2026
4819fe3
make-man-index: apply "ruff format"
yuwata Feb 19, 2026
b371762
meson-extract-unit-files: apply "ruff format"
yuwata Feb 19, 2026
148a448
meson-render-jinja2: apply "ruff format"
yuwata Feb 19, 2026
615e4f7
sync-docs: apply "ruff format" and "ruff check --fix"
yuwata Feb 19, 2026
5b15b3b
update-dbus-docs: apply "ruff format" and "ruff check --fix"
yuwata Feb 19, 2026
e282430
update-man-rules: apply "ruff format"
yuwata Feb 19, 2026
d5a1273
xml_helper: apply "ruff format"
yuwata Feb 19, 2026
86bf3bc
ci/linter: run ruff for all python scripts
yuwata Feb 19, 2026
795c290
fixup! fuzz-bootspec: apply "ruff format"
behrmann Feb 24, 2026
83469e5
ci: Show diffs for ruff check when possible
behrmann Feb 24, 2026
c1b7ce8
ci: Move python lint ignores to CI check
behrmann Feb 24, 2026
8d90d4c
Revert "ruff: do not warn about too long line and lambda assignment"
behrmann Feb 24, 2026
3fce3af
emacs: add settings for Python modes
behrmann Feb 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .dir-locals.el
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
(meson-mode . ((meson-indent-basic . 8)))
(sh-mode . ((sh-indentation . 4)))
(awk-mode . ((c-basic-offset . 8)))
(python-mode . ((indent-tabs-mode . nil)
(tab-width . 4)
(fill-column . 109)
(python-indent-def-block-scale . 1)))
(python-ts-mode . ((indent-tabs-mode . nil)
(tab-width . 4)
(fill-column . 109)
(python-indent-def-block-scale . 1)))
(nil . ((indent-tabs-mode . nil)
(tab-width . 8)
(fill-column . 79))) )
15 changes: 12 additions & 3 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,25 @@ jobs:
- name: Run ruff format
run: |
mkosi box -- ruff --version
if ! mkosi box -- ruff format --check src/core/generate-bpf-delegate-configs.py src/boot/generate-hwids-section.py src/test/generate-sym-test.py src/ukify/ukify.py test/integration-tests/integration-test-wrapper.py
# shellcheck disable=SC2046
if ! mkosi box -- ruff format --check $(git ls-files -- *.py | sed -e '/gen_autosuspend_rules/d')
then
echo "Please run 'ruff format' on the above files or apply the diffs below manually"
mkosi box -- ruff format --check --quiet --diff src/core/generate-bpf-delegate-configs.py src/boot/generate-hwids-section.py src/test/generate-sym-test.py src/ukify/ukify.py test/integration-tests/integration-test-wrapper.py
# shellcheck disable=SC2046
mkosi box -- ruff format --check --quiet --diff $(git ls-files -- *.py | sed -e '/gen_autosuspend_rules/d')
fi

- name: Run ruff check
run: |
mkosi box -- ruff --version
mkosi box -- ruff check src/core/generate-bpf-delegate-configs.py src/boot/generate-hwids-section.py src/test/generate-sym-test.py src/ukify/ukify.py test/integration-tests/integration-test-wrapper.py
# shellcheck disable=SC2046
if ! mkosi box -- ruff check --ignore E501,E731 $(git ls-files -- *.py | sed -e '/gen_autosuspend_rules/d')
then
echo "Please fix the errors shown by 'ruff check' on the above files or add noqa comments were appropriate"
echo "Diffs for fixes that can be programmatically generated are shown below:"
# shellcheck disable=SC2046
mkosi box -- ruff check --ignore E501,E731 --diff $(git ls-files -- *.py | sed -e '/gen_autosuspend_rules/d')
fi

- name: Configure meson
run: mkosi box -- env CC=clang CXX=clang++ meson setup build
Expand Down
45 changes: 21 additions & 24 deletions .ycm_extra_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@

import glob
import os
import ycm_core

import ycm_core

SOURCE_EXTENSIONS = (".C", ".cpp", ".cxx", ".cc", ".c", ".m", ".mm")
HEADER_EXTENSIONS = (".H", ".h", ".hxx", ".hpp", ".hh")
SOURCE_EXTENSIONS = ('.C', '.cpp', '.cxx', '.cc', '.c', '.m', '.mm')
HEADER_EXTENSIONS = ('.H', '.h', '.hxx', '.hpp', '.hh')


def DirectoryOfThisScript():
Expand All @@ -69,19 +69,18 @@ def GuessBuildDirectory():
containing '.ninja_log' file two levels above the current directory;
returns this single directory only if there is one candidate.
"""
result = os.path.join(DirectoryOfThisScript(), "build")
result = os.path.join(DirectoryOfThisScript(), 'build')

if os.path.exists(result):
return result

result = glob.glob(os.path.join(DirectoryOfThisScript(),
"..", "..", "*", ".ninja_log"))
result = glob.glob(os.path.join(DirectoryOfThisScript(), '..', '..', '*', '.ninja_log'))

if not result:
return ""
return ''

if 1 != len(result):
return ""
return ''

return os.path.split(result[0])[0]

Expand All @@ -106,9 +105,7 @@ def TraverseByDepth(root, include_extensions):
# print(subdirs)
if include_extensions:
get_ext = os.path.splitext
subdir_extensions = {
get_ext(f)[-1] for f in file_list if get_ext(f)[-1]
}
subdir_extensions = {get_ext(f)[-1] for f in file_list if get_ext(f)[-1]}
if subdir_extensions & include_extensions:
result.add(root_dir)
else:
Expand All @@ -119,11 +116,11 @@ def TraverseByDepth(root, include_extensions):
return result


_project_src_dir = os.path.join(DirectoryOfThisScript(), "src")
_include_dirs_set = TraverseByDepth(_project_src_dir, frozenset({".h"}))
_project_src_dir = os.path.join(DirectoryOfThisScript(), 'src')
_include_dirs_set = TraverseByDepth(_project_src_dir, frozenset({'.h'}))
flags = [
"-x",
"c"
'-x',
'c',
# The following flags are partially redundant due to the existence of
# 'compile_commands.json'.
# '-Wall',
Expand All @@ -135,7 +132,7 @@ def TraverseByDepth(root, include_extensions):
]

for include_dir in _include_dirs_set:
flags.append("-I" + include_dir)
flags.append('-I' + include_dir)

# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
Expand Down Expand Up @@ -165,13 +162,13 @@ def MakeRelativePathsInFlagsAbsolute(flags, working_directory):
return list(flags)
new_flags = []
make_next_absolute = False
path_flags = ["-isystem", "-I", "-iquote", "--sysroot="]
path_flags = ['-isystem', '-I', '-iquote', '--sysroot=']
for flag in flags:
new_flag = flag

if make_next_absolute:
make_next_absolute = False
if not flag.startswith("/"):
if not flag.startswith('/'):
new_flag = os.path.join(working_directory, flag)

for path_flag in path_flags:
Expand All @@ -180,7 +177,7 @@ def MakeRelativePathsInFlagsAbsolute(flags, working_directory):
break

if flag.startswith(path_flag):
path = flag[len(path_flag):]
path = flag[len(path_flag) :]
new_flag = path_flag + os.path.join(working_directory, path)
break

Expand Down Expand Up @@ -213,8 +210,7 @@ def GetCompilationInfoForFile(filename):
for extension in SOURCE_EXTENSIONS:
replacement_file = basename + extension
if os.path.exists(replacement_file):
compilation_info = \
database.GetCompilationInfoForFile(replacement_file)
compilation_info = database.GetCompilationInfoForFile(replacement_file)
if compilation_info.compiler_flags_:
return compilation_info
return None
Expand All @@ -238,13 +234,14 @@ def FlagsForFile(filename, **kwargs):

final_flags = MakeRelativePathsInFlagsAbsolute(
compilation_info.compiler_flags_,
compilation_info.compiler_working_dir_)
compilation_info.compiler_working_dir_,
)

else:
relative_to = DirectoryOfThisScript()
final_flags = MakeRelativePathsInFlagsAbsolute(flags, relative_to)

return {
"flags": final_flags,
"do_cache": True
'flags': final_flags,
'do_cache': True,
}
2 changes: 2 additions & 0 deletions hwdb.d/acpi-update.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

# pylint: disable=consider-using-with


def read_table(filename):
table = list(reader(open(filename, newline='')))
table = table[1:] # Skip header
Expand All @@ -15,6 +16,7 @@ def read_table(filename):
# a mistake, strip it.
print(f'\nacpi:{row[1].strip()}*:\n ID_VENDOR_FROM_DATABASE={row[0].strip()}')


print('''\
# This file is part of systemd.
#
Expand Down
Loading