# jetbrains/qodana-action architecture

> Architecture diagram of the GitHub repository jetbrains/qodana-action, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jetbrains/qodana-action
- Repository: https://github.com/jetbrains/qodana-action

## Overview

##### Main Components Identification

a) Core Components:
- Qodana Plugin (Kotlin-based)
- Scan Module (TypeScript-based)
- CI/CD Integration Modules:
- GitHub Actions
- Azure DevOps (VSTS)
- CircleCI Orb

b) External Services:
- GitHub API
- Qodana Cloud
- CI/CD Platforms

**┌─ CI/CD Layer ─────────────────────────────┐**
- GitHub Actions  │  Azure DevOps  │  CircleCI  │
- ┘
- ↓             ↓              ↓
**┌─ Core Layer ──────────────────────────────┐**
- ┌─ Qodana Action ─┐                       │
- Scan Module    │ ←→ Qodana Plugin      │
- (TypeScript)   │    (Kotlin)           │
- ┘                        │
- ┘
- ↕             ↕              ↕
**┌─ External Services Layer ─────────────────┐**
- GitHub API  │  Qodana Cloud  │  Storage   │
- ┘

##### Component Details

For each component, include:

a) Qodana Plugin:
- Input: Project source code
- Output: SARIF reports
- Configuration: qodana.yaml

b) Scan Module:
- Functionality: Code analysis
- Integration: CI/CD platforms
- Results processing

c) CI/CD Integrations:
- Configuration options
- Authentication flows
- Results reporting

##### Data Flow Representation

Following flows:
- Source code → Qodana Scanner
- Scanner → SARIF output
- SARIF → CI/CD platforms
- Results → Qodana Cloud
- Annotations → GitHub/Azure DevOps

##### Important Details

- Quality Gate workflow
- Baseline processing
- Quick-fixes application flow
- Cache management
- Results upload paths

##### The various integration points with external services

This system design should help developers understand both the high-level architecture and the specific implementation details of the Qodana Scan project.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef cicd fill:#4A90E2,color:white
    classDef core fill:#2ECC71,color:white
    classDef external fill:#95A5A6,color:white
    classDef config fill:#E67E22,color:white

    %% CI/CD Layer
    subgraph CI
        GHA["GitHub Actions"]:::cicd
        AZ["Azure DevOps"]:::cicd
        CC["CircleCI Orb"]:::cicd
    end

    %% Core Layer
    subgraph Core
        QA["Qodana Action"]:::core
        SM["Scan Module\n(TypeScript)"]:::core
        QP["Qodana Plugin\n(Kotlin)"]:::core
        CU["Common Utilities"]:::core
        ST["Scan Task"]:::core
        RP["Results Processor"]:::core
        AH["Annotations Handler"]:::core
    end

    %% External Services Layer
    subgraph External
        GAPI["GitHub API"]:::external
        QC["Qodana Cloud"]:::external
        Storage["Storage"]:::external
    end

    %% Configuration
    Config["Configuration"]:::config

    %% Relationships
    GHA --> QA
    AZ --> QA
    CC --> QA
    
    QA --> SM
    SM --> QP
    SM --> CU
    QP --> ST
    ST --> RP
    RP --> AH
    
    AH --> GAPI
    RP --> QC
    QP --> Storage
    
    Config --> QA

    %% Click Events
    click QP "https://github.com/JetBrains/qodana-action/blob/main/plugin/src/main/kotlin/org/jetbrains/qodana/QodanaPlugin.kt"
    click SM "https://github.com/JetBrains/qodana-action/blob/main/scan/src/main.ts"
    click GHA "https://github.com/JetBrains/qodana-action/blob/main/action.yaml"
    click AZ "https://github.com/JetBrains/qodana-action/blob/main/vsts/QodanaScan/task.json"
    click CC "https://github.com/JetBrains/qodana-action/blob/main/orb/@orb.yml"
    click CU "https://github.com/JetBrains/qodana-action/blob/main/common/qodana.ts"
    click ST "https://github.com/JetBrains/qodana-action/blob/main/plugin/src/main/kotlin/org/jetbrains/qodana/tasks/QodanaScanTask.kt"
    click RP "https://github.com/JetBrains/qodana-action/blob/main/scan/src/output.ts"
    click AH "https://github.com/JetBrains/qodana-action/blob/main/scan/src/annotations.ts"
    click Config "https://github.com/JetBrains/qodana-action/blob/main/.github/qodana.yaml"

    %% Legend
    subgraph Legend
        L1["CI/CD Components"]:::cicd
        L2["Core Components"]:::core
        L3["External Services"]:::external
        L4["Configuration"]:::config
    end
```
