Files
free-steam-games-list/sonar-project.properties
T
poli0981andClaude Opus 5.5 df91b42c4f ci(sonar): import test coverage instead of excluding it
The scan job now runs both suites with coverage before scanning:
pytest --cov (pyproject.toml: scripts/ without its tests, relative
paths, coverage.xml) and `npm run test:coverage` (vite.config.ts: v8,
lcov with projectRoot "..", so paths start web/). sonar-project.properties
names both reports and drops sonar.coverage.exclusions.

requirements-test.txt gains pytest-cov 7.1.0 and coverage 7.16.2 with
every file's hash (uv pip compile --universal --generate-hashes
--python-version 3.15; the existing pins are unchanged). web gains
@vitest/coverage-v8 5.0.5, matching vitest; none of its packages has an
install script. Coverage stays off for a plain `npm test`.

The token check is its own job, so the scan steps no longer each repeat
the condition; the workflow grants nothing at the top and the scan job
contents: read. `npm run build:admin` replaces the bare `svelte-kit
sync`: it syncs too, and writes the admin bundle the Worker's tests load.

Locally: 576 vitest tests at 58.35% of lines, 299 pytest tests at 57.7%.
Against main's new-code lines (SonarCloud's isNew), the reports cover
92 of 114 coverable lines, 80.7%: the 80% gate is borderline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 19:34:51 +07:00

57 lines
3.2 KiB
Properties

# SonarCloud's CI-based analysis (.github/workflows/sonarcloud.yml): which
# project, what is code, what is test code, and what is not analysed at all.
# The scanner reads this file from the commit it analyses, so a pull request
# that changes it is analysed with the change. Settings here override the same
# settings made in the SonarCloud UI.
# https://docs.sonarsource.com/sonarqube-cloud/advanced-setup/analysis-parameters/
#
# sonar.sources and sonar.tests take directories. The other keys take path
# patterns relative to the repository root, comma-separated: ** is any number
# of directories, * any part of a name.
sonar.organization=poli0981
sonar.projectKey=poli0981_free-steam-games-list
# Tests sit beside the code they test, so both start at the root and the
# patterns below split them: a file is a test if it matches
# sonar.test.inclusions, and code if it is not excluded.
sonar.sources=.
sonar.tests=.
# pytest, the vitest files, and what only tests and the admin's dev server use
# (fakes, fixtures, the mock backend). Analysed with the test rules, and left
# out of duplication and coverage.
sonar.test.inclusions=scripts/tests/**,**/*.test.ts,web/src/lib/testing/**,web/worker/testing/**,web/admin/mock/**
# Excluded from the code: the tests above (they are analysed as tests), and
# what is not analysed at all -
# - the dataset and the other files the pipeline writes (data/, games/, the
# .jsonl queues and logs under scripts/);
# - files an analyser cannot read for what they are: the D1 migrations are
# SQLite, which the PL/SQL analyser parses as Oracle, and web/src/app.html
# is SvelteKit's page template, whose <title> comes in through
# %sveltekit.head% (lib/common/Seo.svelte);
# - what the Tauri CLI generated and nobody edits: the Android resources,
# the Gradle plugin in buildSrc/, and the icon set. The manifest, the
# Gradle build files and MainActivity.kt stay in.
sonar.exclusions=scripts/tests/**,**/*.test.ts,web/src/lib/testing/**,web/worker/testing/**,web/admin/mock/**,data/**,games/**,**/*.jsonl,**/*.sql,web/src/app.html,web/src-tauri/gen/android/app/src/main/res/**,web/src-tauri/gen/android/buildSrc/**,web/src-tauri/icons/**
sonar.sourceEncoding=UTF-8
# Coverage, from the two test runs sonarcloud.yml makes before the scan:
# pytest --cov (pyproject.toml's [tool.coverage.run]) and vitest --coverage
# (vite.config.ts's test.coverage), both with paths from the repository root.
# A file neither report names counts as 0% covered, which is what it is.
sonar.python.coverage.reportPaths=coverage.xml
sonar.javascript.lcov.reportPaths=web/coverage/lcov.info
# Every TypeScript project in web/. Left to itself the analyser finds only
# files named exactly tsconfig.json, and analyses the Worker, shared/ and the
# tests without their own compiler options. web/tsconfig.json extends the one
# `svelte-kit sync` generates, which the workflow runs first (build:admin).
sonar.typescript.tsconfigPaths=web/tsconfig.json,web/tsconfig.worker.json,web/tsconfig.test.json,web/admin/tsconfig.json,web/admin/tsconfig.node.json,web/admin/tsconfig.test.json
# The version every workflow sets up (actions/setup-python), except CodeQL's,
# which stays on the newest Python CodeQL supports. web/shared/toolchain.test.ts
# holds them equal.
sonar.python.version=3.15