Node JS
  • SetUp Node&NVM
  • Folder Structure
  • Setup NodeJS Project
  • Library
    • Awilix
    • Swagger
    • Express
    • Jest
      • Supertest
    • Prettier
    • Eslint & Tslint
      • Tslint & Prettier
      • Tslint Plugin Prettier
      • Config With Airbnb
    • Husky And Friends
    • Sentry
  • INFRASTRUCTURE
    • Docker
      • Docker image
      • Docker container
      • Docker Volume
      • Docker command
      • Docker Compose
      • Problem & Solution
    • SonarQube
      • How to use in Nodejs
    • NGinX
    • ดูเพิ่มเติม
  • Note
    • .env declare type
    • Learn Link
Powered by GitBook
On this page
  • ความสามารถของ SonarQube หลักๆ มีดังนี้
  • Install
  • เรียกใช้งาน
  1. INFRASTRUCTURE

SonarQube

เป็นเครื่องมือที่ช่วยให้เราสามารถตรวจสอบคุณภาพโค้ดและมีการแนะนำเพื่อปรับปรุงคุณภาพให้ดียิ่งขึ้น

PreviousProblem & SolutionNextHow to use in Nodejs

Last updated 3 years ago

ความสามารถของ SonarQube หลักๆ มีดังนี้

  • ตรวจหาข้อผิดพลาด (Bugs) ใน Source Code

  • ช่วยค้นหาพวก Source Code ที่แย่ๆ ซับซ้อน มีกลิ่นตุๆว่าจะเป็นปัญหาในอนาคต (Code Smells)

  • ช่วยค้นหาช่องโหว่ต่างๆ ที่เป็นข้อผิดพลาดหรือปัญหาด้านความปลอดภัย (Vulnerabilities)

  • กำหนดค่าของคุณภาพที่จะให้ผ่านได้ด้วยนะ (Quality Gate) เช่น ต้องมี Code Coverage 80%

  • ทำงานร่วมกับ Automation Tools เช่น เพื่อทำ ได้ (Continuous Code Quality)

  • รองรับการตรวจสอบภาษาฮิตๆ ได้มากกว่า 20 ภาษา เช่น Java, PHP, C#, Python, Swift, C/C++, Javascript ฯลฯ

Install

  1. download

  2. go to git folder

  3. run command docker-compose up -d --build

  4. add adminner เพื่อจัดการ database

    service
    ...
      adminer:
          image: adminer
          networks:
            - sonarnet
          restart: always
          ports:
            - 8080:8080

For M1 file: docker-compose.yml

1.เปลี่ยน

 image: sonarqube:5.6.6-alpine

เป็น

image: 'mwizner/sonarqube:8.7.1-community'

2.เพิ่ม platform ที่ postgres

image: 'postgres:latest'
platform: linux/x86_64

เรียกใช้งาน

โดยการเข้าครั้งแรกจะให้ใส่รหัส Username: admin Password: admin

Jenkins
Continueus Integration
git
http://localhost:9001
มาลองใช้ SonarQube ในตรวจสอบคุณภาพโค๊ดของเรากันเถอะMedium
ตรวจสอบคุณภาพของ Code ด้วย SonarQubeMedium
http://localhost:9001/projects
Logo
Logo