PMD Apex language module providing static code analysis support for Salesforce Apex programming language.
—
Core language module registration and configuration for PMD integration. Provides entry points for parser creation, language properties, and violation suppression handling.
Main entry point for the Apex language module integration with PMD framework.
/**
* Main entry point for the Apex language module
* Singleton class that provides PMD integration
*/
public class ApexLanguageModule {
/** Get singleton instance of the language module */
public static ApexLanguageModule getInstance();
/** Create language processor for batch processing */
public ApexLanguageProcessor createProcessor(LanguagePropertyBundle bundle);
/** Create new property bundle with language-specific properties */
public LanguagePropertyBundle newPropertyBundle();
/** Create CPD lexer for copy-paste detection */
public Lexer createCpdLexer(LanguagePropertyBundle bundle);
}Handles batch processing of Apex files with multifile analysis support.
/**
* Language processor for batch processing of Apex files
*/
public class ApexLanguageProcessor {
/** Get language version handler for parsing and analysis */
public LanguageVersionHandler services();
/** Get multifile analysis state for cross-file analysis */
public ApexMultifileAnalysis getMultiFileState();
}Configuration and properties specific to Apex language processing.
/**
* Language-specific properties and configuration
*/
public class ApexLanguageProperties {
/** Property for specifying Salesforce metadata root directory for multifile analysis */
public static final PropertyDescriptor<String> MULTIFILE_DIRECTORY;
}Handles @SuppressWarnings annotation processing for PMD violations.
/**
* Handles @SuppressWarnings annotation processing
*/
public class ApexViolationSuppressors {
/** List of all Apex violation suppressors */
public static final List<ViolationSuppressor> ALL_APEX_SUPPRESSORS;
}Usage Examples:
// Register Apex language module
ApexLanguageModule apexModule = ApexLanguageModule.getInstance();
// Create language processor with properties
LanguagePropertyBundle properties = apexModule.newPropertyBundle();
properties.setProperty(ApexLanguageProperties.MULTIFILE_DIRECTORY, "/path/to/salesforce/metadata");
ApexLanguageProcessor processor = apexModule.createProcessor(properties);
// Get language services
LanguageVersionHandler handler = processor.services();
// Access multifile analysis
ApexMultifileAnalysis multifileAnalysis = processor.getMultiFileState();
if (!multifileAnalysis.isFailed()) {
List<Issue> issues = multifileAnalysis.getFileIssues("MyClass.cls");
for (Issue issue : issues) {
System.out.println("Issue: " + issue.getMessage());
}
}
// Create CPD lexer for duplicate detection
Lexer cpdLexer = apexModule.createCpdLexer(properties);Install with Tessl CLI
npx tessl i tessl/maven-net-sourceforge-pmd--pmd-apex