Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
3c37b91
feat: enhance semantic analysis with ABC, Protocol, and Enum tracking
djinn09 Jan 16, 2026
64d43db
feat: enhance semantic analysis with ABC, Protocol, and Enum tracking
djinn09 Jan 16, 2026
3947bff
feat: Introduce comprehensive security analysis with new danger rules…
djinn09 Jan 17, 2026
f937f1b
feat: Implement a new linter and analyzer with comprehensive taint an…
djinn09 Jan 17, 2026
0dbac98
feat: Add extensive 'danger' security rules, tests, and documentation…
djinn09 Jan 17, 2026
c7327b6
feat: Add extensive 'danger' security rules, tests, and documentation…
djinn09 Jan 17, 2026
226b1ad
feat: Add comprehensive benchmarking infrastructure, project document…
djinn09 Jan 17, 2026
2612a81
clippy fix
djinn09 Jan 17, 2026
8d8ffe6
feat: Implement clippy fix is contasnt flag for upper case thing .
djinn09 Jan 18, 2026
f244323
feat: Implement new danger rules, taint analysis, and advanced heuris…
djinn09 Jan 18, 2026
8d30fe4
feat: Implement Control Flow Graph (CFG) module for behavioral analys…
djinn09 Jan 19, 2026
50f22ff
feat: Introduce a taint analysis engine with a plugin architecture an…
djinn09 Jan 19, 2026
2197bce
feat: Introduce a taint analysis engine with a plugin architecture an…
djinn09 Jan 20, 2026
3a3fa56
feat: Implement core static analysis engine with security, quality, a…
djinn09 Jan 20, 2026
e3e0513
clippy fix
djinn09 Jan 20, 2026
eecf938
prek fix for benchmark and verify py
djinn09 Jan 20, 2026
fe11f5d
deleted lcov.info
djinn09 Jan 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Cargo.toml.bak

# Depending on your IDE or editor, you might want to ignore these:
.idea/
.vscode/
*.iml
*.swp
*.swo
Expand Down Expand Up @@ -87,3 +86,6 @@ test_repo
.index_cache
htmlcov/
.vscode-test/
security_example/
security_stats_report.md
lcov.info
22 changes: 22 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# typos configuration
# See: https://github.com/crate-ci/typos

[files]
# Exclude files/directories from spell checking
extend-exclude = [
"lcov.info",
"*.lcov",
"target/",
"node_modules/",
".venv/",
"dist/",
"*.lock",
]

[default]
# Known acceptable words that should not be flagged
extend-ignore-identifiers-re = []

[default.extend-words]
# Add any false positives here
# Example: "Nd" = "Nd"
15 changes: 15 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"recommendations": [
"usernamehw.errorlens",
"serayuzgur.crates",
"tion.evenbettercomments",
"tamasfe.even-better-toml",
"rust-lang.rust-analyzer",
"1yib.rust-bundle",
"rodrigocfd.format-comment",
"ryanluker.vscode-coverage-gutters",
"vadimcn.vscode-lldb",
"donjayamanne.githistory",
"eamodio.gitlens"
]
}
19 changes: 19 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"rust-analyzer.cargo.extraEnv": {
"PYO3_PYTHON": "${workspaceFolder}/.venv/Scripts/python.exe"
},
"rust-analyzer.check.command": "clippy",
"rust-analyzer.check.extraArgs": [
"--all-features",
"--",
"-W",
"clippy::complexity",
"-W",
"clippy::pedantic",
"-W",
"clippy::perf"
],
"coverage-gutters.coverageFileNames": ["lcov.info"],
"coverage-gutters.coverageBaseDir": ".",
"coverage-gutters.showLineCoverage": true
}
100 changes: 27 additions & 73 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Thank you for your interest in contributing to the Rust implementation of CytoSc
2. **Create Python Virtual Environment:**

```bash
# Using uv (recommended)
# Using uv (strongly recommended)
uv venv
source .venv/bin/activate # Linux/macOS
.venv\Scripts\activate # Windows
Expand All @@ -64,41 +64,32 @@ Thank you for your interest in contributing to the Rust implementation of CytoSc
.venv\Scripts\activate # Windows
```

3. **Install Maturin:**
3. **Install Dependencies:**

```bash
pip install maturin
```

4. **Build and Install in Development Mode:**

```bash
# Build and install the Python package with Rust extension
maturin develop -m cytoscnpy/Cargo.toml
# Using uv (fast)
uv pip install -e ".[dev]"

# Or with release optimizations
maturin develop -m cytoscnpy/Cargo.toml --release
# Or using pip
pip install -e ".[dev]"
```

5. **Verify Installation:**
## Developing cytoscnpy-mcp

```bash
# Test Python import
python -c "import cytoscnpy; print('Success!')"
The MCP server implementation is located in `cytoscnpy-mcp/`. It allows CytoScnPy to be used as a tool by AI assistants.

# Test CLI command
cytoscnpy --help
```
### Running the MCP Server locally

6. **Run Tests:**
```bash
cargo run --bin cytoscnpy-mcp
```

```bash
# Rust tests
cargo test
### Testing the MCP Server

# Python integration tests (if available)
pytest
```
```bash
# Run MCP-specific tests
cargo test -p cytoscnpy-mcp
```

## Project Structure

