Skip to content

utajum/sonar-scanner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

                                                                                                        
     ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
     █                                                                                                 █
     █  ███████╗ ██████╗ ███╗   ██╗ █████╗ ██████╗                                                     █
     █  ██╔════╝██╔═══██╗████╗  ██║██╔══██╗██╔══██╗                                                    █
     █  ███████╗██║   ██║██╔██╗ ██║███████║██████╔╝                                                    █
     █  ╚════██║██║   ██║██║╚██╗██║██╔══██║██╔══██╗                                                    █
     █  ███████║╚██████╔╝██║ ╚████║██║  ██║██║  ██║                                                    █
     █  ╚══════╝ ╚═════╝ ╚═╝  ╚═══╝╚═╝  ╚═╝╚═╝  ╚═╝                                                    █
     █              ███████╗ ██████╗ █████╗ ███╗   ██╗███╗   ██╗███████╗██████╗                        █
     █              ██╔════╝██╔════╝██╔══██╗████╗  ██║████╗  ██║██╔════╝██╔══██╗                       █
     █              ███████╗██║     ███████║██╔██╗ ██║██╔██╗ ██║█████╗  ██████╔╝                       █
     █              ╚════██║██║     ██╔══██║██║╚██╗██║██║╚██╗██║██╔══╝  ██╔══██╗                       █
     █              ███████║╚██████╗██║  ██║██║ ╚████║██║ ╚████║███████╗██║  ██║                       █
     █              ╚══════╝ ╚═════╝╚═╝  ╚═╝╚═╝  ╚═══╝╚═╝  ╚═══╝╚══════╝╚═╝  ╚═╝                       █
     █                                                                                                 █
     █                      [ C O D E   V U L N E R A B I L I T Y   H U N T E R ]                      █
     █                                                                                                 █
     ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
                                                                                                        

Version License Docker Bash SonarQube Website

Style Zero Setup Works


>> RUN COMMAND >> SCAN CODE >> GET RESULTS >> DONE >>

A zero-configuration SonarQube scanner for developers who don't have time for setup wizards.


╔══════════════════════════════════════════════════════════════════════════════╗
║                                                                              ║
║   ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀   ║
║       ████████╗██████╗  █████╗ ███╗   ██╗███████╗███╗   ███╗██╗████████╗     ║
║       ╚══██╔══╝██╔══██╗██╔══██╗████╗  ██║██╔════╝████╗ ████║██║╚══██╔══╝     ║
║          ██║   ██████╔╝███████║██╔██╗ ██║███████╗██╔████╔██║██║   ██║        ║
║          ██║   ██╔══██╗██╔══██║██║╚██╗██║╚════██║██║╚██╔╝██║██║   ██║        ║
║          ██║   ██║  ██║██║  ██║██║ ╚████║███████║██║ ╚═╝ ██║██║   ██║        ║
║          ╚═╝   ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═══╝╚══════╝╚═╝     ╚═╝╚═╝   ╚═╝        ║
║       ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄   ║
║                          [ I N C O M I N G ]                                 ║
║                                                                              ║
╚══════════════════════════════════════════════════════════════════════════════╝

Run a single command. Get a full code quality report. No configuration needed.


◢◤ WHAT IS THIS? ◢◤

SONAR-SCANNER is a wrapper around SonarQube that makes code scanning effortless:

┌─────────────────────────────────────────────────────────────────────────────┐
│                                                                             │
│   ▸ Point it at ANY directory                                               │
│   ▸ Spins up SonarQube automatically if needed                              │
│   ▸ Handles authentication for you                                          │
│   ▸ Clears old scan data (fresh results every time)                         │
│   ▸ Scans your entire codebase for issues                                   │
│   ▸ Delivers results to your local SonarQube dashboard                      │
│                                                                             │
│   NO CONFIGURATION. NO SETUP WIZARDS. JUST WORKS.                           │
│                                                                             │
└─────────────────────────────────────────────────────────────────────────────┘

◢◤ FEATURES // CAPABILITIES MATRIX ◢◤

