diff options
| author | Leonardo Guimaraes <leozinhoszg@gmail.com> | 2026-11-22 16:52:03 -0300 |
|---|---|---|
| committer | Leonardo Guimaraes <leozinhoszg@gmail.com> | 2026-11-22 16:52:03 -0300 |
| commit | b4a2e05585634214d99b61ba602d1f1c57bb0fc3 (patch) | |
| tree | 740be96169e5a7387325dd491bca1f5ee0ccf8b9 /tools | |
| parent | 8915df896e10c0cef994ce390a490fbc57f21d23 (diff) | |
progress_dashboard: no file name from outside the repository on the page
scrub() kept the last component of every absolute path, so a failing test line
naming a carved shader in the work folder showed the shader's name. A path
inside the repository now becomes its relative path and any other path becomes
<path>, file name included; URLs and relative paths are left alone.
The corpus test checked components, sources and metrics only, so a name added
to notes (which the page prints) passed. It now checks everything the
collector holds. Both cases were found by JRamos1993 in review; each new check
fails when the old behaviour is put back.
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/progress_dashboard.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/tools/progress_dashboard.py b/tools/progress_dashboard.py index bbb338853..882cdfdd3 100644 --- a/tools/progress_dashboard.py +++ b/tools/progress_dashboard.py | |||
| @@ -100,14 +100,25 @@ HOME = os.path.expanduser("~") | |||
| 100 | 100 | ||
| 101 | 101 | ||
| 102 | def scrub(text, limit=240): | 102 | def scrub(text, limit=240): |
| 103 | """One line of tool output, with the user's home folder and drive paths reduced to their last component.""" | 103 | """One line of tool output with every absolute path replaced: a path inside the repository becomes its relative |
| 104 | path, any other path (the work folder, the home folder, a temp folder) becomes <path>, file name included, since | ||
| 105 | a file name outside the repository can be a carved shader's name.""" | ||
| 104 | if not text: | 106 | if not text: |
| 105 | return "" | 107 | return "" |
| 106 | line = text.strip().splitlines()[-1] if text.strip() else "" | 108 | line = text.strip().splitlines()[-1] if text.strip() else "" |
| 109 | |||
| 110 | def shown(m): | ||
| 111 | path = m.group(0) | ||
| 112 | if inside(path, ROOT): | ||
| 113 | rel = os.path.relpath(os.path.realpath(path), os.path.realpath(ROOT)).replace(os.sep, "/") | ||
| 114 | return "." if rel == "." else rel | ||
| 115 | return "<path>" | ||
| 116 | |||
| 117 | line = re.sub(r"(?i)\b[a-z]:[\\/][^\s'\"]*", shown, line) | ||
| 118 | line = re.sub(r"(?<![\w.:/~])/[^\s/'\"][^\s'\"]*", shown, line) | ||
| 107 | if HOME and len(HOME) > 3: | 119 | if HOME and len(HOME) > 3: |
| 108 | line = line.replace(HOME, "~") | 120 | line = line.replace(HOME, "~") |
| 109 | line = re.sub(r"(?i)\b[a-z]:[\\/](?:[^\s\\/:'\"]+[\\/])+([^\s\\/'\"]+)", r"<path>/\1", line) | 121 | line = re.sub(r"~[\\/][^\s'\"]*", "<path>", line) |
| 110 | line = re.sub(r"(?<![\w.])/(?:[^\s/'\"]+/)+([^\s/'\"]+)", r"<path>/\1", line) | ||
| 111 | return line[:limit] | 122 | return line[:limit] |
| 112 | 123 | ||
| 113 | 124 | ||