Closed tonyandrewmeyer closed 7 months ago
/canonical/self-hosted-runners/run-workflows 22207de61a8e8a4247506ace5d772a24d1d05ac8
/canonical/self-hosted-runners/run-workflows 2bc4cd725aa1fb273f423433e09cee339738b3ec
Test coverage for 2bc4cd725aa1fb273f423433e09cee339738b3ec
Name Stmts Miss Branch BrPart Cover Missing
---------------------------------------------------------------
src/charm.py 540 35 184 33 91% 162, 203-206, 370, 429->433, 582, 613, 619, 636-640, 670, 705-706, 764, 773, 877->890, 889, 891, 896-897, 957, 977, 984, 1074, 1083, 1095, 1116, 1125, 1144, 1148, 1177, 1230, 1362, 1384, 1391->1393, 1436->exit, 1448, 1458, 1496
src/cos.py 21 0 0 0 100%
src/exceptions.py 17 1 2 1 89% 41
src/state.py 34 0 4 0 100%
src/types_.py 16 0 0 0 100%
---------------------------------------------------------------
TOTAL 628 36 190 34 91%
Static code analysis report
Run started:2024-04-16 08:52:05.609996
Test results:
No issues identified.
Code scanned:
Total lines of code: 4586
Total lines skipped (#nosec): 1
Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 0
Run metrics:
Total issues (by severity):
Undefined: 0
Low: 0
Medium: 0
High: 0
Total issues (by confidence):
Undefined: 0
Low: 0
Medium: 0
High: 0
Files skipped (0):
Applicable spec: N/A
Overview
ops<=2.12 wrongly has
self.config[x]
typed asstr
, when actually it could be an int, float, bool, or str, depending on the config type. We're fixing this in ops:#1183, but that will break static checking that currently assumes that the config is a str (because ops doesn't validate the schema, so all options will be bool|int|float|str).This PR adds a
typing.cast
call where the config values are loaded and used where the type should be str.Rationale
Covered in the overview.
Juju Events Changes
N/A
Module Changes
N/A
Library Changes
N/A
Checklist
src-docs
urgent
,trivial
,complex
)No docs changes required.