Error for Code Analysis sql

Hi, i am needing a help,
The task Run Code Analysis show the error can not be decided as the file matches patterns of both sonar.lang.patterns.plsql : **/*.sql,**/*.pks, we want that sonar validad sql project’s

My enviroment
SonarQubeEnterprise LTS 9.9
Project: Dotnet 6 Dotnet
DataBase: Azure sql server

my sonar yaml

parameters:
- name: ProjectName
  type: string
  default: '$(Build.Repository.Name)'
  
- name: Projects
  type: string
  default: |
     test/**/*.csproj 
     !**/*HealthCheckTests.csproj

jobs:
- job: 
  displayName: Sonar
  pool:
    name: default
    demands: 
        - java
 
  steps:   
    - task: sonarsource.sonarqube.15B84CA1-B62F-4A2A-A403-89B77A063157.SonarQubePrepare@4
      displayName: 'Prepare analysis on SonarQube'
      inputs:
        SonarQube: SonarQube
        projectKey: ${{parameters.ProjectName}}
        projectName: ${{parameters.ProjectName}}
        projectVersion: '$(Build.BuildNumber)'
        extraProperties: |    
         sonar.cs.opencover.reportsPaths="$(Build.SourcesDirectory)\TestResults\Coverage\coverage.opencover.xml"
         sonar.cs.vscoveragexml.reportsPaths="$(Build.SourcesDirectory)\TestResults\Coverage\coverage.opencover.xml"
         sonar.cs.vstest.reportsPaths="$(Agent.TempDirectory)\*.trx"
         sonar.scm.enabled=false
         sonar.qualitygate.wait=true
         sonar.qualitygate.timeout=300
         sonar.exclusions=**\Migrations\**
  
    - task: DotNetCoreCLI@2
      displayName: 'dotnet test'
      inputs:
        command: test
        projects: ${{parameters.Projects}}
        arguments: '--collect "XPlat Code coverage" /p:CollectCoverage=true /p:CoverletOutputFormat="cobertura%2copencover" /p:CoverletOutput=$(Build.SourcesDirectory)\TestResults\Coverage\'  

    - task: Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@5
      displayName: ReportGenerator
      inputs:
        reports: '$(Agent.TempDirectory)/**/coverage.cobertura.xml'
        targetdir: '$(Build.SourcesDirectory)/TestResults/Coverlet/Reports'
        reporttypes: 'Cobertura'

    - task: PublishCodeCoverageResults@1
      displayName: 'Publish code coverage from cobertura'
      inputs:
        codeCoverageTool: Cobertura  
        summaryFileLocation: '$(Build.SourcesDirectory)/TestResults/Coverlet/Reports/Cobertura.xml'  

    - task: SonarQubeAnalyze@5
      displayName: 'Run Code Analysis'

    - task: SonarQubePublish@5
      displayName: 'Publish Quality Gate Result'
      continueOnError: true

INFO: Indexing files of module 'PrbTEST.Repository'
INFO:   Base dir: D:\TFS\Agents\TPRB1048-v3_1\_work\82\s\src\PrbTEST.Repository
INFO:   Excluded sources: **\Migrations\**
INFO: Indexing files of module 'PrbTEST.Infra.Mvc'
INFO:   Base dir: D:\TFS\Agents\TPRB1048-v3_1\_work\82\s\src\PrbTEST.Infra.Mvc
INFO:   Source paths: Auth/Attributes/BearerAuthorizeAttribute.cs, Auth/AuthConfigu...
INFO:   Excluded sources: **\Migrations\**
INFO: Indexing files of module 'PrbTEST.Validation'
INFO:   Base dir: D:\TFS\Agents\TPRB1048-v3_1\_work\82\s\src\PrbTEST.Validation
INFO:   Excluded sources: **\Migrations\**
INFO: Indexing files of module 'PrbTEST.SharedKernel'
INFO:   Base dir: D:\TFS\Agents\TPRB1048-v3_1\_work\82\s\src\PrbTEST.SharedKernel
INFO:   Source paths: Auth/AuthenticationCommand.cs, Auth/AuthenticationResponse.cs...
INFO:   Excluded sources: **\Migrations\**
INFO: Indexing files of module 'PrbTEST.Infra'
INFO:   Base dir: D:\TFS\Agents\TPRB1048-v3_1\_work\82\s\src\PrbTEST.Infra
INFO:   Excluded sources: **\Migrations\**
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 12.430s
INFO: Final Memory: 23M/108M
INFO: ------------------------------------------------------------------------
##[error]ERROR: Error during SonarScanner execution
ERROR: Language of file 'src\PrbTEST.Infra\Resources\Atual.sql' can not be decided as the file matches patterns of both sonar.lang.patterns.plsql : **/*.sql,**/*.pks,**/*.pkb and sonar.lang.patterns.plsqlcop : **/*.sql,**/*.prc,**/*.fnc,**/*.pks,**/*.pkb,**/*.trg,**/*.vw,**/*.tps,**/*.tpb,**/*.tbp,**/*.plb,**/*.pls,**/*.rcv,**/*.spc,**/*.typ,**/*.aqt,**/*.aqp,**/*.ctx,**/*.dbl,**/*.tab,**/*.dim,**/*.snp,**/*.con,**/*.collt,**/*.seq,**/*.syn,**/*.grt,**/*.sp,**/*.spb,**/*.sps,**/*.pck,**/*.md,**/*.mdown
ERROR:
ERROR: Error during SonarScanner execution
ERROR: Language of file 'src\PrbTEST.Infra\Resources\QuestionarioAtual.sql' can not be decided as the file matches patterns of both sonar.lang.patterns.plsql : **/*.sql,**/*.pks,**/*.pkb and sonar.lang.patterns.plsqlcop : **/*.sql,**/*.prc,**/*.fnc,**/*.pks,**/*.pkb,**/*.trg,**/*.vw,**/*.tps,**/*.tpb,**/*.tbp,**/*.plb,**/*.pls,**/*.rcv,**/*.spc,**/*.typ,**/*.aqt,**/*.aqp,**/*.ctx,**/*.dbl,**/*.tab,**/*.dim,**/*.snp,**/*.con,**/*.collt,**/*.seq,**/*.syn,**/*.grt,**/*.sp,**/*.spb,**/*.sps,**/*.pck,**/*.md,**/*.mdown
ERROR: 
##[error]The SonarScanner did not complete successfully

its working, i fix the sonar extraProperties

before

 extraProperties: |             
         sonar.cs.opencover.reportsPaths="$(Build.SourcesDirectory)\TestResults\Coverage\coverage.opencover.xml"         sonar.cs.vscoveragexml.reportsPaths="$(Build.SourcesDirectory)\TestResults\Coverage\coverage.opencover.xml"
         sonar.cs.vstest.reportsPaths="$(Agent.TempDirectory)\*.trx"
         sonar.scm.enabled=false
         sonar.qualitygate.wait=true
         sonar.qualitygate.timeout=300
         sonar.exclusions=**\Migrations\**

Now

 extraProperties: |   
         sonar.cs.opencover.reportsPaths="$(Build.SourcesDirectory)\TestResults\Coverage\coverage.opencover.xml"         sonar.cs.vscoveragexml.reportsPaths="$(Build.SourcesDirectory)\TestResults\Coverage\coverage.opencover.xml"
         sonar.cs.vstest.reportsPaths="$(Agent.TempDirectory)\*.trx"
         sonar.scm.enabled=false
         sonar.qualitygate.wait=true
         sonar.qualitygate.timeout=300
         sonar.lang.patterns.plsql=sql
         sonar.plsql.file.suffixes=sql
         sonar.lang.patterns.tsql=sql
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.