╔══════════════════════════════════════════════════════════════════════════════╗
║  FEATURE                          ║  STATUS      ║  DESCRIPTION              ║
╠══════════════════════════════════════════════════════════════════════════════╣
║  Zero Configuration               ║  ✓ ACTIVE    ║  Just run. We handle it.  ║
║  Auto SonarQube Deployment        ║  ✓ ACTIVE    ║  Spins up container       ║
║  Fresh Scans                      ║  ✓ ACTIVE    ║  Purges old project data  ║
║  Directory-Based Project Names    ║  ✓ ACTIVE    ║  Uses folder name         ║
║  Auto Authentication              ║  ✓ ACTIVE    ║  Handles credentials      ║
║  Issue Export                     ║  ✓ ACTIVE    ║  Download to JSON         ║
║  Retro Terminal Style             ║  ✓ MAXIMUM   ║  Neon. ASCII. Vibes.      ║
║  Idempotent Install               ║  ✓ ACTIVE    ║  Safe to run repeatedly   ║
╚══════════════════════════════════════════════════════════════════════════════╝

◢◤ SYSTEM REQUIREMENTS ◢◤

┌──────────────────────────────────────────────────────────────────────────────┐
│                                                                              │
│   ██████╗ ███████╗ ██████╗ ██╗   ██╗██╗██████╗ ███████╗██████╗               │
│   ██╔══██╗██╔════╝██╔═══██╗██║   ██║██║██╔══██╗██╔════╝██╔══██╗              │
│   ██████╔╝█████╗  ██║   ██║██║   ██║██║██████╔╝█████╗  ██║  ██║              │
│   ██╔══██╗██╔══╝  ██║▄▄ ██║██║   ██║██║██╔══██╗██╔══╝  ██║  ██║              │
│   ██║  ██║███████╗╚██████╔╝╚██████╔╝██║██║  ██║███████╗██████╔╝              │
│   ╚═╝  ╚═╝╚══════╝ ╚══▀▀═╝  ╚═════╝ ╚═╝╚═╝  ╚═╝╚══════╝╚═════╝               │
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘

  [ REQUIRED ]

    ◢ Docker          Running and accessible
    ◢ curl            For API communication
    ◢ Bash 4.0+       Shell environment
    ◢ Python 3        For data processing

  [ RECOMMENDED ]

    ◢ 4GB+ RAM        SonarQube needs memory
    ◢ 2GB+ Disk       For container images
    ◢ Fast Internet   For first-time image pulls

◢◤ INSTALLATION ◢◤

╔══════════════════════════════════════════════════════════════════════════════╗
║                                                                              ║
║   ██╗███╗   ██╗███████╗████████╗ █████╗ ██╗     ██╗                          ║
║   ██║████╗  ██║██╔════╝╚══██╔══╝██╔══██╗██║     ██║                          ║
║   ██║██╔██╗ ██║███████╗   ██║   ███████║██║     ██║                          ║
║   ██║██║╚██╗██║╚════██║   ██║   ██╔══██║██║     ██║                          ║
║   ██║██║ ╚████║███████║   ██║   ██║  ██║███████╗███████╗                     ║
║   ╚═╝╚═╝  ╚═══╝╚══════╝   ╚═╝   ╚═╝  ╚═╝╚══════╝╚══════╝                     ║
║                                                                              ║
╚══════════════════════════════════════════════════════════════════════════════╝
curl -fsSL https://raw.githubusercontent.com/utajum/sonar-scanner/refs/heads/master/install.sh | bash

◢◤ USAGE ◢◤

╔══════════════════════════════════════════════════════════════════════════════╗
║                                                                              ║
║    ██████╗ ██████╗ ███████╗██████╗  █████╗ ████████╗██╗ ██████╗ ███╗   ██╗   ║
║   ██╔═══██╗██╔══██╗██╔════╝██╔══██╗██╔══██╗╚══██╔══╝██║██╔═══██╗████╗  ██║   ║
║   ██║   ██║██████╔╝█████╗  ██████╔╝███████║   ██║   ██║██║   ██║██╔██╗ ██║   ║
║   ██║   ██║██╔═══╝ ██╔══╝  ██╔══██╗██╔══██║   ██║   ██║██║   ██║██║╚██╗██║   ║
║   ╚██████╔╝██║     ███████╗██║  ██║██║  ██║   ██║   ██║╚██████╔╝██║ ╚████║   ║
║    ╚═════╝ ╚═╝     ╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝   ╚═╝   ╚═╝ ╚═════╝ ╚═╝  ╚═══╝   ║
║                                                                              ║
╚══════════════════════════════════════════════════════════════════════════════╝

