diff --git a/.gitignore b/.gitignore index 4e1a30c..5f48e9b 100644 --- a/.gitignore +++ b/.gitignore @@ -29,12 +29,13 @@ tags *.egg-info # Unittest and coverage -htmlcov/* .coverage +.pytest_cache/ .tox -junit.xml coverage.xml -.pytest_cache/ +htmlcov/* +junit.xml +pytest-report.xml # Build folder/files build/* diff --git a/.travis.yml b/.travis.yml index 49c448e..7563cdd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,8 @@ python: cache: directories: - - $HOME/.cache/pip + - "$HOME/.cache/pip" + - "$HOME/.sonar/cache" install: - pip install -r requirements.txt @@ -24,5 +25,14 @@ script: - make uninstall - make clean +# +# SonarCloud Project Setup will be using automatic scanning +# +# addons: +# sonarcloud: +# organization: "tpiekarski-github" +# token: +# secure: "D9b/Hu1byz0lj2J2mJUYFjoUWuUS7b3AG2cJZyDQfm+FYXtYnEWH1pS8V5Oea/9TXQSAfTR/ZAPzB64UqbzrIb+Yt4cl7LalGlNyzYVyuBMqJlIkeKyT/r4S4HDeiIFWMbuExfFSZDtR4E7+2i5709vOaduvlnMymAv/ACnpAJN/3DsVbz0KQcBqKDrkiZa8jMLDvXxH5/fy240f3fSN/RjhFrd7dgxCssyxg9D+bDLKj8m7KWPZZc/Mg3jncwxlSJB3ta/z8L29inbHHKfww4orC3FIEUp8EVa8ov3QVHoJ+wrS1VS7okJBavztuRwBtp+XnjEgzuu/Uu2DnTYdPYac+CDxu+XMA26EhOzhSm/NmL4y0GQGJAJ02rJe1Ay6sEb9MUelEBvBJnRpODoToQOdJ2ypYmiCoAYAXvnDhhepgfnXVSw5wrLgZN8lmzGUrH7QKPTEb/OMgSV4P5BemMEUf4U6bsc5Xy41pmpqmNNXWlVBhfBKR08rk85az+8aPeGwqIAzQQAOg67BkOA+3q4WlSKCP/XbDj/05Cx5AXgLrKoPdnqVUodc4jitGB1zE2yvpWBp69j/WDP6QPgnt3FSkAzrQkUH5/vNEqR5fl/Xuq3WY4Rcma7t3PyBm2Z5XqHaYbgwlPMeyKsdy8mduXAxWeUoCQ5I7IWZV8Xu8vo=" + notifications: email: false diff --git a/Makefile b/Makefile index b7bac11..132f3a4 100644 --- a/Makefile +++ b/Makefile @@ -63,6 +63,10 @@ run: $(info Testing if derl runs with $(TEST_DIRECTORY) (use args="" to pass arguments)) derl $(TEST_DIRECTORY) $(args) +sonar: + $(info Running Sonar Scanner) + sonar-scanner -Dsonar.login=${SONAR_KEY} + test: $(info Running functional and unit tests) python setup.py test diff --git a/README.md b/README.md index aaf9993..a941462 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # derl [![Build Status](https://travis-ci.org/tpiekarski/derl.svg?branch=master)](https://travis-ci.org/tpiekarski/derl) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=tpiekarski_derl&metric=alert_status)](https://sonarcloud.io/dashboard?id=tpiekarski_derl) [Overview](#overview) / [Features](#features) / [Install](#install) / [Run](#run) / [Usage](#usage) / [Development](#development) / [Structures](#structures) / [References](#references) diff --git a/derl.code-workspace b/derl.code-workspace index 8a4156a..dff687a 100644 --- a/derl.code-workspace +++ b/derl.code-workspace @@ -6,28 +6,29 @@ ], "settings": { "cSpell.words": [ + "DISTRIB", + "Findwork", + "Programiz", + "Pylint", + "Quickstart", + "Regexes", + "Twilio", + "Youtube", "argparse", "cheatsheet", "conda", "coveragerc", "datefmt", - "DISTRIB", - "Findwork", "loglevel", "miniconda", "outputer", "pathlib", - "Programiz", - "Pylint", "pyscaffold", "pytest", - "Quickstart", "rcompile", - "Regexes", "repr", - "Twilio", - "virtualenv", - "Youtube" + "sonarcloud", + "virtualenv" ], "python.pythonPath": "/usr/bin/python3" } diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..fe55d2e --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +junit_family=xunit2 diff --git a/setup.cfg b/setup.cfg index c7e3faa..d416fbc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -66,6 +66,7 @@ extras = True addopts = --cov derl --cov-report term-missing --verbose + --junitxml=pytest-report.xml norecursedirs = dist build diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..46c0fd5 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,18 @@ +# SonarCloud +# --- +# https://sonarcloud.io/documentation/analysis/analysis-parameters/ +# + +sonar.host.url=https://sonarcloud.io/ +sonar.language=py +sonar.links.ci=https://travis-ci.org/tpiekarski/derl +sonar.links.homepage=https://github.com/tpiekarski/derl +sonar.links.issue=https://github.com/tpiekarski/derl/issues +sonar.links.scm=https://github.com/tpiekarski/derl +sonar.organization=tpiekarski-github +sonar.projectKey=tpiekarski_derl +sonar.projectName=derl +sonar.python.xunit.reportPath=pytest-report.xml +sonar.sourceEncoding=UTF-8 +sonar.sources=src/derl +sonar.tests=tests