1423 Commits

Author SHA1 Message Date
Alexander Popov
93746f4667 Update example_sysctls.txt from a dummy Ubuntu VM again
Some checks failed
engine unit-test / engine_unit-test (3.13) (push) Has been cancelled
engine unit-test no coverage / engine_unit-test_no-coverage (3.13) (push) Has been cancelled
functional test / functional_test (3.10) (push) Has been cancelled
functional test / functional_test (3.11) (push) Has been cancelled
functional test / functional_test (3.12) (push) Has been cancelled
functional test / functional_test (3.13) (push) Has been cancelled
functional test / functional_test (3.9) (push) Has been cancelled
functional test no coverage / functional_test_no-coverage (3.10) (push) Has been cancelled
functional test no coverage / functional_test_no-coverage (3.11) (push) Has been cancelled
functional test no coverage / functional_test_no-coverage (3.12) (push) Has been cancelled
functional test no coverage / functional_test_no-coverage (3.13) (push) Has been cancelled
functional test no coverage / functional_test_no-coverage (3.9) (push) Has been cancelled
package test / package_test (3.10) (push) Has been cancelled
package test / package_test (3.11) (push) Has been cancelled
package test / package_test (3.12) (push) Has been cancelled
package test / package_test (3.13) (push) Has been cancelled
package test / package_test (3.9) (push) Has been cancelled
static analysis / static_analysis (3.13) (push) Has been cancelled
20260108 kernel-hardening-checker-2026-01-08
2025-12-27 21:41:07 +03:00
Alexander Popov
cfb56cabd7 Move the mirror to SourceCraft 2025-12-27 19:20:47 +03:00
Alexander Popov
0bcde64140 Fix ruff's ISC004 (part II) 2025-12-20 15:47:18 +03:00
Alexander Popov
78c566b681 Fix ruff's ISC004 (unparenthesized implicit string concatenation in collection) 2025-12-20 15:34:03 +03:00
Alexander Popov
ef163e2a4e Reorder the badges 2025-12-20 15:13:53 +03:00
Alexander Popov
e2890ca735 CI: Check bin/kernel-hardening-checker with pylint 2025-12-13 21:50:05 +03:00
Alexander Popov
0adbbd64c6 Merge branch 'ruff'
Refers to #212.
2025-12-13 21:38:30 +03:00
Alexander Popov
a62eea25de Add ruff to CI! 2025-12-13 20:46:06 +03:00
Alexander Popov
6a4cd3d1a9 Fix the import order in bin/kernel-hardening-checker 2025-12-13 20:46:06 +03:00
Alexander Popov
e1522dedd9 Ignore the ruff E402 rule for bin/kernel-hardening-checker 2025-12-13 20:46:06 +03:00
Alexander Popov
1183e74162 Improve the comments in [tool.ruff.lint.per-file-ignores] 2025-12-13 20:46:06 +03:00
Alexander Popov
94bae0f6bf Don't ignore the ruff PLR5501 rule (we fixed the errors) 2025-12-13 20:46:06 +03:00
Alexander Popov
14c7ed368a Don't ignore the ruff E202 and E502 rules (we fixed the errors) 2025-12-13 20:46:06 +03:00
Alexander Popov
e3cf44aa30 Mute the ruff PLR0912 rule globally 2025-12-13 20:46:06 +03:00
Alexander Popov
28b09c634b Drop the unneeded changes in the pylint default settings 2025-12-13 20:46:06 +03:00
Alexander Popov
d104af82d9 Drop the unneeded ruff PLR2004 exception (magic number refactoring is done) 2025-12-13 20:46:06 +03:00
Alexander Popov
04ae6d8034 Style fix 2025-12-13 20:46:06 +03:00
Alexander Popov
77a8efee65 Improve the comments for the ignored ruff rules 2025-12-13 19:45:21 +03:00
Alexander Popov
13c1b8343f Configure flake8-copyright to avoid false warnings 2025-12-13 19:32:32 +03:00
Alexander Popov
434e946b25 Use elif instead of else then if, to reduce indentation (fix PLR0915) 2025-12-13 19:26:00 +03:00
Alexander Popov
2103b38535 Use a list comprehension to create a transformed list (fix PERF401) 2025-12-13 19:19:16 +03:00
Alexander Popov
646f6c83aa Rewrite unnecessary map() usage using a generator expression (fix C417) 2025-12-13 19:12:38 +03:00
Alexander Popov
b086285ed0 __init__.py: Introduce generate_kconfig_fragment() 2025-12-13 18:42:37 +03:00
Alexander Popov
80755f3c18 __init__.py: Introduce print_recommendations() 2025-12-13 18:42:14 +03:00
Alexander Popov
a3319f4f5e __init__.py: Introduce check_configuration() 2025-12-13 18:41:13 +03:00
Alexander Popov
f34f4c3cbb __init__.py: Introduce check_autodetected_configuration() 2025-12-13 18:38:47 +03:00
Alexander Popov
7859f3e2a2 Fix SIM102 (use a single if statement instead of nested if statements) 2025-12-13 18:37:08 +03:00
Alexander Popov
dab2ef90f7 Fix SIM910 (dict-get-with-none-default) 2025-12-13 18:35:14 +03:00
Alexander Popov
83d0f992e5 Get rid of magic numbers (PLR2004) 2025-12-13 17:47:08 +03:00
Alexander Popov
e9026dee41 Fix E202 (whitespace before ']') 2025-12-13 17:19:35 +03:00
Willenst
4055542d93 Drop unneded \ in test_engine.py 2025-12-13 16:30:19 +03:00
Alexander Popov
57b29b0711 Make __init__.py executable 2025-12-13 16:29:40 +03:00
Willenst
2dea59f0c8 Add a trailing comma through the code.
The presence of a trailing comma can reduce diff size when parameters or elements are added or removed from function calls, function definitions, literals, etc.