Basic Usage

# Navigate to your project
cd /path/to/your/project

# Run scan (interactive menu)
sonar-scan

# Or go directly to scan mode
sonar-scan --scan

More Options

# Scan specific directory
sonar-scan /path/to/target

# Download all issues to JSON
sonar-scan --download

# Quiet mode (minimal output)
sonar-scan --quiet

# Display help
sonar-scan --help

# Show version info
sonar-scan --version

Example Terminal Session

$ cd ~/projects/my-awesome-app
$ sonar-scan

    ╔═══════════════════════════════════════════════════════════════════════════════╗
    ║                                                                               ║
    ║   ███████╗ ██████╗ ███╗   ██╗ █████╗ ██████╗       ███████╗ ██████╗ █████╗    ║
    ║   ██╔════╝██╔═══██╗████╗  ██║██╔══██╗██╔══██╗      ██╔════╝██╔════╝██╔══██╗   ║
    ║   ███████╗██║   ██║██╔██╗ ██║███████║██████╔╝█████╗███████╗██║     ███████║   ║
    ║   ╚════██║██║   ██║██║╚██╗██║██╔══██║██╔══██╗╚════╝╚════██║██║     ██╔══██║   ║
    ║   ███████║╚██████╔╝██║ ╚████║██║  ██║██║  ██║      ███████║╚██████╗██║  ██║   ║
    ║   ╚══════╝ ╚═════╝ ╚═╝  ╚═══╝╚═╝  ╚═╝╚═╝  ╚═╝      ╚══════╝ ╚═════╝╚═╝  ╚═╝   ║
    ║                                                                               ║
    ║            [ C O D E   V U L N E R A B I L I T Y   H U N T E R ]              ║
    ║                                                                               ║
    ╚═══════════════════════════════════════════════════════════════════════════════╝

    ╔══════════════════════════════════════════════════════════════╗
    ║              S E L E C T   O P E R A T I O N                 ║
    ╠══════════════════════════════════════════════════════════════╣
    ║                                                              ║
    ║   [1]  ▸▸▸  RUN VULNERABILITY SCAN                           ║
    ║        Initiate full spectrum code analysis                  ║
    ║                                                              ║
    ║   [2]  ▸▸▸  DOWNLOAD ALL ISSUES                              ║
    ║        Extract vulnerability data to JSON                    ║
    ║                                                              ║
    ║   [Q]  ▸▸▸  EXIT                                             ║
    ║                                                              ║
    ╚══════════════════════════════════════════════════════════════╝

    ◢◤ ENTER COMMAND CODE: 1

[14:32:01] [INIT]    ▸ Starting up...
[14:32:01] [INIT]    ▸ Checking Docker connection...
[14:32:01] [DONE]    ▸ Docker is running
[14:32:02] [INIT]    ▸ Scanning for SonarQube instance at http://localhost:9000...
[14:32:02] [DONE]    ▸ SonarQube instance online and operational
[14:32:02] [AUTH]    ▸ Authenticating with SonarQube...
[14:32:03] [DONE]    ▸ Authentication successful. Token acquired.
[14:32:03] [PURGE]   ▸ Clearing previous scan data for my-awesome-app...
[14:32:03] [DONE]    ▸ Previous project data cleared
[14:32:03] [DEPLOY]  ▸ Starting scanner...

    ╔══════════════════════════════════════════════════════════════╗
    ║                                                              ║
    ║    █████╗  ██████╗ ██████╗███████╗███████╗███████╗           ║
    ║   ██╔══██╗██╔════╝██╔════╝██╔════╝██╔════╝██╔════╝           ║
    ║   ███████║██║     ██║     █████╗  ███████╗███████╗           ║
    ║   ██╔══██║██║     ██║     ██╔══╝  ╚════██║╚════██║           ║
    ║   ██║  ██║╚██████╗╚██████╗███████╗███████║███████║           ║
    ║   ╚═╝  ╚═╝ ╚═════╝ ╚═════╝╚══════╝╚══════╝╚══════╝           ║
    ║                                                              ║
    ║  SCAN COMPLETE                                               ║
    ║                                                              ║
    ║  View results:                                               ║
    ║  http://localhost:9000/dashboard?id=my-awesome-app           ║
    ║                                                              ║
    ╚══════════════════════════════════════════════════════════════╝

