GIRA — which Python files to review first
GIRA reads the Git history and the source code of a Python repository and tells you which files deserve review or testing first. Everything runs on your own machine: a small local service is started for you, and your source code is never sent to an AI service or to the GIRA team.
What you get
- File ranking. Every Python file is ranked by how much it has changed (churn) within the repository. The top 20% are marked for review first.
- Code Health and hotspots. Each file gets a score from 1 (poor) to 10 (good) from simple, published rules: complex functions (McCabe complexity of 10 or more), long functions, deep nesting, many parameters, large files and many complex functions. Every deduction shows its rule, value, function and line. A hotspot is a file that is among the 20% most-changed files and has Code Health below 8.
- Code warnings in the editor and the Problems panel: syntax errors, very complex functions, unreachable code and nested tests.
- Leaked secrets. Every file of the commit (code,
.env, YAML, JSON…) is checked for API keys of known providers (OpenAI, Anthropic, AWS, GitHub, Google, Stripe, Slack, Hugging Face), private keys, database URLs with a password, secrets in committed .env files and random-looking strings assigned to names such as api_key or client_secret. The secret itself is never shown or sent: you see the file, the line, the kind of key and its length. Findings appear in the Security tab and the Problems panel. Mark a line that is not a secret with pragma: allowlist secret.
- Security warnings from Bandit: common insecure patterns such as
eval, shell=True, pickle, weak hashes, hard-coded passwords or requests without a timeout, with severity, CWE and a link to the rule. They appear in a Security tab of the dashboard and, from medium severity up, in the editor and the Problems panel. Bandit only reads the code; each warning is a possible problem to check, not a confirmed vulnerability.
- Function priority by complexity, with editor highlights and hover text.
- Dashboard inside VS Code with ordering by churn, hotspots or review tiers, and CSV export.
- Optional, experimental extras: a machine-learning ranking (rank_v6), and a 90-day defect probability once repository maintainers confirm which commits fixed bugs.
Requirements
- VS Code 1.85 or newer
- Git
- Python 3.12 or newer (found automatically as
py -3, python3 or python, or set gira.pythonPath)
- Internet access the first time GIRA starts (to download its Python packages from PyPI) and when you scan a GitHub URL
Getting started
- Open the folder of a Git repository that contains Python code.
- Click the GIRA icon in the Activity Bar.
- The first start creates a private Python environment for GIRA and installs fixed, tested versions of its packages. This takes about 20–60 seconds; later starts take a few seconds. Progress is shown in Output → GIRA Backend.
- Click Scan (or run GIRA: Scan). Choose your local workspace or paste a public GitHub URL such as
https://github.com/pallets/jinja.
- The dashboard opens with the ranked files, Code Health and hotspots.
GIRA analyzes one commit (by default HEAD, setting gira.revision). Uncommitted changes are not analyzed; you get a warning instead.
How accurate is the ranking?
GIRA was tested on repositories it had never seen. Reviewing the top 20% of files ranked by churn found 50–59% of the files that were later fixed for a bug, about 2.5 to 3 times more than picking files at random. Reviewing more of the list finds more: in an exploratory test, about 76% at 40% of the files.
Please read the results as review priorities, not as proof of bugs:
- Most files in the top 20% will not have a bug; the ranking only tells you where to look first.
- The secret check matches known key formats and random-looking values; fake keys in tests can match, and a secret in an unknown format can be missed. It checks the scanned commit only: a key deleted later is still in the Git history and must be revoked.
- Security warnings come from Bandit's rules. They can include false positives, and they do not cover logic bugs or vulnerable dependencies. They are not used in the ranking.
- Code Health is a rule-based score. It follows the scale used in industry research, but it has not been validated against defects.
- The machine-learning ranking did not beat the simple churn ranking in testing, so it is shown as experimental and is never the default.
- The defect probability is shown only as a rough estimate with its interval.
Privacy and security
- The local service listens only on
127.0.0.1 and requires a random session token that GIRA keeps in VS Code's secret storage.
- GIRA reads your code as data; it never runs your project's code, tests or build scripts. The security check (Bandit) also runs locally and only parses the code.
- No source code leaves your machine. Network access is used only to install GIRA's Python packages, to clone a public repository when you scan a GitHub URL, and to check your GitHub permission when you label bug-fix commits (you sign in to GitHub through VS Code; the token is not stored by GIRA).
Commands
| Command |
What it does |
| GIRA: Scan |
Analyze the open repository or a public GitHub URL |
| GIRA: Open Dashboard |
Show the dashboard |
| GIRA: Show Code Warnings |
List the code warnings of the last scan |
| GIRA: Export CSV Report |
Save files, functions and warnings as CSV |
| GIRA: Toggle Editor Annotations |
Show or hide the editor highlights |
| GIRA: Restart Backend |
Restart the local service |
| GIRA: Set Session Token |
Only needed if you run the service yourself |
Settings
| Setting |
Default |
Purpose |
gira.backend.autoStart |
true |
Start the bundled local service automatically |
gira.pythonPath |
empty |
Python used to create GIRA's environment; empty means auto-detect |
gira.revision |
HEAD |
Commit or branch to analyze |
gira.complexityWarningThreshold |
15 |
Complexity at which a function gets a warning |
gira.annotations.enabled |
true |
Show highlights in the editor |
gira.security.enabled |
true |
Check for leaked secrets and run Bandit after each scan |
gira.security.editorMinSeverity |
medium |
Lowest severity shown in the editor and Problems panel (high, medium, low) |
gira.security.includeTestFiles |
false |
Also show security warnings and secrets found in test files |
gira.serviceUrl |
http://127.0.0.1:8765 |
Address of the local service (loopback only) |
gira.requestTimeoutMs / gira.scanTimeoutMs |
10000 / 120000 |
Time limits |
Limitations
- Python files only. Local repositories and public GitHub repositories only.
- One repository at a time: the local service uses port 8765, so a second VS Code window on a different repository reports that the port is busy.
- A GitHub URL scan downloads the full history (up to 10 minutes).
- Cancel stops waiting in VS Code; the analysis may continue in the background until it finishes.
- Tested mainly on Windows.
Source code and feedback
The source code is on GitHub: https://github.com/KhanhPhung2005/gira-code. Please report problems or ideas at https://github.com/KhanhPhung2005/gira-code/issues.
License
MIT. GIRA is a capstone project of team C1SE.74, International School, Duy Tan University.
| |