pyrig-codeql 1.2.11__tar.gz → 1.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (17) hide show
  1. {pyrig_codeql-1.2.11 → pyrig_codeql-1.3.0}/PKG-INFO +4 -1
  2. {pyrig_codeql-1.2.11 → pyrig_codeql-1.3.0}/README.md +3 -0
  3. {pyrig_codeql-1.2.11 → pyrig_codeql-1.3.0}/pyproject.toml +1 -1
  4. {pyrig_codeql-1.2.11 → pyrig_codeql-1.3.0}/pyproject.toml.orig +1 -1
  5. {pyrig_codeql-1.2.11 → pyrig_codeql-1.3.0}/src/pyrig_codeql/rig/configs/version_control/remote/workflows/health_check.py +26 -8
  6. {pyrig_codeql-1.2.11 → pyrig_codeql-1.3.0}/LICENSE +0 -0
  7. {pyrig_codeql-1.2.11 → pyrig_codeql-1.3.0}/src/pyrig_codeql/__init__.py +0 -0
  8. {pyrig_codeql-1.2.11 → pyrig_codeql-1.3.0}/src/pyrig_codeql/py.typed +0 -0
  9. {pyrig_codeql-1.2.11 → pyrig_codeql-1.3.0}/src/pyrig_codeql/rig/__init__.py +0 -0
  10. {pyrig_codeql-1.2.11 → pyrig_codeql-1.3.0}/src/pyrig_codeql/rig/configs/__init__.py +0 -0
  11. {pyrig_codeql-1.2.11 → pyrig_codeql-1.3.0}/src/pyrig_codeql/rig/configs/version_control/__init__.py +0 -0
  12. {pyrig_codeql-1.2.11 → pyrig_codeql-1.3.0}/src/pyrig_codeql/rig/configs/version_control/remote/__init__.py +0 -0
  13. {pyrig_codeql-1.2.11 → pyrig_codeql-1.3.0}/src/pyrig_codeql/rig/configs/version_control/remote/code_analyzer.py +0 -0
  14. {pyrig_codeql-1.2.11 → pyrig_codeql-1.3.0}/src/pyrig_codeql/rig/configs/version_control/remote/workflows/__init__.py +0 -0
  15. {pyrig_codeql-1.2.11 → pyrig_codeql-1.3.0}/src/pyrig_codeql/rig/resources/CODEQL_ANALYZE_ACTION +0 -0
  16. {pyrig_codeql-1.2.11 → pyrig_codeql-1.3.0}/src/pyrig_codeql/rig/resources/CODEQL_INIT_ACTION +0 -0
  17. {pyrig_codeql-1.2.11 → pyrig_codeql-1.3.0}/src/pyrig_codeql/rig/resources/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyrig-codeql
3
- Version: 1.2.11
3
+ Version: 1.3.0
4
4
  Summary: A pyrig plugin that integrates GitHub CodeQL.
5
5
  Keywords: pyrig
6
6
  Author: Winipedia
@@ -85,6 +85,9 @@ GitHub CodeQL analysis to your project's health-check workflow.
85
85
 
86
86
  - **CodeQL analysis** — analyzes Python and GitHub Actions code.
87
87
  - **Health-check integration** — adds CodeQL to the aggregate health-check gate.
88
+ - **Alert gate** — fails the analysis job if the analyzed ref has any open
89
+ CodeQL security or quality alerts, including existing findings. Fixed and
90
+ dismissed alerts do not block the job.
88
91
  - **Source-only analysis** — excludes the project's `tests/` directory from
89
92
  CodeQL analysis.
90
93
 
@@ -58,6 +58,9 @@ GitHub CodeQL analysis to your project's health-check workflow.
58
58
 
59
59
  - **CodeQL analysis** — analyzes Python and GitHub Actions code.
60
60
  - **Health-check integration** — adds CodeQL to the aggregate health-check gate.
61
+ - **Alert gate** — fails the analysis job if the analyzed ref has any open
62
+ CodeQL security or quality alerts, including existing findings. Fixed and
63
+ dismissed alerts do not block the job.
61
64
  - **Source-only analysis** — excludes the project's `tests/` directory from
62
65
  CodeQL analysis.
63
66
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pyrig-codeql"
3
- version = "1.2.11"
3
+ version = "1.3.0"
4
4
  description = "A pyrig plugin that integrates GitHub CodeQL."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pyrig-codeql"
