CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-net-sourceforge-pmd--pmd-scala-2-12

PMD Scala language support for Scala 2.12 - provides parsing and static analysis capabilities for Scala code as part of the PMD extensible multilanguage static code analyzer

Overview
Eval results
Files

language-module.mddocs/

Language Module

The language module provides core PMD integration for Scala support, registering the language with PMD's framework and providing version-specific configuration.

Core Language Integration

ScalaLanguageModule

Main language module registration class that integrates Scala with PMD's multilanguage architecture.

public class ScalaLanguageModule extends SimpleLanguageModuleBase {
    public ScalaLanguageModule();
    public static ScalaLanguageModule getInstance();
    public CpdLexer createCpdLexer(LanguagePropertyBundle bundle);
}

Usage Example:

// Get the singleton Scala language module instance
ScalaLanguageModule module = ScalaLanguageModule.getInstance();

// Create a CPD lexer for copy-paste detection
LanguagePropertyBundle bundle = // ... configure language properties
CpdLexer lexer = module.createCpdLexer(bundle);

ScalaLanguageHandler

Language version handler that provides parser instances for different Scala versions.

public class ScalaLanguageHandler extends AbstractPmdLanguageVersionHandler {
    public ScalaParser getParser();
}

Usage Example:

ScalaLanguageHandler handler = new ScalaLanguageHandler();
ScalaParser parser = handler.getParser();

Supported Versions

The module supports the following Scala versions through dialect configuration:

  • Scala 2.10: Historical support
  • Scala 2.11: Historical support
  • Scala 2.12: Primary target version for this module
  • Scala 2.13: Default version used when no specific version is specified

Integration Points

PMD Framework Integration

The language module integrates with PMD through:

  1. Language Registry: Registers "scala" as a supported language
  2. File Extensions: Associates ".scala" files with the Scala language module
  3. Version Management: Provides version-specific parsing capabilities
  4. CPD Integration: Creates lexers for copy-paste detection

Configuration

Language configuration is handled through:

// Language metadata configuration
LanguageMetadata.withId("scala")
    .name("Scala")
    .extensions("scala")
    .addVersion("2.10")
    .addVersion("2.11") 
    .addVersion("2.12")
    .addDefaultVersion("2.13")

The module automatically configures:

  • Language identifier: "scala"
  • Display name: "Scala"
  • File extensions: ".scala"
  • Supported versions with 2.13 as default

Install with Tessl CLI

npx tessl i tessl/maven-net-sourceforge-pmd--pmd-scala-2-12

docs

ast-parsing.md

ast-traversal.md

copy-paste-detection.md

index.md

language-module.md

rule-development.md

tile.json