Skip to content

feat(audit): support scanning and auditing Jupyter Notebooks (.ipynb) - #42

Open
virgiawanprima wants to merge 1 commit into
rm-rf-prod:mainfrom
virgiawanprima:feat/support-ipynb-audit
Open

virgiawanprima wants to merge 1 commit into
rm-rf-prod:mainfrom
virgiawanprima:feat/support-ipynb-audit

Conversation

@virgiawanprima

Copy link
Copy Markdown

Summary

Adds support for scanning and auditing Jupyter Notebook files (.ipynb) in gt_audit.

Changes:

  • Added .ipynb to SOURCE_EXT in src/tools/audit-scan.ts.
  • Implemented extractNotebookCode to parse .ipynb JSON and extract Python code cells, marking each cell with # %% [code cell N].
  • Commented out IPython magics (%...) and shell commands (!...) within notebook cells to avoid false-positive syntax matches against Python patterns.
  • Ignored .ipynb_checkpoints directories and *-checkpoint.ipynb files in directory walking and SKIP_FILE_RE.
  • Raised the file size limit for .ipynb to 2MB (from 200KB) to account for notebooks containing embedded base64 image outputs.
  • Added comprehensive unit and integration tests in src/tools/audit-ipynb.test.ts.

Closes #41

Type

  • Bug fix
  • New feature
  • Library addition
  • Documentation

Test plan

  • npm run typecheck passes
  • npm test passes (all 268 test files, 2,069 tests pass)
  • New tests added in src/tools/audit-ipynb.test.ts

- Support .ipynb in readProjectFiles by extracting Python code cells
- Prepend standard '# %% [code cell N]' markers to identify cell context
- Comment out IPython magics (%...) and shell escapes (!...) to prevent false positives
- Ignore .ipynb_checkpoints directories and *-checkpoint.ipynb files
- Allow up to 2MB file size for notebooks to accommodate embedded plot outputs
- Add comprehensive unit and integration tests in audit-ipynb.test.ts
- Resolves rm-rf-prod#41
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.

Feature Request: Support Jupyter Notebooks (.ipynb) in gt_audit and gt_auto_scan

1 participant