-
Notifications
You must be signed in to change notification settings - Fork 15
ci: This PR is to trigger periodic CI testing #227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
[citest] |
5fe3358 to
70bb771
Compare
Reviewer's GuideAdds an Ansible aggregate callback plugin used in CI to capture and print all non-removed packages requested via package-related modules, enabling inspection of package usage across test runs. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
| result._result["results"], list | ||
| ): | ||
| results = result._result["results"] | ||
| for item in results: |
Check failure
Code scanning / CodeQL
Potentially uninitialized local variable
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 30 days ago
In general, to fix a “potentially uninitialized local variable” problem, either (1) initialize the variable to a safe default before any conditional assignments or (2) ensure all control-flow paths that reach its use have definitely assigned it (for example, by adding else cases or early returns).
Here, the safest change without altering existing behavior is:
- Initialize
resultsto an empty list before theif/elifchain. - After the chain, only iterate over
resultsif it is non-empty; otherwise, simply skip the loop so noUnboundLocalErrorcan occur.
This preserves current behavior whenresultsis defined as before, while making the code no-op (rather than crash) in the rare case that neither condition is met.
Concretely in tests/callback_plugins/dump_packages.py:
- In
CallbackModule.v2_runner_on_ok, addresults = []right afterpackages = set(). - Wrap the
for item in results:loop and subsequent package processing in anif results:guard so it only executes whenresultshas been set to something meaningful.
No new imports or helper methods are required.
-
Copy modified line R48 -
Copy modified lines R55-R66
| @@ -45,20 +45,22 @@ | ||
| and fields["args"].get("state") != "absent" | ||
| ): | ||
| packages = set() | ||
| results = [] | ||
| if "invocation" in result._result: | ||
| results = [result._result] | ||
| elif "results" in result._result and isinstance( | ||
| result._result["results"], list | ||
| ): | ||
| results = result._result["results"] | ||
| for item in results: | ||
| pkgs = item["invocation"]["module_args"]["name"] | ||
| if isinstance(pkgs, list): | ||
| for ii in pkgs: | ||
| packages.add(ii) | ||
| else: | ||
| packages.add(pkgs) | ||
| # tell python black that this line is ok | ||
| # fmt: off | ||
| self._display.display("lsrpackages: " + " ".join(sorted(list(packages)))) | ||
| # fmt: on | ||
| if results: | ||
| for item in results: | ||
| pkgs = item["invocation"]["module_args"]["name"] | ||
| if isinstance(pkgs, list): | ||
| for ii in pkgs: | ||
| packages.add(ii) | ||
| else: | ||
| packages.add(pkgs) | ||
| # tell python black that this line is ok | ||
| # fmt: off | ||
| self._display.display("lsrpackages: " + " ".join(sorted(list(packages)))) | ||
| # fmt: on |
|
[citest] |
70bb771 to
d662139
Compare
|
[citest] |
1 similar comment
|
[citest] |
|
[citest] |
74b344f to
9415af4
Compare
This PR is for the purpose of triggering periodic CI testing. We don't currently have a way to trigger CI without a PR, so this PR serves that purpose.
Summary by Sourcery
Tests: