mirror of
https://github.com/gmbrax/Pilgrim.git
synced 2026-11-10 07:10:17 +00:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
765ebf943d | ||
|
|
8f36e5a770 | ||
|
|
11e9cf6e75 |
@@ -0,0 +1,24 @@
|
|||||||
|
name: Pylint
|
||||||
|
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
python-version: ["3.10"]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v3
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||||
|
pip install pylint
|
||||||
|
- name: Analysing the code with pylint
|
||||||
|
run: |
|
||||||
|
pylint --disable=C0114,C0115,C0116 --exit-zero $(git ls-files '*.py')
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
name: Pylint and SonarCloud
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ main, master, staging ]
|
|
||||||
pull_request:
|
|
||||||
branches: [ main, master, staging ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
python-version: ["3.10"]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0 # Necessário para SonarCloud
|
|
||||||
|
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: ${{ matrix.python-version }}
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
||||||
pip install pylint ruff coverage pytest
|
|
||||||
|
|
||||||
- name: Analysing the code with pylint (console output)
|
|
||||||
run: |
|
|
||||||
pylint --disable=C0114,C0115,C0116 --exit-zero $(git ls-files '*.py') || true
|
|
||||||
|
|
||||||
- name: Generate Pylint report for SonarCloud
|
|
||||||
run: |
|
|
||||||
pylint --disable=C0114,C0115,C0116 --output-format=json --exit-zero $(git ls-files '*.py') > pylint-report.json || true
|
|
||||||
|
|
||||||
- name: Run Ruff
|
|
||||||
run: |
|
|
||||||
ruff check --output-format=json . > ruff-report.json || true
|
|
||||||
|
|
||||||
- name: Run tests with coverage (if you have tests)
|
|
||||||
run: |
|
|
||||||
if [ -d "tests" ] || [ -f "test_*.py" ] || [ -f "*_test.py" ]; then
|
|
||||||
coverage run -m pytest || true
|
|
||||||
coverage xml || true
|
|
||||||
else
|
|
||||||
echo "No tests found, skipping coverage"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: SonarCloud Scan
|
|
||||||
uses: SonarSource/sonarqube-scan-action@v5.0.0
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
||||||
with:
|
|
||||||
args: >
|
|
||||||
-Dsonar.projectKey=gmbrax_Pilgrim
|
|
||||||
-Dsonar.organization=gmbrax
|
|
||||||
-Dsonar.python.pylint.reportPaths=pylint-report.json
|
|
||||||
-Dsonar.python.ruff.reportPaths=ruff-report.json
|
|
||||||
-Dsonar.python.coverage.reportPaths=coverage.xml
|
|
||||||
+9
-4
@@ -2,8 +2,9 @@
|
|||||||
requires = ["hatchling"]
|
requires = ["hatchling"]
|
||||||
build-backend = "hatchling.build"
|
build-backend = "hatchling.build"
|
||||||
|
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "pilgrim"
|
name = "Pilgrim"
|
||||||
version = "0.0.4"
|
version = "0.0.4"
|
||||||
authors = [
|
authors = [
|
||||||
{ name="Gustavo Henrique Santos Souza de Miranda", email="gustavohssmiranda@gmail.com" }
|
{ name="Gustavo Henrique Santos Souza de Miranda", email="gustavohssmiranda@gmail.com" }
|
||||||
@@ -21,11 +22,15 @@ dependencies = [
|
|||||||
"textual",
|
"textual",
|
||||||
"tomli",
|
"tomli",
|
||||||
"tomli_w"
|
"tomli_w"
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
|
]
|
||||||
|
[template.plugins.default]
|
||||||
|
src-layout = true
|
||||||
[project.urls]
|
[project.urls]
|
||||||
Homepage = "https://github.com/gmbrax/Pilgrim/"
|
Homepage = "https://github.com/gmbrax/Pilgrim/"
|
||||||
Issues = "https://github.com/gmbrax/Pilgrim/issues"
|
Issues = "https://github.com/gmbrax/Pilgrim/issues"
|
||||||
|
[tool.hatch.build.targets.wheel]
|
||||||
|
packages = ["src/pilgrim"]
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
pilgrim = "pilgrim.command:main"
|
pilgrim = "pilgrim:main"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
from sqlalchemy import create_engine
|
from sqlalchemy import create_engine
|
||||||
from sqlalchemy.orm import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
from sqlalchemy.orm import sessionmaker
|
from sqlalchemy.orm import sessionmaker
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import os
|
import os
|
||||||
|
|||||||
@@ -4,16 +4,15 @@ from pilgrim.models.photo_in_entry import photo_entry_association
|
|||||||
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime
|
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime
|
||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
|
|
||||||
from pilgrim.database import Base
|
from ..database import Base
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Entry(Base):
|
class Entry(Base):
|
||||||
__tablename__ = "entries"
|
__tablename__ = "entries"
|
||||||
id = Column(Integer, primary_key=True)
|
id = Column(Integer, primary_key=True)
|
||||||
title = Column(String,nullable=False)
|
title = Column(String)
|
||||||
text = Column(String)
|
text = Column(String)
|
||||||
date = Column(DateTime,nullable=False)
|
date = Column(DateTime)
|
||||||
photos = relationship(
|
photos = relationship(
|
||||||
"Photo",
|
"Photo",
|
||||||
secondary=photo_entry_association,
|
secondary=photo_entry_association,
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ from sqlalchemy.orm import relationship
|
|||||||
from sqlalchemy.sql.schema import Index
|
from sqlalchemy.sql.schema import Index
|
||||||
|
|
||||||
from pilgrim.models.photo_in_entry import photo_entry_association
|
from pilgrim.models.photo_in_entry import photo_entry_association
|
||||||
from pilgrim.database import Base
|
from ..database import Base
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Photo(Base):
|
class Photo(Base):
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from sqlalchemy import Table, Column, Integer, ForeignKey
|
from sqlalchemy import Table, Column, Integer, ForeignKey
|
||||||
|
|
||||||
from pilgrim.database import Base
|
from ..database import Base
|
||||||
|
|
||||||
photo_entry_association = Table('photo_entry_association', Base.metadata,
|
photo_entry_association = Table('photo_entry_association', Base.metadata,
|
||||||
Column('id', Integer, primary_key=True, autoincrement=True),
|
Column('id', Integer, primary_key=True, autoincrement=True),
|
||||||
|
|||||||
@@ -3,11 +3,10 @@ from typing import Any
|
|||||||
from sqlalchemy import Column, Integer, String, UniqueConstraint
|
from sqlalchemy import Column, Integer, String, UniqueConstraint
|
||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
|
|
||||||
from pilgrim.database import Base
|
from .. import database
|
||||||
|
|
||||||
|
|
||||||
|
class TravelDiary(database.Base):
|
||||||
class TravelDiary(Base):
|
|
||||||
__tablename__ = "travel_diaries"
|
__tablename__ = "travel_diaries"
|
||||||
id = Column(Integer, primary_key=True)
|
id = Column(Integer, primary_key=True)
|
||||||
name = Column(String, nullable=False)
|
name = Column(String, nullable=False)
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from pilgrim.models.entry import Entry
|
from ..models.entry import Entry
|
||||||
from pilgrim.models.travel_diary import TravelDiary
|
from ..models.travel_diary import TravelDiary
|
||||||
from pilgrim.models.photo import Photo # ✨ Importe o modelo Photo
|
from ..models.photo import Photo # ✨ Importe o modelo Photo
|
||||||
|
|
||||||
|
|
||||||
class EntryService:
|
class EntryService:
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from pathlib import Path
|
|||||||
from pilgrim.utils import DirectoryManager
|
from pilgrim.utils import DirectoryManager
|
||||||
from sqlalchemy.exc import IntegrityError
|
from sqlalchemy.exc import IntegrityError
|
||||||
|
|
||||||
from pilgrim.models.travel_diary import TravelDiary
|
from ..models.travel_diary import TravelDiary
|
||||||
|
|
||||||
|
|
||||||
class TravelDiaryService:
|
class TravelDiaryService:
|
||||||
|
|||||||
Reference in New Issue
Block a user