Skip to content

Commit 229ce72

Browse files
committed
fix(ci): exclude template directory from CodeQL and YAML linting
Template files contain Jinja2 syntax that appears as invalid YAML/Python to static analyzers before cookiecutter rendering. This commit adds configuration files to exclude the {{cookiecutter.project_slug}}/ directory from both CodeQL and yamllint analysis. Changes: - Add .yamllint config to exclude template directory from YAML validation - Add .github/codeql-config.yml to exclude templates from code scanning - Prevents false positives on Jinja2 template syntax ({%-, {{, etc.) Resolves CodeQL and yamllint false positives on: - {{cookiecutter.project_slug}}/.github/workflows/release.yml - {{cookiecutter.project_slug}}/.github/workflows/scorecard.yml Template files are validated AFTER cookiecutter rendering during post-generation hooks and in generated project CI workflows.
1 parent ba162a0 commit 229ce72

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

.github/codeql-config.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
# CodeQL configuration for cookiecutter-python-template
3+
# Excludes template files containing Jinja2 syntax from analysis
4+
5+
name: "CodeQL Config"
6+
7+
# Exclude template directory - contains Jinja2 template syntax
8+
# that appears invalid to static analyzers before rendering
9+
paths-ignore:
10+
- '{{cookiecutter.project_slug}}/**'
11+
- '.venv/**'
12+
- 'venv/**'
13+
- 'node_modules/**'
14+
- '.git/**'
15+
- 'dist/**'
16+
- 'build/**'
17+
- '**/*.egg-info/**'

.yamllint

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
# yamllint configuration for cookiecutter-python-template repository
3+
# Excludes template files that contain Jinja2 syntax from linting
4+
extends: default
5+
6+
rules:
7+
line-length:
8+
max: 120
9+
level: warning
10+
document-start: disable
11+
truthy:
12+
allowed-values: ['true', 'false', 'yes', 'no']
13+
14+
# Ignore template directory - these files contain Jinja2 syntax
15+
# that appears invalid to YAML parsers before rendering
16+
ignore: |
17+
{{cookiecutter.project_slug}}/
18+
.venv/
19+
venv/
20+
node_modules/
21+
.git/

0 commit comments

Comments
 (0)