How sonarsource/sonar-custom-plugin-example works
Main Components Identification
The system should be divided into two primary sections:
A. Backend Components (Java):
• Plugin Core (ExamplePlugin.java)
• Feature Modules:
• Hooks (Quality Gate Status)
• Languages (Foo Language Support)
• Measures (Size computations)
• Rules (Java analysis rules)
• Settings (Properties and configurations)
• Web (Page definitions)
B. Frontend Components (JavaScript):
• Four Extension Pages:
• Portfolio Page (React)
• Admin Page (React)
• Project Page (Backbone)
• Global Page (Vanilla JS)
┌─ SonarQube Server ──────────────────────────────────────┐
• ┌─ Example Plugin ─────────────────────────────────┐ │
• Frontend Layer │ │
• Portfolio Page │ │
• Admin Page │ │
• Project Page │ │
• Global Page │ │
• Backend Layer │ │
• Plugin Core │ │
• Hooks │ │
• Languages │ │
• Measures │ │
• Rules │ │
• Settings │ │
• Web Definitions │ │
• ┘ │
• ┘
Component Relationships
• Frontend-Backend communication through SonarQube's exposed APIs
• Plugin integration points with SonarQube Server
• Internal component dependencies
Technical Details
• NodeJS/Java environment requirements
• Build tools (Maven, Webpack)
• Framework versions (React 16)
• Extension point registration mechanism
• Static resource locations
Integration Points
• How the plugin connects to SonarQube's extension system
• Exposed helper APIs (window.SonarRequest)
• Demonstrate localization integration
• Build output placement (extensions/plugins/)
• High-level architecture visibility
• Detailed component relationships
• Build/deployment flow
• Runtime behavior
This plugin-specific architecture requires special attention to:
• Extension point registration
• Resource bundling
• Multi-language support
• Frontend-Backend integration
• Build process flow