Skip to content

Commit

Permalink
Atualizando as configurações do SonarCloud
Browse files Browse the repository at this point in the history
Atualizando as configurações do SonarCloud
  • Loading branch information
EduardoGurgel authored Oct 19, 2023
2 parents dd3b878 + 7349150 commit de9e8ae
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 5 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Criar diretório
run: mkdir analytics-raw-data

Expand All @@ -24,10 +23,10 @@ jobs:
run: |
git config --global user.email "${{secrets.USER_EMAIL}}"
git config --global user.name "${{secrets.USER_NAME}}"
git clone --single-branch --branch main "https://x-access-token:${{secrets.API_TOKEN_DOC}}@github.com/fga-eps-mds/2023-2-GEROcuidado-Doc" doc
mkdir -p doc/analytics-raw-data
cp -R analytics-raw-data/*.json doc/analytics-raw-data
cd doc/
git clone --single-branch --branch main "https://x-access-token:${{secrets.API_TOKEN_DOC}}@github.com/fga-eps-mds/2023-2-GEROcuidado-Doc" docs
mkdir -p docs/analytics-raw-data
cp -R analytics-raw-data/*.json docs/analytics-raw-data
cd docs/
git add .
git commit -m "Adicionando métricas do repositório ${{ github.event.repository.name }} ${{ github.ref_name }}"
git push
Expand Down
39 changes: 39 additions & 0 deletions parser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import json
import requests
import sys
from datetime import datetime

TODAY = datetime.now()

METRICS_SONAR = [
"files",
"functions",
"complexity",
"comment_lines_density",
"duplicated_lines_density",
"coverage",
"ncloc",
"tests",
"test_errors",
"test_failures",
"test_execution_time",
"security_rating",
]

BASE_URL = "https://sonarcloud.io/api/measures/component_tree?component=fga-eps-mds_"

if __name__ == "__main__":

REPO = sys.argv[1]
RELEASE_VERSION = sys.argv[2]

response = requests.get(
f'{BASE_URL}{REPO}&metricKeys={",".join(METRICS_SONAR)}&ps=500'
)
j = json.loads(response.text)

file_path = f'./analytics-raw-data/fga-eps-mds-{REPO}-{TODAY.strftime("%m-%d-%Y-%H-%M-%S")}-{RELEASE_VERSION}.json'

with open(file_path, "w") as fp:
fp.write(json.dumps(j))
fp.close()
1 change: 1 addition & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ sonar.organization=fga-eps-mds-1


sonar.sources=./src
sonar.sources.exclusions=./e2e, /.vscode

sonar.tests=./e2e

Expand Down

0 comments on commit de9e8ae

Please sign in to comment.