Skip to content

Feat/python analysis - #45

Merged
Arthurvroum merged 3 commits into
mainfrom
feat/python-analysis
Nov 25, 2026
Merged

Arthurvroum merged 3 commits into
mainfrom
feat/python-analysis

Conversation

@Arthurvroum

Copy link
Copy Markdown
Collaborator

No description provided.

The config carrying macros, include paths and filters was written to the
extension's install folder. When that failed, generateConfigFileIfNeeded
returned false, which the caller read as "no config needed": ctrace ran
without the requested settings.

- Write the report and config files to the extension's storage, or to a
  private temporary folder when it is not writable.
- Throw when the config cannot be written, naming the settings that would
  be lost; false now only means that no config is needed.
- Stop before launching ctrace and show the message in a notification,
  the output channel and the sidebar.
- Add a "workspace" test configuration that runs Run Analysis with a folder
  open, and check that nothing is launched when the files cannot be written.

Fixes #44
Moving the scan files to a temporary folder exposed it on Windows CI:
C:\Users\RUNNER~1\... was rejected as unsafe, so no analysis could start.
The same happened for any path with a space, parentheses or an accent,
like "C:\Users\Jean Dupont" or "Program Files (x86)".

The validator now checks the option name strictly and only rejects shell
syntax in values, since every token is single-quoted again before use.
Entry points stay limited to function names.
ctrace 0.85 ships a Python analyzer: it runs on .py inputs under --static
or --invoke=coretrace-python-analyzer and reports in SARIF, like the C
tools. The extension only accepted C/C++ files, so it could not be used.

- Accept .py files for Run Analysis, and scan them in a workspace,
  skipping virtual environments and caches (.venv, site-packages...).
- Add coretrace-python-analyzer to the Static tools menu. A saved sidebar
  state from before it existed turns it on, like a fresh install.
- Choose the tools per file language. A C run never names the Python
  analyzer, which ctrace before 0.85 rejects with "Unknown tool", and a
  Python run gets no dynamic analysis and no stack pass.
- Check the C analyzer installation only when C/C++ files are analysed.
- Keep one incremental cache key per language: Python results depend on
  requirement manifests instead of C headers.
- Offer the ignore quick fix on Python diagnostics.

Tests cover the tool choice per language, and Run Analysis in a workspace
holding C, Python and a .venv. With CTRACE_BIN set to ctrace 0.85, a
Python finding is checked in the Problems panel.
@Arthurvroum
Arthurvroum merged commit f33bfe7 into main Nov 25, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant