Skip to content
| Marketplace
Sign in
Visual Studio Code>Linters>Code Authorship AnalyzerNew to Visual Studio Code? Get it now.
Code Authorship Analyzer

Code Authorship Analyzer

Aparna Battula

|
1 install
| (0) | Free
Analyze source code to estimate whether code is Human-Written, AI-Assisted, or AI-Generated using heuristic analysis and code metrics
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Code Authorship Analyzer

A powerful VS Code extension that analyzes source code to estimate whether code is Human-Written, AI-Assisted, or AI-Generated using heuristic analysis and code metrics.

Features

Analysis Commands

  • Analyze Current File - Analyze the currently active file
  • Analyze Workspace - Analyze all source files in the workspace
  • Refresh Analysis - Clear cache and re-analyze
  • Generate Analysis Report - Export results in JSON, CSV, or HTML format
  • Export Dashboard to HTML - Generate a standalone HTML dashboard
  • Open Dashboard - View interactive dashboard in VS Code

Dashboard Features

  • 📊 Summary Cards - Human Score, AI Score, Confidence Level, Total Files
  • 📈 Interactive Charts - Pie charts, bar charts, trend analysis
  • 📋 Detailed Tables - File-by-file analysis with filtering and search
  • 🎨 Dark/Light Mode - Responsive design with theme support
  • 📱 Responsive Layout - Works on desktop and mobile devices

Detection Engine

The extension uses transparent, heuristic-based scoring:

Human Indicators

  • Inconsistent naming patterns
  • Variable function lengths
  • Mixed coding styles
  • Natural, contextual comments
  • Evidence of refactoring and iteration
  • Uneven code structure

AI Indicators

  • Highly uniform formatting
  • Consistent naming conventions
  • Repeated code structures
  • Verbose, formal documentation
  • Template-like functions
  • Extremely clean, uniform structure

Scoring Components

Each indicator is weighted and combined to produce:

  • Human Score (0-100)
  • AI Score (0-100)
  • Confidence Level (0-100)
  • Risk Level (Low/Medium/High)

Installation

From Marketplace

  1. Open VS Code
  2. Go to Extensions (Ctrl+Shift+X)
  3. Search for "Code Authorship Analyzer"
  4. Click Install

From Source

# Clone or download the repository
cd code-authorship-analyzer

# Install dependencies
npm install

# Compile the extension
npm run compile

# Package as VSIX
vsce package

# Install the VSIX file in VS Code
code --install-extension code-authorship-analyzer-1.0.0.vsix

Usage

Quick Start

  1. Open a workspace with source code files
  2. Open Command Palette (Ctrl+Shift+P or Cmd+Shift+P)
  3. Run a command:
    • Code Authorship Analyzer: Analyze Current File
    • Code Authorship Analyzer: Analyze Workspace
  4. View results in the status message or dashboard

Command Examples

# Analyze current file
Ctrl+Shift+P → "Analyze Current File"

# Analyze entire workspace
Ctrl+Shift+P → "Analyze Workspace"

# Export to HTML
Ctrl+Shift+P → "Export Dashboard to HTML"

# Generate report
Ctrl+Shift+P → "Generate Analysis Report"

Dashboard

The interactive dashboard provides:

Summary Section

  • Average Human/AI scores across workspace
  • Overall confidence level
  • Total files analyzed

Charts

  1. Human vs AI Distribution (Pie Chart)
  2. Risk Level Distribution (Pie Chart)
  3. Analysis by Language (Bar Chart)
  4. Files by Risk Level (Bar Chart)

Detailed Table

  • Sort by any column
  • Filter by programming language
  • Search by filename
  • View individual metrics

Export Formats

HTML Export

  • Standalone HTML file
  • Interactive charts using Chart.js
  • Dark/light mode support
  • Works offline
  • Responsive design

JSON Export

{
  "totalFilesAnalyzed": 10,
  "averageHumanScore": 45,
  "averageAIScore": 55,
  "averageConfidence": 75,
  "analysisResults": [...]
}

CSV Export

File Name,Language,Human Score,AI Score,Confidence,Risk Level
file.ts,typescript,45,55,75,MEDIUM

Architecture

Folder Structure

src/
├── extension.ts                 # Main entry point
├── commands/
│   └── CommandHandler.ts        # Command implementations
├── services/
│   ├── FileAnalysisService.ts   # Analysis orchestration
│   └── HtmlExportService.ts     # Export functionality
├── analyzers/
│   ├── CodeMetricsAnalyzer.ts   # Metric extraction
│   └── AuthorshipScoringAnalyzer.ts # Scoring logic
├── models/
│   └── types.ts                 # TypeScript interfaces
├── utils/
│   └── logger.ts                # Logging utilities
├── webview/
│   └── dashboard.html           # Dashboard UI
└── test/
    ├── CodeMetricsAnalyzer.test.ts
    ├── AuthorshipScoringAnalyzer.test.ts
    ├── integration.test.ts
    └── testUtils.ts

