require-codeql-category-when-language-matrix
Rule catalog ID: R114
Targeted pattern scopeโ
CodeQL analyze steps inside jobs that use a CodeQL language matrix (strategy.matrix.language or strategy.matrix.include[*].language).
What this rule reportsโ
This rule reports CodeQL analyze steps that do not set with.category to include matrix.language when the job uses a language matrix.
Why this rule existsโ
When CodeQL runs in a language matrix, the SARIF category is the easiest way to keep uploads distinct and understandable in the code scanning UI. Requiring a matrix-aware category helps avoid ambiguous result grouping.
โ Incorrectโ
- uses: github/codeql-action/analyze@v4
โ Correctโ
- uses: github/codeql-action/analyze@v4
with:
category: /language:${{ matrix.language }}
Additional examplesโ
This rule only applies when the job uses a language matrix dimension. Single-language CodeQL jobs are ignored.
ESLint flat config exampleโ
import githubActions from "eslint-plugin-github-actions-2";
export default [githubActions.configs.codeScanning];
When not to use itโ
Disable this rule if your repository intentionally accepts a shared category across matrix jobs and that grouping has already been reviewed.