◢◤ INSTALLER OPERATIONS ◢◤

╔══════════════════════════════════════════════════════════════════════════════╗
║                                                                              ║
║   COMMAND                           DESCRIPTION                              ║
╠══════════════════════════════════════════════════════════════════════════════╣
║                                                                              ║
║   ./install.sh --install            Deploy to /usr/local/bin                 ║
║   ./install.sh --update             Upgrade existing installation            ║
║   ./install.sh --remove             Purge from system                        ║
║   ./install.sh --status             Check installation state                 ║
║   ./install.sh --help               Display help                             ║
║   ./install.sh                      Interactive mode                         ║
║                                                                              ║
╚══════════════════════════════════════════════════════════════════════════════╝

◢◤ CONFIGURATION MATRIX ◢◤

┌──────────────────────────────────────────────────────────────────────────────┐
│                                                                              │
│   SONAR-SCANNER requires NO configuration.                                   │
│                                                                              │
│   But if you're curious, here's what's happening under the hood:             │
│                                                                              │
│   ┌────────────────────────────────────────────────────────────────────┐     │
│   │  PARAMETER              │  DEFAULT VALUE                          │      │
│   ├────────────────────────────────────────────────────────────────────┤     │
│   │  SonarQube Host         │  http://localhost:9000                  │      │
│   │  Project Key            │  Current directory name                 │      │
│   │  Sources                │  . (entire directory)                   │      │
│   │  Exclusions             │  .git, node_modules, build, dist,       │      │
│   │                         │  vendor, *.min.js, *.min.css            │      │
│   │  Credentials            │  admin / Sonarscanner1!                 │      │
│   └────────────────────────────────────────────────────────────────────┘     │
│                                                                              │
│   First run with default 'admin/admin' auto-changes password for security.   │
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘

◢◤ TROUBLESHOOTING ◢◤

╔══════════════════════════════════════════════════════════════════════════════╗
║                                                                              ║
║   ███████╗██████╗ ██████╗  ██████╗ ██████╗ ███████╗                          ║
║   ██╔════╝██╔══██╗██╔══██╗██╔═══██╗██╔══██╗██╔════╝                          ║
║   █████╗  ██████╔╝██████╔╝██║   ██║██████╔╝███████╗                          ║
║   ██╔══╝  ██╔══██╗██╔══██╗██║   ██║██╔══██╗╚════██║                          ║
║   ███████╗██║  ██║██║  ██║╚██████╔╝██║  ██║███████║                          ║
║   ╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝ ╚═════╝ ╚═╝  ╚═╝╚══════╝                          ║
║                                                                              ║
╚══════════════════════════════════════════════════════════════════════════════╝

ERROR: Docker daemon unreachable

SOLUTION: Start Docker Desktop or the Docker service
          Linux: sudo systemctl start docker
          Mac: Open Docker Desktop app

ERROR: SonarQube initialization timeout

SOLUTION: SonarQube can take 1-2 minutes on first start
          Wait and try again, or manually start:
          docker run -d --name sonarqube -p 9000:9000 sonarqube:latest

ERROR: Authentication failed

SOLUTION: If you've changed the default password manually,
          update the SECURE_PASSWORD in sonar-scan.sh
          or reset SonarQube container:
          docker rm -f sonarqube && sonar-scan

ERROR: Permission denied during install

SOLUTION: Run installer with sudo:
          sudo ./install.sh --install

◢◤ ARCHITECTURE ◢◤

