IDE Inspection Equivalence
Overview
This document explains how different JetBrains IDEs provide equivalent inspection capabilities and how our MCP server ensures consistent results regardless of which IDE is used.
IDE Selection Strategy
Based on our IDESelector.ts
implementation:
export class IDESelector {
private readonly priorityOrder = [
'IntelliJ IDEA', // Most comprehensive
'WebStorm', // JavaScript/TypeScript focus
'PyCharm', // Python focus
'PhpStorm', // PHP focus
'GoLand', // Go focus
'RubyMine', // Ruby focus
'CLion', // C/C++ focus
'Rider', // .NET focus
'DataGrip', // Database focus
];
}
Language Coverage Matrix
IDE Capabilities
IDE | Primary Languages | Additional Languages | Shared Inspections |
---|---|---|---|
IntelliJ IDEA | Java, Kotlin, Scala, Groovy | HTML, CSS, JavaScript, TypeScript, SQL, XML, JSON, YAML | ✅ All platform inspections |
WebStorm | JavaScript, TypeScript, HTML, CSS | JSON, XML, YAML, Markdown | ✅ Web development inspections |
PyCharm | Python | HTML, CSS, JavaScript, SQL, JSON | ✅ Python + web inspections |
PhpStorm | PHP | HTML, CSS, JavaScript, SQL, JSON | ✅ PHP + web inspections |
GoLand | Go | HTML, CSS, JavaScript, JSON | ✅ Go + basic web inspections |
RubyMine | Ruby, Rails | HTML, CSS, JavaScript, SQL | ✅ Ruby + web inspections |
CLion | C, C++, Rust | CMake, Python, Assembly | ✅ Native code inspections |
Rider | C#, F#, VB.NET | JavaScript, TypeScript, SQL | ✅ .NET + web inspections |
Shared Inspection Categories
Platform-Level Inspections
All JetBrains IDEs share these inspection categories:
// From our unified inspection profile
const sharedInspections = {
// General code quality
DuplicatedCode: 'All IDEs',
RedundantSuppression: 'All IDEs',
UnusedDeclaration: 'All IDEs',
TodoComment: 'All IDEs',
// File and project structure
InconsistentLineSeparators: 'All IDEs',
LongLine: 'All IDEs',
ProblematicWhitespace: 'All IDEs',
TrailingWhitespace: 'All IDEs',
// Version control
CommitMessageFormat: 'All IDEs',
UnresolvedMergeConflict: 'All IDEs',
// Documentation
MissingJavadoc: 'Java-capable IDEs',
InvalidJavadoc: 'Java-capable IDEs',
// Security
HardcodedPassword: 'All IDEs',
SensitiveDataExposure: 'All IDEs',
};
Inspection Profile Compatibility
Unified Profile Structure
Our unified.xml
profile ensures cross-IDE compatibility:
<?xml version="1.0" encoding="UTF-8"?>
<profile version="1.0">
<option name="myName" value="Unified" />
<!-- Universal inspections work in all IDEs -->
<inspection_tool class="DuplicatedCode" enabled="true" level="WARNING" enabled_by_default="true">
<option name="MIN_DUPLICATED_LINES" value="10" />
</inspection_tool>
<!-- Language-specific inspections are gracefully ignored if not supported -->
<inspection_tool class="TypeScriptValidateTypes" enabled="true" level="ERROR" enabled_by_default="true">
<!-- Only active in IDEs with TypeScript support -->
</inspection_tool>
<inspection_tool class="PyPep8Inspection" enabled="true" level="WARNING" enabled_by_default="true">
<!-- Only active in PyCharm -->
</inspection_tool>
</profile>
Profile Resolution Logic
From InspectionProfileManager.ts
:
async resolveProfile(options: ProfileOptions): Promise<string> {
// 1. Check for forced profile
if (options.forcedPath) {
return options.forcedPath;
}
// 2. Look for project-specific profile
const projectProfile = await this.findProjectProfile(options.projectPath);
if (projectProfile) {
return projectProfile;
}
// 3. Use unified profile (works across all IDEs)
return this.getUnifiedProfilePath();
}
Ensuring Equivalence
1. Automatic IDE Selection
The IDEDetector
finds all available IDEs:
async detectIDEs(): Promise<IDE[]> {
const detectedIDEs: IDE[] = [];
for (const location of this.getSearchLocations()) {
const ides = await this.scanLocation(location);
detectedIDEs.push(...ides);
}
// Sort by priority for consistent selection
return this.sortByPriority(detectedIDEs);
}
2. Fallback Mechanism
If the preferred IDE isn't available:
selectBestIDE(availableIDEs: IDE[], projectType?: string): IDE {
// Try to match project type
if (projectType) {
const matched = this.matchByProjectType(availableIDEs, projectType);
if (matched) return matched;
}
// Fall back to priority order
return availableIDEs[0]; // Already sorted by priority
}
3. Result Normalization
The DiagnosticNormalizer
ensures consistent output:
normalize(diagnostic: RawDiagnostic): NormalizedDiagnostic {
return {
file: this.normalizeFilePath(diagnostic.file),
line: diagnostic.line,
column: diagnostic.column || 1,
severity: this.normalizeSeverity(diagnostic.severity),
message: this.normalizeMessage(diagnostic.message),
inspection: diagnostic.inspectionId || 'Unknown',
category: diagnostic.category || 'General',
};
}
Language-Specific Considerations
JavaScript/TypeScript
Works identically in:
- WebStorm (primary)
- IntelliJ IDEA (with plugin)
- PyCharm Professional
- PhpStorm
Python
Works identically in:
- PyCharm (primary)
- IntelliJ IDEA (with plugin)
- CLion (limited support)
Java
Works identically in:
- IntelliJ IDEA (primary)
- Android Studio
- Other IDEs (limited support)
Handling IDE Differences
Graceful Degradation
When an inspection isn't available:
class DiagnosticFilter {
filter(diagnostics: Diagnostic[], options: FilterOptions): Diagnostic[] {
return diagnostics.filter((d) => {
// Skip unsupported inspections gracefully
if (this.isUnsupported(d.inspection)) {
this.logger.debug(`Skipping unsupported: ${d.inspection}`);
return false;
}
return true;
});
}
}
Version Compatibility
Handling different IDE versions:
class IDEVersionChecker {
isCompatible(ide: IDE): boolean {
const minVersion = this.getMinimumVersion(ide.name);
return this.compareVersions(ide.version, minVersion) >= 0;
}
}
Testing Equivalence
Cross-IDE Validation
To verify equivalence, run the same inspection across different IDEs:
# Test with WebStorm
FORCE_INSPECT_PATH="/Applications/WebStorm.app/Contents/bin/inspect.sh" \
node dist/index.js
# Test with IntelliJ IDEA
FORCE_INSPECT_PATH="/Applications/IntelliJ IDEA.app/Contents/bin/inspect.sh" \
node dist/index.js
# Compare results
diff webstorm-results.json intellij-results.json
Expected Differences
Minor differences are expected:
- Language-specific inspections: Only in IDEs with language support
- Plugin inspections: Depend on installed plugins
- Performance: Some IDEs are optimized for specific languages
Unexpected Differences
If significant differences occur:
- Check IDE versions are similar
- Verify same plugins are installed
- Ensure profiles are compatible
- Check project configuration
Best Practices for Equivalence
1. Use Universal Inspections
Focus on inspections available across all IDEs:
- Code style violations
- Duplicate code detection
- TODO comments
- Basic syntax errors
2. Configure Environment Properly
Set environment variables for consistency:
# Force specific IDE for reproducibility
export FORCE_INSPECT_PATH="/path/to/preferred/ide/inspect.sh"
# Use same profile across runs
export FORCE_PROFILE_PATH="/path/to/standard-profile.xml"
# Consistent timeout
export INSPECTION_TIMEOUT=300000
3. Handle Language-Specific Cases
// Example: Conditional inspection based on file type
if (fileExtension === '.py' && !hasPythonSupport(selectedIDE)) {
logger.warn('Python file but IDE lacks Python support');
// Either skip or find alternative IDE
}
Troubleshooting Equivalence Issues
Diagnostic Checklist
-
Different inspection counts?
- Compare installed plugins
- Check profile compatibility
- Verify language support
-
Different severity levels?
- Check profile configuration
- Verify severity mappings
- Look for IDE-specific overrides
-
Missing inspections?
- Ensure required plugins installed
- Check if inspection is language-specific
- Verify IDE version compatibility
Resolution Strategies
- Standardize on one IDE: Use
FORCE_INSPECT_PATH
- Create minimal profile: Use only universal inspections
- Filter results: Use
EXCLUDE_INSPECTIONS
orONLY_INSPECTIONS
- Normalize output: Post-process results for consistency
Performance Comparison
Relative Performance by IDE
IDE | Startup Time | Inspection Speed | Memory Usage |
---|---|---|---|
WebStorm | Fast | Fast for JS/TS | Medium |
IntelliJ IDEA | Slower | Fast for Java | High |
PyCharm | Medium | Fast for Python | Medium |
CLion | Slow | Medium | High |
GoLand | Fast | Fast for Go | Low |
Optimization Tips
- Choose appropriate IDE: Match IDE to primary language
- Limit scope: Inspect only necessary files
- Increase timeout: For large projects
- Use SSD: Significantly improves performance
Future Improvements
Planned Enhancements
- Smart IDE selection: Based on file types in project
- Result caching: Cache inspection results
- Parallel execution: Run multiple IDEs concurrently
- Cloud inspection: Remote inspection service
Community Contributions
Help improve cross-IDE support:
- Test with different IDE combinations
- Report inconsistencies
- Contribute IDE-specific optimizations
- Share custom profiles