Skip to content

Commit

Permalink
add code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ljmerza committed Jan 16, 2024
1 parent 3d33d3b commit b9005ce
Show file tree
Hide file tree
Showing 4 changed files with 314 additions and 6 deletions.
25 changes: 20 additions & 5 deletions .github/workflows/sonar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,36 @@ on:
branches:
- master


jobs:
build:
name: Build
name: Test SonarQube
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install coverage
- name: Run tests with coverage
run: |
coverage run --source=index -m unittest discover
coverage xml
- uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
# If you wish to fail your job when the Quality Gate is red, uncomment the
# following lines. This would typically be used to fail a deployment.

# Uncomment to fail the job when the Quality Gate is red
# - uses: sonarsource/sonarqube-quality-gate-action@master
# timeout-minutes: 5
# env:
Expand Down
292 changes: 292 additions & 0 deletions coverage.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,292 @@
<?xml version="1.0" ?>
<coverage version="7.4.0" timestamp="1705429117290" lines-valid="273" lines-covered="172" line-rate="0.63" branches-valid="80" branches-covered="44" branch-rate="0.55" complexity="0">
<!-- Generated by coverage.py: https://coverage.readthedocs.io/en/7.4.0 -->
<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
<sources>
<source></source>
</sources>
<packages>
<package name="." line-rate="0.63" branch-rate="0.55" complexity="0">
<classes>
<class name="index.py" filename="index.py" complexity="0" line-rate="0.63" branch-rate="0.55">
<methods/>
<lines>
<line number="3" hits="1"/>
<line number="5" hits="1"/>
<line number="6" hits="1"/>
<line number="7" hits="1"/>
<line number="8" hits="1"/>
<line number="10" hits="1"/>
<line number="11" hits="1"/>
<line number="12" hits="1"/>
<line number="13" hits="1"/>
<line number="14" hits="1"/>
<line number="16" hits="1"/>
<line number="17" hits="1"/>
<line number="19" hits="1"/>
<line number="20" hits="1"/>
<line number="21" hits="1"/>
<line number="22" hits="1"/>
<line number="24" hits="1"/>
<line number="26" hits="1"/>
<line number="27" hits="1"/>
<line number="28" hits="1"/>
<line number="29" hits="1"/>
<line number="31" hits="1"/>
<line number="33" hits="1"/>
<line number="34" hits="1"/>
<line number="37" hits="1"/>
<line number="38" hits="0"/>
<line number="39" hits="0"/>
<line number="41" hits="1"/>
<line number="42" hits="0" branch="true" condition-coverage="0% (0/2)" missing-branches="43,52"/>
<line number="43" hits="0"/>
<line number="44" hits="0"/>
<line number="45" hits="0"/>
<line number="46" hits="0"/>
<line number="47" hits="0"/>
<line number="48" hits="0"/>
<line number="49" hits="0"/>
<line number="50" hits="0"/>
<line number="52" hits="0"/>
<line number="54" hits="1"/>
<line number="55" hits="1"/>
<line number="56" hits="1"/>
<line number="57" hits="1"/>
<line number="60" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="61" hits="1"/>
<line number="64" hits="1"/>
<line number="65" hits="1"/>
<line number="66" hits="1"/>
<line number="69" hits="1"/>
<line number="72" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="75"/>
<line number="73" hits="1"/>
<line number="75" hits="0"/>
<line number="77" hits="1"/>
<line number="78" hits="0"/>
<line number="80" hits="0"/>
<line number="84" hits="0"/>
<line number="85" hits="0"/>
<line number="87" hits="0" branch="true" condition-coverage="0% (0/2)" missing-branches="88,91"/>
<line number="88" hits="0"/>
<line number="89" hits="0"/>
<line number="91" hits="0" branch="true" condition-coverage="0% (0/2)" missing-branches="92,95"/>
<line number="92" hits="0"/>
<line number="93" hits="0"/>
<line number="95" hits="0"/>
<line number="96" hits="0"/>
<line number="98" hits="0"/>
<line number="100" hits="1"/>
<line number="101" hits="0"/>
<line number="102" hits="0"/>
<line number="104" hits="0"/>
<line number="111" hits="0"/>
<line number="112" hits="0"/>
<line number="114" hits="0" branch="true" condition-coverage="0% (0/2)" missing-branches="115,118"/>
<line number="115" hits="0"/>
<line number="116" hits="0"/>
<line number="118" hits="0" branch="true" condition-coverage="0% (0/2)" missing-branches="119,122"/>
<line number="119" hits="0"/>
<line number="120" hits="0"/>
<line number="122" hits="0"/>
<line number="123" hits="0"/>
<line number="125" hits="0"/>
<line number="127" hits="1"/>
<line number="128" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="129"/>
<line number="129" hits="0"/>
<line number="131" hits="1"/>
<line number="139" hits="1"/>
<line number="141" hits="1"/>
<line number="142" hits="1"/>
<line number="143" hits="1"/>
<line number="145" hits="1"/>
<line number="147" hits="1"/>
<line number="148" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="150" hits="1"/>
<line number="151" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="152" hits="1"/>
<line number="153" hits="1"/>
<line number="155" hits="1"/>
<line number="156" hits="1"/>
<line number="157" hits="1"/>
<line number="160" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="174"/>
<line number="161" hits="1"/>
<line number="167" hits="1"/>
<line number="168" hits="1"/>
<line number="170" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="174"/>
<line number="171" hits="1"/>
<line number="174" hits="1"/>
<line number="175" hits="1"/>
<line number="176" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="179"/>
<line number="177" hits="1"/>
<line number="179" hits="1"/>
<line number="180" hits="1"/>
<line number="181" hits="1"/>
<line number="183" hits="1"/>
<line number="185" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="186" hits="1"/>
<line number="187" hits="1"/>
<line number="188" hits="1"/>
<line number="189" hits="1"/>
<line number="191" hits="1"/>
<line number="193" hits="1"/>
<line number="194" hits="1"/>
<line number="196" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="197" hits="1"/>
<line number="200" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="201" hits="1"/>
<line number="202" hits="1"/>
<line number="205" hits="1"/>
<line number="206" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="207" hits="1"/>
<line number="208" hits="1"/>
<line number="211" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="212" hits="1"/>
<line number="213" hits="1"/>
<line number="214" hits="1"/>
<line number="216" hits="1"/>
<line number="217" hits="1"/>
<line number="218" hits="1"/>
<line number="219" hits="1"/>
<line number="222" hits="1"/>
<line number="225" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="226" hits="1"/>
<line number="227" hits="1"/>
<line number="229" hits="1"/>
<line number="231" hits="1"/>
<line number="232" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="233" hits="1"/>
<line number="234" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="235" hits="1"/>
<line number="237" hits="1"/>
<line number="239" hits="1"/>
<line number="241" hits="1"/>
<line number="242" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="243" hits="1"/>
<line number="244" hits="1"/>
<line number="247" hits="1"/>
<line number="248" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="249" hits="1"/>
<line number="250" hits="1"/>
<line number="252" hits="1"/>
<line number="254" hits="1"/>
<line number="256" hits="1"/>
<line number="257" hits="1"/>
<line number="258" hits="1"/>
<line number="259" hits="1"/>
<line number="260" hits="1"/>
<line number="262" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="263" hits="1"/>
<line number="264" hits="1"/>
<line number="266" hits="1"/>
<line number="268" hits="1"/>
<line number="270" hits="1"/>
<line number="271" hits="1"/>
<line number="273" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="275"/>
<line number="274" hits="1"/>
<line number="275" hits="0" branch="true" condition-coverage="0% (0/2)" missing-branches="276,278"/>
<line number="276" hits="0"/>
<line number="278" hits="0"/>
<line number="279" hits="0"/>
<line number="282" hits="1"/>
<line number="283" hits="1"/>
<line number="285" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="286" hits="1"/>
<line number="294" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="295" hits="1"/>
<line number="296" hits="1"/>
<line number="298" hits="1"/>
<line number="300" hits="1"/>
<line number="301" hits="1"/>
<line number="302" hits="1"/>
<line number="304" hits="1"/>
<line number="306" hits="1"/>
<line number="310" hits="1"/>
<line number="311" hits="1"/>
<line number="313" hits="1"/>
<line number="314" hits="0" branch="true" condition-coverage="0% (0/2)" missing-branches="315,318"/>
<line number="315" hits="0"/>
<line number="318" hits="0"/>
<line number="319" hits="0"/>
<line number="321" hits="0"/>
<line number="322" hits="0"/>
<line number="324" hits="0" branch="true" condition-coverage="0% (0/2)" missing-branches="325,327"/>
<line number="325" hits="0"/>
<line number="327" hits="0"/>
<line number="328" hits="0"/>
<line number="330" hits="0" branch="true" condition-coverage="0% (0/2)" missing-branches="331,333"/>
<line number="331" hits="0"/>
<line number="333" hits="0"/>
<line number="334" hits="0" branch="true" condition-coverage="0% (0/2)" missing-branches="335,337"/>
<line number="335" hits="0"/>
<line number="337" hits="0"/>
<line number="338" hits="0" branch="true" condition-coverage="0% (0/2)" missing-branches="339,341"/>
<line number="339" hits="0"/>
<line number="341" hits="0"/>
<line number="343" hits="0"/>
<line number="344" hits="0" branch="true" condition-coverage="0% (0/2)" missing-branches="345,347"/>
<line number="345" hits="0"/>
<line number="347" hits="0"/>
<line number="348" hits="0"/>
<line number="350" hits="0"/>
<line number="351" hits="0"/>
<line number="353" hits="0"/>
<line number="356" hits="1"/>
<line number="357" hits="0"/>
<line number="358" hits="0"/>
<line number="359" hits="0"/>
<line number="369" hits="0"/>
<line number="370" hits="0"/>
<line number="372" hits="1"/>
<line number="374" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="375" hits="1"/>
<line number="377" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="exit"/>
<line number="378" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="exit"/>
<line number="379" hits="1"/>
<line number="381" hits="1"/>
<line number="383" hits="1"/>
<line number="384" hits="1"/>
<line number="385" hits="1"/>
<line number="388" hits="1"/>
<line number="389" hits="1"/>
<line number="390" hits="1"/>
<line number="391" hits="1"/>
<line number="394" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="399"/>
<line number="395" hits="1"/>
<line number="396" hits="1"/>
<line number="397" hits="1"/>
<line number="399" hits="1"/>
<line number="400" hits="1"/>
<line number="402" hits="1"/>
<line number="404" hits="0"/>
<line number="405" hits="0"/>
<line number="408" hits="0"/>
<line number="411" hits="0"/>
<line number="412" hits="0"/>
<line number="413" hits="0"/>
<line number="416" hits="0"/>
<line number="417" hits="0"/>
<line number="418" hits="0"/>
<line number="421" hits="0"/>
<line number="422" hits="0"/>
<line number="424" hits="1"/>
<line number="425" hits="0"/>
<line number="426" hits="0"/>
<line number="427" hits="0"/>
<line number="429" hits="0"/>
<line number="430" hits="0"/>
<line number="431" hits="0"/>
<line number="432" hits="0"/>
<line number="433" hits="0"/>
<line number="435" hits="0" branch="true" condition-coverage="0% (0/2)" missing-branches="436,438"/>
<line number="436" hits="0"/>
<line number="438" hits="0"/>
<line number="441" hits="0"/>
<line number="444" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="445"/>
<line number="445" hits="0"/>
</lines>
</class>
</classes>
</package>
</packages>
</coverage>
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
paho_mqtt==1.6.1
requests==2.31.0
PyYAML==6.0.1
Pillow==9.1.1
Pillow==9.1.1
1 change: 1 addition & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
sonar.projectKey=ljmerza_frigate_plate_recognizer_AY0TaejvJwHTSS6ZO76Q
sonar.python.coverage.reportPaths=coverage.xml

0 comments on commit b9005ce

Please sign in to comment.