The documentation includes general guidance on adding coding rules, including which languages support adding custom rules, and general guidance on how to go about it.
If the docs don’t answer your question, please tell us:
- What language are you writing rules for?
- What have you tried, and what’s your challenge / stumbling block
Please share the relevant code snippet, along with any error messages you’re encountering:
AM using Sonarqube cloud enterprise
Language : Microsoft.NET\Framework\v4.0.30319
_________________________________________________________
name: Sonarqube
on:
push:
branches:
- feature/sonar2405
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build
runs-on: MY_RUNNER_WINDOWS
permissions: read-all
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- name: Cache SonarQube packages
uses: actions/cache@v1
with:
path: ~\.sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarQube scanner
id: cache-sonar-scanner
uses: actions/cache@v1
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarQube scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Build and analyze
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"XXXXXXXXXXXXXX" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="${{ secrets.SONAR_HOST_URL }}"
dotnet build
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
I used the above code.
My error is
**Run New-Item -Path .\.sonar\scanner -ItemType Directory**
** Directory: D:\GitHub-Actions\actions-runner\_work\cgs-fest\cgs-fest\.sonar**
**Mode LastWriteTime Length Name **
**---- ------------- ------ ---- **
**d----- 5/21/2024 12:03 PM scanner **
**dotnet : The term 'dotnet' is not recognized as the name of a cmdlet, function, script file, or operable program. **
**Check the spelling of the name, or if a path was included, verify that the path is correct and try again.**
**At D:\GitHub-Actions\actions-runner\_work\_temp\2bc0f3ae-33ef-4a1a-ad81-0dnddkddw33.ps1:3 char:1**
**+ dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner**
**+ ~~~~~~**
** + CategoryInfo : ObjectNotFound: (dotnet:String) [], ParentContainsErrorRecordException**
** + FullyQualifiedErrorId : CommandNotFoundException**
could you please help to fix the above error.