Repository navigation
fix(ci): green workflows — bandit args, pysat CNF API, TUI importorskip, OIDC publish #45
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
Changes from all commits
9d54846
8092fe2
6a47282
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,9 +10,9 @@ build: | |
|
|
||
| commands: | ||
| - python -m pip install --upgrade pip | ||
| - python -m pip install -e ".[dev,web]" | ||
| - python -m pip install -e ".[dev,web,tui]" | ||
| - python -m pip install sphinx sphinx-rtd-theme myst-parser | ||
| - sphinx-build -W -b html docs docs/_build/html | ||
| - sphinx-build -b html docs docs/_build/html | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- .readthedocs.yaml ---'
cat -n .readthedocs.yaml
printf '%s\n' '--- Sphinx configuration and requirements references ---'
rg -n --hidden -S 'sphinx|sphinx-build|fail-on-warning|warning-is-error|nitpicky|readthedocs' \
.readthedocs.yaml docs pyproject.toml setup.cfg setup.py requirements*.txt 2>/dev/null || trueRepository: dominicusin/package-maximizer Length of output: 1677 🌐 Web query:
💡 Result: In Sphinx, the default behavior of sphinx-build is to report warnings to the standard error stream without stopping the build or returning a non-zero exit status [1][2]. To change this behavior so that the build process fails when warnings are encountered, you must explicitly enable error handling for warnings [1][3]. The standard way to force a build to fail on warnings is by using the -W or --fail-on-warning flag [1][4]. Key details regarding this functionality include: 1. Flag usage: When running sphinx-build, pass the -W or --fail-on-warning flag [1][4]. This causes the build process to exit with a status code of 1 if any warnings are generated [1][4]. 2. Evolution of behavior: - In versions of Sphinx prior to 8.1, the -W flag would stop the build immediately upon encountering the first warning unless the --keep-going flag was also provided [1][4]. - As of Sphinx 8.1, --fail-on-warning is designed to run the entire build to completion and then exit with a status of 1 if any warnings were present [1][4]. The --keep-going flag is now effectively always enabled and is retained only for backward compatibility [1][4]. 3. Alternative approaches: - For configuration-based control, you can set warning_is_error = True in your conf.py file. - If you require the build to stop and raise an actual Python exception (e.g., for debugging with --pdb), you can use the newer --exception-on-warning flag introduced in Sphinx 8.1 [5][4]. If your build is not failing despite using these flags, ensure that: - The flags are placed correctly in the command line syntax. For example, when using the -M option, options like --fail-on-warning must be passed after the source and output directories [1][4]. - You are not inadvertently suppressing the specific warnings that would otherwise cause a failure [2]. - You are checking the exit status of the sphinx-build command in your CI/CD pipeline or shell script, as the build process might complete its output even if it returns a non-zero exit code [1][4]. Citations:
Keep the warnings-as-errors gate. The Read the Docs configuration runs 🤖 Prompt for AI Agents |
||
|
|
||
| sphinx: | ||
| configuration: docs/conf.py | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,7 +85,7 @@ def solve(self, packages: Iterable[Package]) -> list[str]: | |
| for conflict in pkg.conflicts: | ||
| if conflict in var_map: | ||
| # Добавляем ограничение: не (x[pkg] и x[conflict]) | ||
| cnf.add_clause([-var_map[pkg.name], -var_map[conflict]]) | ||
| cnf.append([-var_map[pkg.name], -var_map[conflict]]) | ||
|
|
||
| # Бинарный поиск для нахождения максимального числа пакетов | ||
| low = 0 | ||
|
|
@@ -177,7 +177,7 @@ def solve_with_weights( | |
| for p in test_packages: | ||
| for conflict in p.conflicts: | ||
| if conflict in var_map: | ||
| cnf.add_clause([-var_map[p.name], -var_map[conflict]]) | ||
| cnf.append([-var_map[p.name], -var_map[conflict]]) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Force the candidate set during the SAT check. At Line 180, the CNF contains only negative conflict clauses. Add unit clauses for every name in Proposed fix for p in test_packages:
for conflict in p.conflicts:
if conflict in var_map:
cnf.append([-var_map[p.name], -var_map[conflict]])
+
+ for name in selected_names:
+ cnf.append([var_map[name]])
+ cnf.append([var_map[pkg.name]])🤖 Prompt for AI Agents |
||
|
|
||
| # Проверяем, есть ли решение | ||
| with Solver(name=self.solver_name) as solver: | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -68,14 +68,13 @@ def test_complex_conflicts(self): | |||||||||
| # pkg4 and pkg5 have no conflicts, so they should both be selected | ||||||||||
| assert "pkg4" in result | ||||||||||
| assert "pkg5" in result | ||||||||||
|
|
||||||||||
| # Check that conflicting packages are not all selected | ||||||||||
| has_pkg1 = "pkg1" in result | ||||||||||
| has_pkg2 = "pkg2" in result | ||||||||||
| has_pkg3 = "pkg3" in result | ||||||||||
|
|
||||||||||
| # At most one of the conflicting packages can be selected | ||||||||||
| assert sum([has_pkg1, has_pkg2, has_pkg3]) <= 1 | ||||||||||
|
|
||||||||||
| # pkg1 conflicts with pkg2 AND pkg3, so pkg1 cannot coexist with | ||||||||||
| # either of them. pkg2 and pkg3 do NOT conflict with each other, | ||||||||||
| # so both may be selected together. | ||||||||||
| if "pkg1" in result: | ||||||||||
| assert "pkg2" not in result | ||||||||||
| assert "pkg3" not in result | ||||||||||
|
Comment on lines
+75
to
+77
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Assert the maximum feasible set. The new condition accepts Assert the expected four-package set. Proposed fix- if "pkg1" in result:
- assert "pkg2" not in result
- assert "pkg3" not in result
+ assert set(result) == {"pkg2", "pkg3", "pkg4", "pkg5"}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
|
|
||||||||||
| def test_solve_with_weights(self): | ||||||||||
| """Test solve with weights""" | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: dominicusin/package-maximizer
Length of output: 5081
Security Misconfiguration (CWE-250)
Reachability: External · Exploitability: Difficult
Set explicit permissions for the test job.
The
testjob installs and executes optional solver code but has no job-levelpermissionsblock. Setpermissions: contents: readundertest, and grant additional scopes only when required.🧰 Tools
🪛 zizmor (1.29.0)
[warning] 1-186: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block
(excessive-permissions)
[warning] 83-135: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block
(excessive-permissions)
🤖 Prompt for AI Agents
Source: Linters/SAST tools