App: Miscellaneous fixes and improvements based on AI code analysis #44

Merged
Jan Lindemann merged 8 commits from jan/feature/20260630-app-get-values-filter-out-empty-split-results into master 2026-06-30 15:21:31 +02:00 AGit

8 commits

Author SHA1 Message Date
a2a4312f5b
App.get_values(): Filter out empty split results
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m20s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m29s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m0s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m14s
CI / Packaging test (push) Successful in 0s

get_values() splits comma-separated values and strips whitespace but does not filter out empty strings. A value like "a, b, " produces ['a', 'b', ''], with an empty string at the end. This empty string propagates to callers like CmdRequiredOsPkg.py and pollutes output. Add a filter for non-empty stripped values.

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-06-30 15:07:42 +02:00
42f064de89
App.get_value(): Fix FileNotFoundError regression

The refactored __get_project_conf() raises FileNotFoundError when project.conf does not exist, whereas the original read_value() returns None. This causes get_value() to crash for projects with missing or incomplete project.conf files.

Catch FileNotFoundError in __get_project_conf() and return None to restore original behavior. Remove redundant @cache from __read_project_conf() since __get_project_conf() already provides caching.

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-06-30 15:07:24 +02:00
24d67a5ec0
App: Return cycle path from find_circular_deps()

The __find_circular_deps() and find_circular_deps() methods now return list[str] instead of bool. On a cycle, the path builds up the dependency chain in __find_circular_deps_recursive(), and __find_circular_deps() appends the closing project to complete the cycle. An empty list means no cycle found.

CmdDep prints the cycle as 'a -> b -> c -> a' instead of a generic message.

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-06-30 15:06:11 +02:00
fdae5ad122
App.get_value(): Remove redundant fd.close()

The fd.close() call inside the `with open(...) as fd:` block is redundant because the file handle is managed by the context manager. Remove it.

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-06-30 14:44:34 +02:00
09e41df0ed
App.__proj_dir(): Use configurable ___opt_root

Replace the hardcoded /opt in __proj_dir() with a configurable ___opt_root member, consistent with how __projs_root is configured.

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-06-30 14:44:32 +02:00
59a0e2ada8
App.find_dir/__find_dir(): Fix mutable default args

Mutable default arguments (list) cause unexpected shared state between calls. Use None as default and initialise to [] inside the function body.

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-06-30 14:44:29 +02:00
a61a55c696
App: Remove dead None check in __read_dep_graph()

get_project_refs() always returns a list[str], never None. The `if deps is None: continue` check in __read_dep_graph() is dead code, remove it.

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-06-30 14:44:26 +02:00
83d6f4b2df
App.__find_circular_deps(): Move __flip_dep_graph() out

The __flip_dep_graph(graph) call sits inside the while loop and performs redundant graph flipping on every iteration. Hoist it outside to compute once and reuse the result.

Assisted-by: unsloth/Qwen3.6-35B-A3B-GGUF:IQ4_NL and pi.dev
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-06-30 14:44:23 +02:00