3
- version = "1.2.11"
3
+ version = "1.3.0"
4
4
  description = "A pyrig plugin that integrates GitHub CodeQL."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -1,4 +1,4 @@
1
- """Health check workflow extended with a CodeQL analysis job."""
1
+ """Health check workflow extended with CodeQL analysis and an open-alert gate."""
2
2
 
3
3
  from types import MethodType
4
4
  from typing import Any
@@ -6,6 +6,7 @@ from typing import Any
6
6
  from pyrig.rig.configs.version_control.remote.workflows.health_check import (
7
7
  HealthCheckWorkflowConfigFile as BaseHealthCheckWorkflowConfigFile,
8
8
  )
9
+ from pyrig.rig.tools.version_control.remote.controller import RemoteVersionController
9
10
 
10
11
  from pyrig_codeql.rig import resources
11
12
  from pyrig_codeql.rig.configs.version_control.remote.code_analyzer import (
@@ -14,7 +15,7 @@ from pyrig_codeql.rig.configs.version_control.remote.code_analyzer import (
14
15
 
15
16
 
16
17
  class HealthCheckWorkflowConfigFile(BaseHealthCheckWorkflowConfigFile):
17
- """Health check workflow extended with a CodeQL analysis job."""
18
+ """Add CodeQL analysis and an open-alert gate to the health check workflow."""
18
19
 
19
20
  def jobs(self) -> dict[str, Any]:
20
21
  """Return the base class's jobs, extended with the CodeQL analysis job.
@@ -43,8 +44,8 @@ class HealthCheckWorkflowConfigFile(BaseHealthCheckWorkflowConfigFile):
43
44
 
44
45
  Returns:
45
46
  Job configuration with a matrix over `("python", "actions")`,
46
- the permissions CodeQL needs to build a database and upload its
47
- results, and the analysis steps.
47
+ the permissions needed to analyze code, upload results, and read
48
+ alerts, and steps that fail the job on open CodeQL alerts.
48
49
  """
49
50
  return self.job(
50
51
  self.job_analyze,
@@ -64,12 +65,13 @@ class HealthCheckWorkflowConfigFile(BaseHealthCheckWorkflowConfigFile):
64
65
 
65
66
  Returns:
66
67
  Steps that check out the repository, initialize CodeQL for the
67
- current matrix language, and run the analysis.
68
+ current matrix language, run the analysis, and check open alerts.
68
69
  """
69
70
  return [
70
71
  self.step_checkout_repository(),
71
72
  self.step_initialize_codeql(),
72
73
  self.step_analyze_code(),
74
+ self.step_check_alerts(),
73
75
  ]
74
76
 
75
77
  def step_initialize_codeql(self) -> dict[str, Any]:
@@ -93,9 +95,6 @@ class HealthCheckWorkflowConfigFile(BaseHealthCheckWorkflowConfigFile):
93
95
  def step_analyze_code(self) -> dict[str, Any]:
94
96
  """Build a step that runs the CodeQL analysis and uploads results.
95
97
 
96
- Fails the job if the analysis itself fails to run; code scanning
97
- alerts found by the analysis do not fail the step.
98
-
99
98
  Returns:
100
99
  Step using `github/codeql-action/analyze@<ref>`.
101
100
  """
@@ -104,6 +103,25 @@ class HealthCheckWorkflowConfigFile(BaseHealthCheckWorkflowConfigFile):
104
103
  uses=self.codeql_analyze_action(),
105
104
  )
106
105
 
106
+ def step_check_alerts(self) -> dict[str, Any]:
107
+ """Fail if the analyzed ref has any open CodeQL alerts.
108
+
109
+ Returns:
110
+ GitHub CLI step authenticated with the workflow's GitHub token.
111
+ """
112
+ return self.step(
113
+ self.step_check_alerts,
114
+ run=RemoteVersionController.I.api_method_args(
115
+ '--raw-field="ref=${GITHUB_REF}"',
116
+ "--raw-field=state=open",
117
+ "--raw-field=tool_name=CodeQL",
118
+ """--jq='if . != [] then error("Alerts found") end'""",
119
+ endpoint='"repos/${GITHUB_REPOSITORY}/code-scanning/alerts"',
120
+ method="GET",
121
+ ).multiline(),
122
+ env={"GH_TOKEN": self.insert_expression("secrets.GITHUB_TOKEN")},
123
+ )
124
+
107
125
  def codeql_init_action(self) -> tuple[str, str, str]:
108
126
  """Return action metadata for `github/codeql-action/init`.
109
127
 
File without changes