┌──────────────────────────────────────────────────────────────────────────────┐
│                                                                              │
│                         ┌─────────────────────┐                              │
│                         │       USER          │                              │
│                         │       (You)         │                              │
│                         └──────────┬──────────┘                              │
│                                    │                                         │
│                                    ▼                                         │
│                         ┌─────────────────────┐                              │
│                         │   sonar-scan CLI    │                              │
│                         │   ═══════════════   │                              │
│                         │  • Banner Display   │                              │
│                         │  • Arg Parsing      │                              │
│                         │  • Auth Handler     │                              │
│                         └──────────┬──────────┘                              │
│                                    │                                         │
│                    ┌───────────────┴───────────────┐                         │
│                    ▼                               ▼                         │
│         ┌─────────────────────┐         ┌─────────────────────┐              │
│         │   Docker Daemon     │         │  SonarQube API      │              │
│         │   ═══════════════   │         │  ═══════════════    │              │
│         │  • Container Mgmt   │◄────────│  • Authentication   │              │
│         │  • Network Host     │         │  • Project Delete   │              │
│         └──────────┬──────────┘         │  • Issue Download   │              │
│                    │                    └─────────────────────┘              │
│                    ▼                               ▲                         │
│         ┌─────────────────────┐                    │                         │
│         │ sonar-scanner-cli   │────────────────────┘                         │
│         │ (Docker Container)  │                                              │
│         │  • Code Analysis    │                                              │
│         │  • Report Upload    │                                              │
│         └─────────────────────┘                                              │
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘

◢◤ CREDITS ◢◤

╔══════════════════════════════════════════════════════════════════════════════╗
║                                                                              ║
║   ██████╗██████╗ ███████╗██████╗ ██╗████████╗███████╗                        ║
║  ██╔════╝██╔══██╗██╔════╝██╔══██╗██║╚══██╔══╝██╔════╝                        ║
║  ██║     ██████╔╝█████╗  ██║  ██║██║   ██║   ███████╗                        ║
║  ██║     ██╔══██╗██╔══╝  ██║  ██║██║   ██║   ╚════██║                        ║
║  ╚██████╗██║  ██║███████╗██████╔╝██║   ██║   ███████║                        ║
║   ╚═════╝╚═╝  ╚═╝╚══════╝╚═════╝ ╚═╝   ╚═╝   ╚══════╝                        ║
║                                                                              ║
╠══════════════════════════════════════════════════════════════════════════════╣
║                                                                              ║
║   CREATED BY:       utajum                                                   ║
║   POWERED BY:       SonarQube // Docker // Pure Bash Madness                 ║
║   AESTHETIC:        Retro terminal meets ANSI NFO files                      ║
║   SOUNDTRACK:       Perturbator, Carpenter Brut, Lazerhawk                   ║
║                                                                              ║
║   SPECIAL THANKS:                                                            ║
║   • SonarSource for building the scanner                                     ║
║   • Docker for containerization                                              ║
║   • Retro terminal aesthetics                                                ║
║   • Coffee, lots of coffee                                                   ║
║                                                                              ║
╚══════════════════════════════════════════════════════════════════════════════╝

◢◤ LICENSE ◢◤

MIT License

Copyright (c) 2024 utajum

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files...

╔══════════════════════════════════════════════════════════════════════════════╗
║                                                                              ║
║   ███████╗███╗   ██╗██████╗     ████████╗██████╗  █████╗ ███╗   ██╗███████╗  ║
║   ██╔════╝████╗  ██║██╔══██╗    ╚══██╔══╝██╔══██╗██╔══██╗████╗  ██║██╔════╝  ║
║   █████╗  ██╔██╗ ██║██║  ██║       ██║   ██████╔╝███████║██╔██╗ ██║███████╗  ║
║   ██╔══╝  ██║╚██╗██║██║  ██║       ██║   ██╔══██╗██╔══██║██║╚██╗██║╚════██║  ║
║   ███████╗██║ ╚████║██████╔╝       ██║   ██║  ██║██║  ██║██║ ╚████║███████║  ║
║   ╚══════╝╚═╝  ╚═══╝╚═════╝        ╚═╝   ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═══╝╚══════╝  ║
║                                                                              ║
║                    // SCAN YOUR CODE //                                      ║
║                    // FIX YOUR BUGS //                                       ║
║                    // SHIP WITH CONFIDENCE //                                ║
║                                                                              ║
╚══════════════════════════════════════════════════════════════════════════════╝

⬆ BACK TO TOP


Website: https://sonar-scan.elevatech.xyz/


"Good code is its own best documentation." - Steve McConnell

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages