Skip to content

Commit 24346eb

Browse files
Reduce pylint python versions, add sonar-scanner download and install (#2564)
* Reduce pylint python versions, add sonar-scanner download and install * Change installation way of sonar-scanner * Fix installation way of sonar-scanner * Change test-ci to not run sonar and create new sonar task
1 parent 9ab0de3 commit 24346eb

File tree

4 files changed

+36
-7
lines changed

4 files changed

+36
-7
lines changed

.github/workflows/build.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,18 @@ jobs:
3737
run: pip install .
3838
- name: Run RIDE unit-tests
3939
run: invoke test-ci
40-
- name: SonarCloud Scan
41-
uses: SonarSource/sonarcloud-github-action@master
40+
- name: Analyze with SonarCloud
41+
uses: sonarsource/sonarcloud-github-action@master
42+
with:
43+
projectBaseDir: ${{ github.workspace }}
44+
args: >
45+
-Dsonar.organization=helioguilherm66
46+
-Dsonar.projectKey=HelioGuilherme66_RIDE
47+
-Dsonar.python.coverage.reportPaths=.coverage-reports/coverage.xml
48+
-Dsonar.sources=src/
49+
-Dsonar.test.exclusions=utest/**
50+
-Dsonar.tests=utest/
51+
-Dsonar.verbose=true
4252
env:
4353
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
4454
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/pylint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
python-version: ["3.8", "3.9", "3.10"]
10+
python-version: ["3.10"]
1111
steps:
1212
- uses: actions/checkout@v2
1313
- name: Set up Python ${{ matrix.python-version }}
@@ -20,4 +20,4 @@ jobs:
2020
pip install pylint
2121
- name: Analysing the code with pylint
2222
run: |
23-
pylint src # $(git ls-files '*.py')
23+
pylint --max-line-length 120 --ignore lib/robot src # $(git ls-files '*.py')

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ indent-after-paren=4
388388
indent-string=' '
389389

390390
# Maximum number of characters on a single line.
391-
max-line-length=100
391+
max-line-length=120
392392

393393
# Maximum number of lines in a module.
394394
max-module-lines=1000

tasks.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,8 @@ def tags_test(ctx):
358358
pass
359359

360360
@task
361-
def test_ci(ctx, test_filter=''):
362-
"""Run unit tests and coverage"""
361+
def sonar(ctx, test_filter=''):
362+
"""Run unit tests and coverage and send to SonarCloud"""
363363

364364
_set_development_path()
365365

@@ -378,6 +378,25 @@ def test_ci(ctx, test_filter=''):
378378
finally:
379379
pass
380380

381+
@task
382+
def test_ci(ctx, test_filter=''):
383+
"""Run unit tests and coverage"""
384+
385+
_set_development_path()
386+
387+
try:
388+
import subprocess
389+
c = subprocess.Popen(["coverage", "run" , "-m", "pytest", "--cov-config=.coveragerc", "-k test_", "-v", TEST_DIR])
390+
c.communicate('')
391+
r = subprocess.Popen(["coverage", "report"])
392+
r.communicate('')
393+
x = subprocess.Popen(["coverage", "xml"])
394+
x.communicate('')
395+
h = subprocess.Popen(["coverage", "html"])
396+
h.communicate('')
397+
finally:
398+
pass
399+
381400

382401
# Helper functions
383402

0 commit comments

Comments
 (0)