|
|
|
@@ -1,5 +1,8 @@ |
|
|
|
class Api::V1::SonarqubesController < Api::V1::BaseController |
|
|
|
before_action :load_repository |
|
|
|
include Repository::LanguagesPercentagable |
|
|
|
include SonarService |
|
|
|
|
|
|
|
def sonar_initialize |
|
|
|
gitea_params = { has_actions: params[:has_actions] == 'true' ? true :false } |
|
|
|
gitea_setting = Gitea::Repository::UpdateService.call(@owner, @project.identifier, gitea_params) |
|
|
|
@@ -89,11 +92,13 @@ class Api::V1::SonarqubesController < Api::V1::BaseController |
|
|
|
Gitea::CreateFileInteractor.call(@owner.gitea_token, @owner.login, sonar_scanner_content) |
|
|
|
end |
|
|
|
|
|
|
|
sonar_content = build_sonar_content(params[:owner], @project.id, languages_precentagable.keys) |
|
|
|
|
|
|
|
sonar_project_content = { |
|
|
|
filepath: 'sonar-project.properties', |
|
|
|
branch: params[:branch], |
|
|
|
new_branch: nil, |
|
|
|
"content": "sonar.projectKey=#{params[:owner]}-#{@project.id}\nsonar.projectVersion=1.0\nsonar.sourceEncoding=UTF-8\nsonar.sources=.\nsonar.java.binaries=.\nsonar.javascript.lcov.reportPaths=.\nsonar.python.coverage.reportPaths=.\nsonar.cxx.file.suffixes=.h,.cpp", |
|
|
|
"content": sonar_content, |
|
|
|
"message": 'Add sonar-project.properties', |
|
|
|
committer: { |
|
|
|
email: @owner.mail, |
|
|
|
@@ -101,6 +106,7 @@ class Api::V1::SonarqubesController < Api::V1::BaseController |
|
|
|
}, |
|
|
|
identifier: @project.identifier |
|
|
|
} |
|
|
|
|
|
|
|
sonar_project_exit = Repositories::EntriesInteractor.call(@owner, @project.identifier, 'sonar-project.properties', ref: params[:branch]) |
|
|
|
if sonar_project_exit.success? |
|
|
|
Gitea::UpdateFileInteractor.call(@owner.gitea_token, @owner.login, sonar_project_content.merge(sha:sonar_project_exit.result['sha'])) |
|
|
|
|