Ruff rule: https://docs.astral.sh/ruff/rules/missing-trailing-comma/
2025-12-13 16:24:13 +03:00
Willenst
fbfec0030b Replace string in re.match with raw string
Regular expressions should be written using raw strings to avoid double escaping

Ruff rule: https://docs.astral.sh/ruff/rules/unraw-re-pattern/
2025-12-13 16:22:40 +03:00
Willenst
9794b7dd7b Unify the quotes in the code
Ruff rules:
- https://docs.astral.sh/ruff/rules/unnecessary-escaped-quote/
- https://docs.astral.sh/ruff/rules/bad-quotes-inline-string/
2025-12-13 16:08:31 +03:00
Willenst
8573d5d149 Simplify __init__.py code
To make code a bit more idiomatic

Ruff rule: https://docs.astral.sh/ruff/rules/non-augmented-assignment/
2025-12-13 16:05:29 +03:00
Alexander Popov
00676de06d Fix the ruff PLC1901 error (simplify comparing with empty string) 2025-12-13 16:04:40 +03:00
Alexander Popov
93b6b8c2f2 Fix the ruff PLW2901 error (don't overwrite the loop variable) 2025-12-13 15:56:21 +03:00
Willenst
f65170c615 Sort imports in all scripts
For better readability and overall beauty

Ruff rule: https://docs.astral.sh/ruff/rules/unsorted-imports/#unsorted-imports-i001
2025-12-13 15:42:08 +03:00
Willenst
5be9d4bada Change literal-memberships from list to sets
When testing for membership in a static sequence, prefer a set literal over a list or tuple, as Python optimizes set membership tests. Not a big of an issue, since we have small lists, but for overall codestyle.

Ruff rule: https://docs.astral.sh/ruff/rules/literal-membership/
2025-12-13 15:33:28 +03:00
Alexander Popov
9a6593aedf Enable the pylint line-too-long check 2025-12-13 15:23:27 +03:00
Alexander Popov
3f2c6601fc Fix ruff E501 errors and drop some per-file-ignores statements 2025-12-13 15:15:37 +03:00
Willenst
70eafc1007 Add whitespace after each assertion
Since assert is a statement, we must add whitespace after it
Ruff rule: https://docs.astral.sh/ruff/rules/missing-whitespace-after-keyword/
2025-12-13 14:30:51 +03:00
Willenst
1f2a9ed55c Improve the comments throughout the code
Per PEP 8, inline comments should be separated by at least two spaces from the preceding statement.

Ruff rule: https://docs.astral.sh/ruff/rules/too-few-spaces-before-inline-comment/
2025-12-13 14:28:13 +03:00
Willenst
50d999f037 Drop unneded whitespaces in test_engine.py code
According to PEP 8, operators should be surrounded by at most a single space on either side.
Ref: https://peps.python.org/pep-0008/#whitespace-in-expressions-and-statements
Ruff rule: https://docs.astral.sh/ruff/rules/multiple-spaces-before-operator
2025-12-13 14:26:41 +03:00
Alexander Popov
473aea74df Add some more ruff rules and reorder them according to the documentation 2025-12-13 14:21:17 +03:00
Alexander Popov
d77d1fce16 Move ruff settings to the end of pyproject.toml 2025-12-13 13:53:20 +03:00
Willenst
322e7a0f59 Add ruff rules setup 2025-12-13 13:46:15 +03:00
Alexander Popov
a1030ff5f1 Merge branch 'apparmor'
Refers to #209.
2025-12-13 09:18:01 +03:00
Alexander Popov
52e26c9292 Avoid false negative errors for distros without AppArmor 2025-12-13 09:05:05 +03:00