sinpro.dev
Docs
Git
Git User Profiles
  • Company Information
    • Portfolio
    • About
    • Services
    • Events
  • Dev Environment
    • macOS Settings
    • Chrome Extensions
    • VSCode Workspace Settings
    • VSCode Workspace Extensions
    • Global NPM Packages
    • npm-check-updates
    • SvelteKit
    • Customize Zsh
    • ChatGPT Prompts
    • Tailwind CSS
    • Warp
    • Keyboard Shortcuts
  • Assets
    • Assets
    • JPG/PNG to AVIF
    • TTF to WOFF2
  • Clean Code
    • Clean Code
    • Format
    • Quality
    • Variables
    • Functions
    • Objects and Data Structures
    • Classes
    • Concurrency
    • Error handling
    • Comments
  • Code Style
    • TypeScript Config
    • Prettier
    • ESLint
    • Stylelint
  • Testing
    • Vitest
    • Playwright
  • Git
    • Git Branches and Commits
    • Git Hooks
    • Git User Profiles
    • Git for Windows
  • GitHub
    • GitHub Issues
    • GitHub Pull Requests
    • GitHub Repository Settings
    • GitHub Branch Protection
    • GitHub Actions
  • Code Quality
    • SonarCloud Coverage
  • Server
    • SSH
    • PM2
    • Caddy
    • Updating the server
    • ngrok
  • Team sinProject
    • Our Team Policy
    • Equipment and Supplies
    • Books
    • Slack
    • Locales
    • Funny Apps
    • Docs History
  • Talk
    • Talk
    • Creating a Project
    • App Structure

Code Quality

SonarCloud Coverage

Edit this page
Coverage

SonarCloud is a cloud-based code quality and security service. It automatically analyzes and provides feedback on code changes in software projects through continuous inspection.

It integrates with popular development workflows, particularly within continuous integration/continuous delivery (CI/CD) pipelines.

SonarCloud guide on Test Coverage >

Use CI-based, not automatic analysis

  • Sign in to SonarCloud
  • Open Your Organization > Your Project > Administration > Analysis Method
  • Disable Automatic Analysis

Analyze a project with a GitHub Action

  • Open Your Organization > Your Project > Administration > Analysis Method
  • Click With GitHub Actions
  • Create a GitHub Secret
  • Create or update a build file

Create or update a build file for JS, TS, Go, Python, PHP, …

Create a sonar-project.properties file

Create a configuration file in the root directory of the project and name it sonar-project.properties

sonar-project.properties
sonar.projectKey=sinProject-Inc_sinpro-dev
sonar.organization=sinproject-inc
sonar.javascript.lcov.reportPaths=./coverage/lcov.info
sonar.coverage.exclusions=**/tests/**, **/*.test.*, **/*.config.*, **/+*, src/hooks.server.ts

Create or update a ci.yml file

.github/workflows/ci.yml
name: Build

on:
  push:
    branches:
      - main
  pull_request:
    types: [opened, synchronize, reopened]

jobs:
  tests:
    name: Vitest Test
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Install dependencies
        run: npm run install

			- name: Vitest Test and coverage
        run: npx vitest run --coverage

      - name: SonarCloud Scan
        uses: SonarSource/sonarcloud-github-action@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
GitHub Actions SSH
© sinProject. v0.73.0
On this page
  • SonarCloud Coverage
  • Use CI-based, not automatic analysis
  • Analyze a project with a GitHub Action
  • Create or update a build file for JS, TS, Go, Python, PHP, …
  • Create a sonar-project.properties file
  • Create or update a ci.yml file