Skip to content

Move tree-sitter as a selectable analysis back-end to a commons module and use functionalities without exposing it in the core. #100

Description

@rahlk

Description:
Currently, the tool allows users to select Tree-sitter as an analysis backend through the core module. However, to streamline the architecture and encapsulate implementation details, Tree-sitter should be moved to a commons module. This refactoring will allow the tool to leverage Tree-sitter's functionalities internally without exposing it as a configurable option at the core level.

Additionally, CodeQL will be removed and therefore there is no longer a need to expose tree-sitter this way.

Acceptance Criteria:

  1. Tree-sitter is moved to a commons module, encapsulating all Tree-sitter-related logic.
  2. The core module no longer exposes Tree-sitter as a selectable analysis backend.
  3. Update all relevant documentation and code examples to reflect these changes.

Current Code (Before):

if self.analysis_backend in [AnalysisEngine.CODEQL, AnalysisEngine.TREESITTER]:
    # Perform analysis

Proposed Code (After):

from cldk.analysis.commons.treesitter import TreeSitterEngine

# Tree-sitter is now the fallback backend, no need for conditional checks

Steps to Implement:

  1. Create a commons module to house the Tree-sitter engine and related utilities.
  2. Refactor the core module to remove references to Tree-sitter as an exposed option.
  3. Update the initialization logic to use Tree-sitter as the default backend.
  4. Update documentation to reflect these structural changes.

Benefits:

  • Simplifies the core module by reducing unnecessary exposure of backend configurations.
  • Improves maintainability by isolating Tree-sitter-specific logic.

Environment:

  • OS: Fedora 41
  • Java Version: 21
  • Tool Version: 0.4.0 (and lower)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions