Skip to content
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

Cicd/lint actions #37

Merged
merged 8 commits into from
Oct 9, 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
24 changes: 24 additions & 0 deletions .github/not_enough_pylint_score.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
_**Out of all the ways to write clean code, you really went and chose not to. Impressive choice!**_

## :warning: Pylint Check Failed :warning:

### Pylint Score: **{{pylint_score}}**

#### Minimum required score: **9.5**

It looks like your recent code changes did not meet the required Pylint score of **9.5**. Please review the Pylint output and make the necessary adjustments to improve code quality.

#### What you can do:
- **Review the Pylint report** to identify areas of your code that need improvement.
- **Refactor** sections that are lowering your score, focusing on issues like code complexity, formatting, or coding standards.
- Once changes are made, **push** your updates to the same pull request to trigger another check.

Remember, maintaining a high Pylint score helps ensure code readability, maintainability, and consistency across the project.

You can find our project's Pylint configuration in the [`.pylintrc`](../.pylintrc) file.

Feel free to reach out if you need help with any specific issue!

---

This automated message was triggered by a failed Pylint check.
Empty file removed .github/workflows/.keep
Empty file.
41 changes: 41 additions & 0 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Pylint Check

on:
pull_request:
branches:
- dev
- main
workflow_dispatch:

jobs:
pylint:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Install pylint
run: pip install pylint

- name: Run pylint
env:
GH_TOKEN: ${{ github.token }}
run: |
pylint_score=$(pylint src/ | grep 'Your code has been rated at' | awk '{print $7}' | cut -d '/' -f 1)
if (( $(echo "$pylint_score < 9.5" | bc -l) )); then
echo "Pylint score is too low: $pylint_score. Minimum required: 9.5"

cat .github/not_enough_pylint_score.md

gh pr comment \
${{ github.event.pull_request.number }} \
--body "$(cat .github/not_enough_pylint_score.md)"
exit 1
else
echo "Pylint score is $pylint_score. Passed!"
fi
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,4 @@ env/
.DS_Store
Thumbs.db

.pylintrc
output/
output/
46 changes: 46 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[MASTER]
# Añade directorios a la lista de Python Path, separados por comas.
init-hook='import sys; sys.path.append("YOUR PATH")'

[BASIC]
good-names=Hermes

[MESSAGES CONTROL]
disable=
too-many-locals,
too-many-arguments,
too-few-public-methods,
missing-module-docstring,
; missing-class-docstring,
; missing-function-docstring,
unspecified-encoding,
anomalous-backslash-in-string

[FORMAT]
max-line-length=88
indent-string=' '
ignore-long-lines=^(\s*#.*|\s*print\(.*|\s*https?:\/\/[^\s]+|\s*def .+\(.*\):|\s*if .+:)$

[DESIGN]
max-args=5
max-locals=15
max-returns=6
max-branches=12
max-statements=50
max-parents=7
max-attributes=7

[TYPECHECK]
ignored-modules=flask_sqlalchemy,sqlalchemy,sqlalchemy.orm,flask_marshmallow,marshmallow

[REPORTS]
reports=no

[LOGGING]
disable=logging-format-interpolation,logging-not-lazy

[IMPORTS]
disable=import-error,ungrouped-imports

[SIMILARITIES]
min-similarity-lines=4
115 changes: 114 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ pandas = "^2.2.3"
psycopg = "^3.2.3"
psycopg-pool = "^3.2.3"

[tool.poetry.group.dev.dependencies]
pylint = "^3.3.1"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
Loading