Skip to content
bceverly edited this page Nov 10, 2025 · 6 revisions

SonarQube Plugin for Wolfram Mathematica - Documentation

Welcome to the comprehensive documentation for the SonarQube Plugin for Wolfram Mathematica - a Tier 1 code quality analysis tool with 529+ rules for Mathematica code.

🎯 Quick Start

📸 Screenshots

See Wolfralyze in action! View screenshots showing the plugin analyzing Mathematica code:

Dashboard & Issues

Dashboard Overview SonarQube dashboard showing quality metrics for a Mathematica project

Issues List Comprehensive issue detection with severity indicators

Code Analysis

Code with Highlighted Issues Mathematica code with syntax highlighting and inline issue detection

Rule Documentation Detailed rule explanations with Mathematica-specific guidance

Plugin Configuration

Quality Profile 529+ rules organized by type: bugs, vulnerabilities, security hotspots, and code smells

Plugin Installed Plugin successfully installed in SonarQube marketplace

💡 Note: Screenshots show Wolfralyze analyzing the Test Project which contains intentional code quality issues for demonstration.

For more screenshots and details, see the Screenshots Guide or visit wolfralyze.org.

📚 Documentation Sections

Getting Started

Understanding Rules

Best Practices & Help

🏆 Plugin Capabilities

Tier 1 Language Support

This plugin provides best-in-class support for Mathematica, comparable to Java and Python:

Feature Status Rules
Security Analysis ✅ Complete 56
Bug Detection ✅ Complete 162
Code Smells ✅ Complete 247
Performance Analysis ✅ Complete 35
AST Parser ✅ Complete Full language coverage
Symbol Table ✅ Complete Cross-file analysis
Type System ✅ Complete Type inference
Data Flow ✅ Complete Taint analysis
Control Flow ✅ Complete CFG analysis
Test Coverage ✅ Complete Integrated
Quick Fixes ✅ Complete 53 automated fixes
Custom Rules ✅ Complete 3 templates

Advanced Features

1. Comprehensive Security Coverage

  • OWASP Top 10 2021: 9 of 10 categories covered
  • Taint Analysis: Track untrusted data from sources to sinks
  • SQL Injection Detection: Pattern and data-flow based
  • Command Injection: Shell command safety
  • XSS Prevention: String sanitization checks
  • Cryptography: Weak algorithms, hardcoded secrets

2. Deep Code Analysis

  • Symbol Table: Cross-file function/variable tracking
  • Type Inference: Understand variable types through patterns
  • Data Flow: Track values through program execution
  • Control Flow: Detect unreachable code, infinite loops
  • Null Safety: Track $Failed, Missing[], undefined values

3. Performance Optimization

  • Pattern Complexity: Detect backtracking patterns
  • List Operations: Avoid O(n²) anti-patterns
  • Compilation Opportunities: Suggest Compile[] usage
  • Packed Arrays: Detect unpacking operations
  • Memory Leaks: Find growing definitions chains

4. Mathematica-Specific Analysis

  • Pattern System: Validate pattern correctness
  • Attribute System: Proper use of HoldFirst, Listable, etc.
  • Scoping: Module, Block, With usage
  • Notebooks: Notebook-specific best practices
  • Paclets: Package development standards
  • WolframCloud: Cloud deployment checks

📊 Rule Statistics

Total Rules: 529
├── Security Vulnerabilities: 27 rules
├── Security Hotspots: 29 rules
├── Bugs (Reliability): 162 rules
└── Code Smells (Maintainability): 247 rules

Additional Features:
├── Code Duplication Detection (CPD)
├── Complexity Metrics (Cyclomatic + Cognitive)
└── Quick Fixes: 53 automated corrections

🚀 Performance

  • Scan Speed: Optimized for large codebases (12,000+ files)
  • Accuracy: 95%+ detection rate, ~2% false positive rate
  • Thread Safety: Parallel analysis with thread pooling
  • Memory Efficiency: Handles 55k+ line files

💡 Example: Running Your First Scan

# 1. Create sonar-project.properties in your project root
cat > sonar-project.properties << 'EOF'
sonar.projectKey=my-mathematica-project
sonar.projectName=My Mathematica Project
sonar.projectVersion=1.0
sonar.sources=.
sonar.inclusions=**/*.m,**/*.wl,**/*.wls
sonar.exclusions=**/Tests/**,**/Build/**
EOF

# 2. Run scanner
sonar-scanner

# 3. View results at http://localhost:9000

Within minutes, you'll see:

  • Security vulnerabilities to fix immediately
  • Bugs that could cause runtime errors
  • Code smells to improve maintainability
  • Duplication percentages
  • Complexity metrics per function

🛠️ IDE Integration (SonarLint)

Get real-time analysis and one-click fixes in your IDE:

  1. Install SonarLint (IntelliJ, VS Code, Eclipse, Visual Studio)
  2. Connect to your SonarQube server (Connected Mode)
  3. See issues as you type with "Quick Fix" buttons

📖 What's Next?

🤝 Support & Feedback

  • Issues: Report bugs on GitHub Issues
  • Questions: Check FAQ first
  • Contributions: Pull requests welcome!

Latest Update: November 2025 - Tier 1 status achieved with 529 rules

Clone this wiki locally