Repository navigation
Commit ff85225
committed
genMetrics: address Gemini review comments on PR #4206
- Move `now = datetime.now()` back to module scope so `extract_metrics`
remains importable as a library (it references `now` at line 199).
Moving it under `if __name__ == "__main__":` would have broken the
library path with a NameError.
- In `is_git_repo()`, also short-circuit to False when `folder` is not
a valid directory, so callers like the PLATFORM_DIR branch in
`extract_metrics` don't surface a `FileNotFoundError` from subprocess
trying to chdir to a bogus path.
- Add unit tests for both: a non-directory `folder` returns False, and
`genMetrics.now` is module-level so the import-time contract for
`extract_metrics` callers is preserved.
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>1 parent 091ea59 commit ff85225
2 files changed
Lines changed: 24 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
| 177 | + | |
| 178 | + | |
177 | 179 | | |
178 | 180 | | |
179 | 181 | | |
| |||
373 | 375 | | |
374 | 376 | | |
375 | 377 | | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
376 | 381 | | |
377 | 382 | | |
378 | | - | |
379 | 383 | | |
380 | 384 | | |
381 | 385 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
25 | 44 | | |
26 | 45 | | |
27 | 46 | | |
| |||
0 commit comments