Skip to content

Commit 9a09760

Browse files
WEBUI-1990: exclude non-unit-testable files from sonar coverage metrics : [LTS-2023] (#3158)
* added files that are realistically not testable in sonar exclusions * WEBUI-1990: refine coverage exclusions — include testable spreadsheet/S3 modules * addressed copilot review comments
1 parent 4976cce commit 9a09760

1 file changed

Lines changed: 43 additions & 3 deletions

File tree

sonar-project.properties

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,52 @@ sonar.exclusions=\
3939
addons/**/webpack.config.js,\
4040
i18n/**/*.json
4141

42-
# Exclude test/generated files from coverage metrics
42+
# Exclude files from coverage metrics that cannot be practically covered by Karma unit tests.
43+
#
44+
# Categories:
45+
# - Test files themselves
46+
# - HTML files (**.html) — while many contain inline <script> with executable Polymer logic,
47+
# Istanbul does not instrument <script> blocks inside HTML via the Karma ESM pipeline;
48+
# only standalone .js modules are instrumented for coverage
49+
# - CSS / JSON / YAML — no executable code
50+
# - Root-level bootstrap files (index.js, legacy.js, public-path.js, sw.js) — app entry points
51+
# and service worker that require a full browser bootstrap context
52+
# - elements/routing.js — runs Page.js route setup at import time, requires Nuxeo.UI app shell
53+
# - elements/elements.js — side-effect import barrel (no exportable logic, just registers elements)
54+
# - i18n/i18n.js — i18n bootstrap loader
55+
# - themes/*.html — covered by **/*.html above; themes/base.js and themes/loader.js have
56+
# unit tests and remain in coverage scope
57+
# - Addon index.js barrel files — side-effect registrations / re-exports
58+
# - nuxeo-spreadsheet/app/ — only files deeply coupled to jQuery/Handsontable/Select2 at import time:
59+
# app.js (imports vendor), lib/ (patches Handsontable prototype), ui/spreadsheet.js (jQuery container),
60+
# ui/editors/ (extend Select2Editor). Testable modules NOT excluded: utils.js, nuxeo/rest/*,
61+
# nuxeo/rpc/*, nuxeo/widget.js, ui/i18n.js, ui/column.js, ui/widgets.js, ui/log.js
62+
# - nuxeo-spreadsheet build config (webpack.config.js, eslint-rules.mjs)
63+
# - nuxeo-platform-3d/ — THREE.js loaders/controls break Karma ESM; elements depend on them
64+
# - .github/ — CI workflow YAML/JS, not application code
4365
sonar.coverage.exclusions=\
4466
**/*.test.js,\
67+
**/*.html,\
68+
**/*.css,\
4569
**/*.yaml,\
4670
**/*.yml,\
47-
i18n/**/*.json
71+
**/*.json,\
72+
index.js,\
73+
legacy.js,\
74+
public-path.js,\
75+
sw.js,\
76+
elements/routing.js,\
77+
elements/elements.js,\
78+
i18n/i18n.js,\
79+
addons/*/index.js,\
80+
addons/nuxeo-spreadsheet/app/app.js,\
81+
addons/nuxeo-spreadsheet/app/lib/**,\
82+
addons/nuxeo-spreadsheet/app/ui/spreadsheet.js,\
83+
addons/nuxeo-spreadsheet/app/ui/editors/**,\
84+
addons/nuxeo-spreadsheet/webpack.config.js,\
85+
addons/nuxeo-spreadsheet/eslint-rules.mjs,\
86+
addons/nuxeo-platform-3d/**,\
87+
.github/**
4888

4989
# Treat test/**/*.test.js and addon test files as test code, not source
5090
sonar.test.inclusions=test/**/*.test.js,addons/*/test/**/*.test.js
@@ -60,4 +100,4 @@ sonar.sourceEncoding=UTF-8
60100
# TODO: Remove once sub-packages have package-lock.json and npm ci can be used safely.
61101
sonar.issue.ignore.multicriteria=e1
62102
sonar.issue.ignore.multicriteria.e1.ruleKey=*
63-
sonar.issue.ignore.multicriteria.e1.resourceKey=.github/workflows/**
103+
sonar.issue.ignore.multicriteria.e1.resourceKey=.github/workflows/**

0 commit comments

Comments
 (0)