Expand All @@ -112,57 +103,20 @@ CytoScnPy/
│ ├── __init__.py # Imports Rust `run` function
│ └── cli.py # CLI wrapper calling Rust
├── cytoscnpy/ # Rust library with PyO3 bindings
│ ├── Cargo.toml # Library + cdylib configuration
│ ├── tests/ # Rust integration tests
├── cytoscnpy/ # Core Rust library with PyO3 bindings
│ ├── Cargo.toml
│ └── src/
│ ├── lib.rs # Crate root + #[pymodule]
│ ├── main.rs # Binary entry point (cytoscnpy-bin)
│ ├── python_bindings.rs # PyO3 implementation (modular)
│ ├── entry_point.rs # Core CLI logic
│ ├── config.rs # Configuration (.cytoscnpy.toml)
│ ├── cli.rs # Command-line argument parsing
│ ├── commands.rs # Radon-compatible commands
│ ├── output.rs # Rich CLI output
│ ├── linter.rs # Rule-based linting engine
│ ├── constants.rs # Shared constants
│ ├── analyzer/ # Main analysis engine
│ │ ├── mod.rs # Module exports
│ │ ├── types.rs # AnalysisResult, ParseError types
│ │ ├── heuristics.rs # Penalty and heuristic logic
│ │ └── processing.rs # Core processing methods
│ ├── visitor.rs # AST traversal
│ ├── framework.rs # Framework-aware patterns
│ ├── test_utils.rs # Test file detection
│ ├── utils.rs # Utilities
│ ├── ipynb.rs # Jupyter notebook support
│ ├── metrics.rs # Metrics types
│ ├── complexity.rs # Cyclomatic complexity
│ ├── halstead.rs # Halstead metrics
│ ├── raw_metrics.rs # LOC, SLOC metrics
│ ├── rules/ # Security & quality rules
│ │ ├── mod.rs # Rules module
│ │ ├── secrets.rs # Secrets scanning + entropy
│ │ ├── danger.rs # Dangerous code detection
│ │ ├── danger/ # Danger rule helpers
│ │ └── quality.rs # Code quality checks
│ └── taint/ # Taint analysis module
│ ├── mod.rs # Module exports
│ ├── types.rs # TaintFinding, TaintInfo, VulnType
│ ├── analyzer.rs # Main taint analyzer
│ ├── sources.rs # Source detection (input, request.*)
│ ├── sinks.rs # Sink detection (eval, subprocess, SQL)
│ ├── propagation.rs # Taint state tracking
│ ├── intraprocedural.rs # Statement-level analysis
│ ├── interprocedural.rs # Cross-function analysis
│ ├── crossfile.rs # Cross-module analysis
│ ├── call_graph.rs # Function call graph
│ └── summaries.rs # Function summaries
│ └── ...
├── cytoscnpy-cli/ # Standalone Rust binary (optional)
├── cytoscnpy-cli/ # Standalone Rust binary
│ ├── Cargo.toml
│ └── src/
│ └── main.rs # Calls cytoscnpy::entry_point
│ └── main.rs
├── cytoscnpy-mcp/ # MCP Server implementation
│ ├── Cargo.toml
│ ├── src/ # Rust implementation
│ └── tests/ # MCP-specific tests
├── benchmark/ # 135-item ground truth suite
└── target/ # Build artifacts (gitignored)
Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["cytoscnpy", "cytoscnpy-cli", "cytoscnpy-mcp"]
resolver = "2"

[workspace.package]
version = "1.2.6"
version = "1.2.7"
edition = "2021"
license = "Apache-2.0"

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
[![Security Audit](https://github.com/djinn09/CytoScnPy/actions/workflows/security.yml/badge.svg)](https://github.com/djinn09/CytoScnPy/actions/workflows/security.yml)
[![Docs](https://github.com/djinn09/CytoScnPy/actions/workflows/docs.yml/badge.svg)](https://github.com/djinn09/CytoScnPy/actions/workflows/docs.yml)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Version](https://img.shields.io/badge/version-1.2.5-green.svg)](https://github.com/djinn09/CytoScnPy)
[![Version](https://img.shields.io/badge/version-1.2.7-green.svg)](https://github.com/djinn09/CytoScnPy)

A fast static analysis tool for Python codebases, powered by Rust with hybrid Python integration. Detects dead code, security vulnerabilities (including taint analysis), and code quality issues with extreme speed. Code quality metrics are also provided.
A fast, lightweight static analyzer for Python codebase. It’s built in Rust with Python integration and detection of dead code, security issues, and code quality issue, along with useful quality metrics.

## Why CytoScnPy?

Expand Down
9 changes: 7 additions & 2 deletions benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ This benchmark evaluates **11 dead code detection tools** against a curated Pyth

## Running the Benchmark

```bash
````bash
# Activate environment
.\.venv\Scripts\activate # Windows
source .venv/bin/activate # Linux/Mac
Expand All @@ -59,8 +59,11 @@ python benchmark/benchmark_and_verify.py --compare-json benchmark/baseline_win32
python benchmark/benchmark_and_verify.py --compare-json benchmark/baseline_linux.json

# Update Baseline (Save current results)

# Windows:

python benchmark/benchmark_and_verify.py --save-json benchmark/baseline_win32.json

# Linux:
python benchmark/benchmark_and_verify.py --save-json benchmark/baseline_linux.json
```
Expand Down Expand Up @@ -409,6 +412,7 @@ The tools were selected to represent the full spectrum of dead code detection ap
**F1 Score balances precision and recall**, which is critical for dead code detection:

```

F1 = 2 × (Precision × Recall) / (Precision + Recall)
```

Expand Down Expand Up @@ -557,7 +561,7 @@ Dead code detection is a **fundamentally hard problem** due to:
```python
getattr(obj, func_name)() # Which function is called?
globals()[var_name] # Which variable is accessed?
```
```

2. **Framework Magic**

Expand Down Expand Up @@ -621,3 +625,4 @@ Memory is measured as **Peak Resident Set Size (RSS)** during tool execution:
---

_Last updated: 2025-12-28 (135 total ground truth items, 11 tools benchmarked)_
````
Loading
Loading