ENT-12114: Fix poor commit message when a module is removed with dependencies#305
Merged
larsewi merged 1 commit intocfengine:masterfrom Mar 9, 2026
Merged
Conversation
51770a1 to
0a58823
Compare
larsewi
requested changes
Mar 9, 2026
cfbs/commands.py
Outdated
|
|
||
| num_lines = len(msg.strip().splitlines()) | ||
| changes_made = num_lines > 0 | ||
| dependencies = set(dependencies) |
Contributor
There was a problem hiding this comment.
Maybe this could be a set to begin with?
cfbs/commands.py
Outdated
Comment on lines
+507
to
+520
| def _someone_needs_me(this) -> bool: | ||
| if ("added_by" not in this) or is_module_added_manually(this["added_by"]): | ||
| return True | ||
| for other in config["build"]: | ||
| if "dependencies" not in other: | ||
| continue | ||
| if this["name"] in other["dependencies"]: | ||
| return _someone_needs_me(other) | ||
| return False | ||
|
|
||
| tmp = [mod for mod in config["build"] if mod["name"] in dependencies] | ||
| for module in tmp: | ||
| if not _someone_needs_me(module): | ||
| deps.append(module) |
Contributor
There was a problem hiding this comment.
This code looks very familiar. Maybe you can move it outside of the function scope and reuse it?
cfbs/commands.py
Outdated
| "The following modules were added as dependencies but are no longer needed:" | ||
| ) | ||
| for module in deps: | ||
| name = module["name"] if "name" in module else "" |
Contributor
There was a problem hiding this comment.
Here and on the other ones
Suggested change
| name = module["name"] if "name" in module else "" | |
| name = module.get("name", "") |
0a58823 to
9df6c5c
Compare
…ndencies Ticket: ENT-12114 Signed-off-by: Simon Halvorsen <simon.halvorsen@northern.tech>
9df6c5c to
1cd6dd9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket: ENT-12114