Skip to content

Syntax Analysis for Unused Variable & Function Symbols, Supporting; C, C++, JavaScript, TypeScript, Python, Go, Rust & Java

Notifications You must be signed in to change notification settings

WillKirkmanM/unused

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unused

Syntax Analysis for Unused Variable & Function Symbols, Supporting; C, C++, JavaScript, TypeScript, Python, Go, Rust & Java

Features

  • Code Analysis: Identifies unused functions and variables in multiple programming languages
  • Language Support: Currently supports JavaScript, TypeScript, Python, and Rust
  • Directory Traversal: Recursively scans entire projects while ignoring common excluded directories
  • Fast Performance: Efficient implementation in Zig for quick analysis of large codebases

Installation

git clone https://github.com/WillKirkmanM/unused.git
cd unused
zig build

Usage

./unused-detector /path/to/your/project

Example Output

Scanning directory: /path/to/your/project

=== Unused Symbols Report ===

/path/to/your/project/src/file.py:12 error: unused function `calculate_total`
   --> def calculate_total(items):
           ^^^^^^^^^^^^^^^

/path/to/your/project/src/utils.js:34 error: unused variable `config`
   --> const config = { timeout: 30000, retries: 3 };
             ^^^^^^

Total unused symbols found: 2

Supported Languages

  • JavaScript (.js)
  • TypeScript (.ts)
  • Python (.py)
  • Rust (.rs)
  • C (.c, .h)
  • C++ (.cpp, .hpp, .cc)
  • Go (.go)
  • Java (.java)

How It Works

The tool performs analysis in two passes:

  1. First Pass: Extract all symbols (functions and variables) from all files
  2. Second Pass: Find references to those symbols across the entire codebase

Any symbol that has zero references (outside its definition) is reported as unused.

Configuration

The tool automatically excludes common directories like:

  • node_modules
  • .git
  • build
  • dist
  • target
  • __pycache__
  • venv

About

Syntax Analysis for Unused Variable & Function Symbols, Supporting; C, C++, JavaScript, TypeScript, Python, Go, Rust & Java

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages