diff --git a/app/controllers/api/v1/sonarqubes_controller.rb b/app/controllers/api/v1/sonarqubes_controller.rb index 836d2465b..e234aeb97 100644 --- a/app/controllers/api/v1/sonarqubes_controller.rb +++ b/app/controllers/api/v1/sonarqubes_controller.rb @@ -46,33 +46,31 @@ class Api::V1::SonarqubesController < Api::V1::BaseController filepath: '.gitea/workflows/SonarScanner.yaml', branch: params[:branch], new_branch: nil, - content: " - name: Sonar Scanner - jobs: - sonarqube: - runs-on: ubuntu-latest - steps: - - uses: #{checkout_url} - with: - # Disabling shallow clones is recommended for improving the relevancy of reporting - fetch-depth: 1 - single-branch: true - - name: curl doxygen - run: | - curl -X GET #{doxygen_url}/generate?repo=#{@project.repository.url} - - - name: new properties - run: | - cat < sonar-project.properties - #{sonar_content} - EOF - - - name: SonarQube Scan - uses: #{scanner_url} - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - ", + content: <<-YAML +name: Sonar Scanner +jobs: + sonarqube: + runs-on: ubuntu-latest + steps: + - uses: #{checkout_url} + with: + fetch-depth: 1 + single-branch: true + - name: curl doxygen + run: | + curl -X GET #{doxygen_url}/generate?repo=#{@project.repository.url} + - name: new properties + run: | +cat < sonar-project.properties +#{sonar_content} +EOF + - name: SonarQube Scan + uses: #{scanner_url} + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} +YAML +, message: 'Add .gitea/workflows/SonarScanner.yaml', committer: { email: @owner.mail, diff --git a/app/libs/sonar_service.rb b/app/libs/sonar_service.rb index 0df911b60..100cc8c85 100644 --- a/app/libs/sonar_service.rb +++ b/app/libs/sonar_service.rb @@ -39,6 +39,6 @@ module SonarService lines << "sonar.cxx.errorRecoveryEnabled=true" end - lines.join("\n") + lines end end \ No newline at end of file