Skip to content

Cleanup: part 2#30

Closed
ngie-eign wants to merge 8 commits into
markjdb:masterfrom
ngie-eign:cleanup-pt-2
Closed

Cleanup: part 2#30
ngie-eign wants to merge 8 commits into
markjdb:masterfrom
ngie-eign:cleanup-pt-2

Conversation

@ngie-eign

Copy link
Copy Markdown
  • Resolve issues with enum class use and apply best practices.
  • Fix makefs(8) command specification.
  • Re-raise exceptions without mangling the traceback stack.
  • Apply best practice when forming SQLite3 query.
  • Use collection unpacking instead of concatenating collections using the + operator for efficiency reasons.

Requires: #29

ngie-eign added 6 commits May 20, 2026 15:58
Signed-off-by: Enji Cooper <ngie@FreeBSD.org>
This ignores a lot more autogenerated paths which should not be checked
in to :master.

Signed-off-by: Enji Cooper <ngie@FreeBSD.org>
RUF005 (`collection-literal-concatenation`) suggests that the `+`
operator should not be used when concatenating collections as `+`
is less efficient than using the `*` or `**` operators unpacking the
relevant collections.

Signed-off-by: Enji Cooper <ngie@FreeBSD.org>
The latter pattern mangles the traceback stack and should not be used.

Signed-off-by: Enji Cooper <ngie@FreeBSD.org>
As noted in the sqlite3 module documentation, string interpolation using
%s, f-strings, etc, is discouraged because of potential security risks.
In this case, there isn't an exploitable path, but applying the
best-practice is wise here in case the pattern is copied to other places
by accident and it becomes a true exploit concern.

Signed-off-by: Enji Cooper <ngie@FreeBSD.org>
Add missing comma between command arguments so the 2 string literals
aren't pasted together.

Signed-off-by: Enji Cooper <ngie@FreeBSD.org>
@ngie-eign ngie-eign changed the title Cleanup pt 2 Cleanup: part 2 May 21, 2026
`IntEnum` and `StrEnum` provide certain facilities out of the box that the
`Enum` class doesn't provide -- in particular, they can be treated like
`int` and `str` in certain scenarios.

Use `auto` while here to avoid hardcoding constants with `ANSIColour`.

Finally, fix Enum definitions: trailing commas are not technically allowed
when defining enums; python treats values with trailing commas like
tuples instead of scalars.

Signed-off-by: Enji Cooper <ngie@FreeBSD.org>
@ngie-eign ngie-eign force-pushed the cleanup-pt-2 branch 2 times, most recently from e0e370e to bcf4a33 Compare May 21, 2026 03:10
This helps provides the building blocks for improving on this tool.

- ruff provides consistent linting capabilities.
- tox helps with running automated checks/tests.

I started with the `bricoler.utils` module because it's the most
self-contained piece of code that can be easily tested. Other pieces of
the tool are much more tightly coupled, and thus more difficult to test
in isolation.

Signed-off-by: Enji Cooper <ngie@FreeBSD.org>
@ngie-eign ngie-eign mentioned this pull request May 21, 2026
@ngie-eign ngie-eign closed this May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant