You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Resolves#435 by adding --graphml and --gexf flags to the prism scan CLI, allowing users to export the generated entity graph to standard graph formats directly from the command line.
Changes
cli.py:
Added --graphml and --gexf to argparse configuration.
Implemented a DRY _output_graph function that uses modules.graph_export to generate the files.
Configured default filename generation (graph_<target>_<timestamp>.<ext>) to match HTML/PDF report behavior.
Updated the output dispatch logic in main() to support outputting graphs concurrently with existing report formats.
tests/test_cli.py: Added test suite covering the new flags using a mocked run_scan fixture to verify proper file creation without making network calls.
Thanks for the first pull request here. CI needs a maintainer to approve the run before it starts, so it may sit for a bit before anything happens. pytest tests/ -q passing is the main thing I look at.
Thanks, reusing to_graphml / to_gexf is exactly right. Three things:
1. Conflict.#438 landed first and also created tests/test_cli.py. Rebase on main and move your two tests into that file.
2. -o overwrites. Every format writes to the same -o path, so --graphml --gexf -o out leaves only the GEXF, and --graphml --html -o report leaves only the HTML. When more than one output is requested, derive the graph file names from -o by extension (out.graphml, out.gexf), or reject the combination with exit 2 and a clear message. Either is fine; silently losing a file is not.
3. Tests write into the repo's results/. They depend on the working directory and leave files behind if a run is interrupted. Pass -o pointing into pytest's tmp_path and assert on that file instead, which also lets you drop the cleanup fixture. A test for case 2 would be good too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves #435 by adding
--graphmland--gexfflags to theprism scanCLI, allowing users to export the generated entity graph to standard graph formats directly from the command line.Changes
cli.py:--graphmland--gexftoargparseconfiguration._output_graphfunction that usesmodules.graph_exportto generate the files.graph_<target>_<timestamp>.<ext>) to match HTML/PDF report behavior.main()to support outputting graphs concurrently with existing report formats.tests/test_cli.py: Added test suite covering the new flags using a mockedrun_scanfixture to verify proper file creation without making network calls.Type of change
Testing