Core Components

  1. CodeMetricsAnalyzer - Extracts code metrics

    • Comment ratios
    • Naming patterns
    • Style consistency
    • Function analysis
    • Code repetition detection
  2. AuthorshipScoringAnalyzer - Computes authorship scores

    • Weights indicators
    • Calculates confidence
    • Determines risk levels
    • Provides transparency breakdown
  3. FileAnalysisService - Manages file analysis

    • Single file analysis
    • Workspace analysis
    • Caching
    • Progress tracking
  4. HtmlExportService - Generates reports

    • HTML dashboard
    • JSON export
    • CSV export
    • Chart generation
  5. CommandHandler - Manages user commands

    • Command registration
    • UI interactions
    • Error handling
    • Status messages

Configuration

Add to .vscode/settings.json:

{
  "codeAuthorshipAnalyzer.includeLanguages": [
    "typescript",
    "javascript",
    "python",
    "java"
  ],
  "codeAuthorshipAnalyzer.excludePatterns": [
    "**/node_modules/**",
    "**/.git/**",
    "**/dist/**"
  ],
  "codeAuthorshipAnalyzer.enableCaching": true,
  "codeAuthorshipAnalyzer.analyzeOnSave": false
}

Scoring Methodology

Formula

Final Score = Weighted Average of all indicators

Human Score = Average(Inconsistency Indicators)
AI Score = Average(Uniformity Indicators)

Confidence = |Human Score - AI Score|
Risk Level:
  - Low: AI Score < 30%
  - Medium: AI Score 30-60%
  - High: AI Score > 60%

Weights

  • Naming Consistency: 15% (AI indicator)
  • Style Consistency: 15% (AI indicator)
  • Inconsistent Naming: 15% (Human indicator)
  • Function Length Variation: 12% (Human indicator)
  • Documentation Pattern: 11% (AI indicator)
  • Code Repetition: 10% (AI indicator)
  • Template Likelihood: 10% (AI indicator)
  • Refactoring Traces: 10% (Human indicator)
  • And more...

Supported Languages

  • TypeScript/JavaScript
  • Python
  • Java
  • C/C++
  • C#
  • Ruby
  • Go
  • Rust
  • PHP
  • Swift
  • Kotlin
  • And many more...

Performance

  • Async Processing - Non-blocking analysis
  • Caching - Results cached for performance
  • Incremental Updates - Process files in batches
  • Progress Tracking - Real-time progress notifications
  • Cancellation Support - Stop analysis at any time

Typical Performance

  • Single file: < 100ms
  • 100 files: 5-10 seconds
  • 1000 files: 1-2 minutes

Testing

Run Tests

# Run all tests
npm test

# Run specific test file
npm test -- --grep "CodeMetricsAnalyzer"

# Run with coverage
npm test -- --reporter html --reporter text

Test Coverage

  • Unit tests for analyzers
  • Integration tests for workflows
  • Mock workspace data for testing
  • Sample code snippets (human vs AI)

Limitations

  1. Heuristic-based - Uses patterns, not ML/AI models
  2. Language-dependent - Accuracy varies by language
  3. Context-unaware - Doesn't understand business logic
  4. Pattern-based - May have false positives/negatives
  5. No Training - Not trained on specific datasets

Accuracy Notes

This extension provides supplementary information and should be used as:

  • A code quality indicator
  • A development pattern analyzer
  • A learning tool
  • NOT as definitive proof of AI vs human authorship

Factors affecting accuracy:

  • Code style consistency
  • Comment density and style
  • Project maturity
  • Programming language
  • Individual developer style

Development

Build

npm run compile
npm run esbuild
npm run esbuild-watch

Debugging

  1. Open project in VS Code
  2. Press F5 or click "Run Extension"
  3. Test commands in the new window

Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

Publishing to Marketplace

Prerequisites

# Install vsce
npm install -g vsce

# Create publisher
vsce create-publisher <publisher-name>

# Login
vsce login <publisher-name>

Publish

# Update version in package.json

# Package extension
vsce package

# Publish
vsce publish

# Or publish directly
vsce publish --pat <personal-access-token>

Troubleshooting

Extension Not Activating

  1. Check if workspace has source files
  2. Restart VS Code
  3. Check extension logs: Output > Code Authorship Analyzer

Slow Performance

  1. Exclude large folders in settings
  2. Analyze specific languages only
  3. Use smaller workspace

Inaccurate Results

  1. Check code metadata (comments, style)
  2. Verify supported language
  3. Review scoring breakdown for details

FAQ

Q: How accurate is this? A: The extension is heuristic-based and provides supplementary analysis. Accuracy varies (60-90%) based on code characteristics.

Q: Can it detect AI models used? A: No, it can only estimate whether code is human-written or AI-generated. It cannot identify specific models.

Q: Does it send code to external servers? A: No, all analysis is performed locally. No data is transmitted.

Q: Can I use this commercially? A: Yes, this extension is open-source and can be used commercially.

Q: How often is it updated? A: Regular updates with improved heuristics and language support.

License

MIT License - See LICENSE file for details

Support

  • Issues: Report bugs on GitHub
  • Feature Requests: Submit ideas on GitHub
  • Documentation: See wiki
  • Community: Join discussions

Credits

Developed as a comprehensive code analysis tool for developers who want to understand code authorship patterns.

Version History

v1.0.0

  • Initial release
  • Core analysis engine
  • HTML dashboard export
  • Multiple export formats
  • Comprehensive test suite

Happy Analyzing! 📊

For the latest updates and documentation, visit GitHub Repository

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft