Skip to content

Develop #458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[run]
branch = True
relative_files = True
source = src/
omit =
.coveragerc
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/python-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Python CI Coverage

on:
push:
branches: [ "main", "develop", "feature/*" ]
pull_request:
branches: [ "main" ]

env:
LOG_LEVEL: INFO

jobs:

build:
name: "Run CI"
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python: ['3.12']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Setup Python
uses: actions/setup-python@master
with:
python-version: ${{ matrix.python }}

- name: Install
run: |
pip3 install -r requirements.txt

- name: Test an coverage collect
run: |
python3 -m coverage run -m pytest --verbose -o log_cli=true --log-cli-level=INFO src/

- name: Coverage Report
run: |
python3 -m coverage report

- name: Coverage lcov
run: |
python3 -m coverage lcov -o coverage/lcov.info

- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # required
verbose: true # optional (default = false)

- name: Coverage XML
run: |
python3 -m coverage xml

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
8 changes: 1 addition & 7 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Python
name: Python CI Tests

on:
push:
Expand Down Expand Up @@ -58,9 +58,3 @@ jobs:
- name: Coverage
run: |
coverage report

- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # required
verbose: true # optional (default = false)
12 changes: 0 additions & 12 deletions .sonarcloud.properties

This file was deleted.

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
![GitHub language count](https://img.shields.io/github/languages/count/sir-gon/algorithm-exercises-py)
![GitHub top language](https://img.shields.io/github/languages/top/sir-gon/algorithm-exercises-py)

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=sir-gon_algorithm-exercises-py&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=sir-gon_algorithm-exercises-py)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=sir-gon_algorithm-exercises-py&metric=coverage)](https://sonarcloud.io/summary/new_code?id=sir-gon_algorithm-exercises-py)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=sir-gon_algorithm-exercises-py&metric=bugs)](https://sonarcloud.io/summary/new_code?id=sir-gon_algorithm-exercises-py)
[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=sir-gon_algorithm-exercises-py&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=sir-gon_algorithm-exercises-py)
[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=sir-gon_algorithm-exercises-py&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=sir-gon_algorithm-exercises-py)

## What is this?

[Project Euler](https://algorithm-exercises.net/) provide some algorithms and
Expand Down
26 changes: 26 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
sonar.projectKey=sir-gon_algorithm-exercises-py
sonar.organization=sir-gon

# This is the name and version displayed in the SonarCloud UI.
#sonar.projectName=algorithm-exercises-py
#sonar.projectVersion=1.0


# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# sonar.sources=src
sonar.exclusions=**/*test.py,**/__init__.py

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8

sonar.python.version=3.12

# Coverage
sonar.python.coverage.reportPaths=coverage.xml

# Ignore
sonar.issue.ignore.multicriteria=e1

# python:S6792 Use the "type" parameter syntax to declare this generic class.
sonar.issue.ignore.multicriteria.e1.ruleKey=python:S6792
sonar.issue.ignore.multicriteria.e1.resourceKey=**/*.py
3 changes: 3 additions & 0 deletions src/projecteuler/lib/binary_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
T = TypeVar("T")


# Recommended way to define Generics in python >= 3.12:
# https://peps.python.org/pep-0695/
# https://docs.python.org/3.12/whatsnew/3.12.html#pep-695-type-parameter-syntax
class BinaryNode(Generic[T]):
def __init__(
self,
Expand Down
Loading