Skip to content

Commit

Permalink
Merge pull request #15 from AlessandroMiola/add_pre_commit
Browse files Browse the repository at this point in the history
feat: add pre-commit
  • Loading branch information
AlessandroMiola authored Feb 9, 2024
2 parents 9dae344 + 10ef76e commit a956bd0
Show file tree
Hide file tree
Showing 10 changed files with 145 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ __pycache__
.vscode/
db-data/
geckodriver.log
.ruff_cache
.ruff_cache
23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
default_language_version:
python: python3.10

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- repo: local
hooks:
- id: ruff
name: ruff (linter)
entry: just ruff-fix
language: system
types: [python]
- id: black
name: black
entry: just black
language: system
types: [python]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
WIP
WIP
6 changes: 6 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ install:
@echo "🚀 Installing dependencies"
@poetry install --with dev

install-pre-commit:
@echo "🚀 Setting up the hooks"
@poetry run pre-commit install

check-project:
@echo "🚀 Checking consistency between poetry.lock and pyproject.toml"
@poetry check --lock
@echo "🚀 Running the hooks against all files"
@poetry run pre-commit run --all-files

ruff:
@echo "🚀 Linting the project with Ruff"
Expand Down
106 changes: 105 additions & 1 deletion poetry.lock

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

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dash = "^2.14.1"
bandit = "^1.7.5"
black = "^24.1.1"
ruff = "^0.2.0"
pre-commit = "^3.6.0"

[build-system]
requires = ["poetry-core"]
Expand Down
2 changes: 1 addition & 1 deletion src/alembic/README
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Generic single-database configuration.
Generic single-database configuration.
2 changes: 1 addition & 1 deletion src/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ services:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- "./db-data/:/var/lib/postgresql/data/"
- "./db-data/:/var/lib/postgresql/data/"
2 changes: 1 addition & 1 deletion src/static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ label {

.hidden {
display: none;
}
}
10 changes: 5 additions & 5 deletions src/templates/flight-details/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ <h1 class="display-4">Flights Scraper ✈︎</h1>
</div>

<div class="row mt-3 mb-3">
<div>
<div>
<input required type="text" placeholder="from" name="departure_location">
<input required type="text" placeholder="to" name="arrival_location">
</div>
</div>

<div class="row mt-3 mb-3">
<div>
<div>
<input required class="date-inputs" type="date" name="departure_date" id="dep-date"/>
</div>
</div>
Expand All @@ -63,7 +63,7 @@ <h1 class="display-4">Flights Scraper ✈︎</h1>
const form1 = document.querySelector("input[name='departure_location_comeback']");
const form2 = document.querySelector("input[name='arrival_location_comeback']");
const form3 = document.querySelector("input[name='departure_date_comeback']");

document.querySelector('#twoway-trip').addEventListener('change', (event) => {
if (event.target.checked){
form1.classList.remove("hidden");
Expand Down Expand Up @@ -130,5 +130,5 @@ <h1 class="display-4">Flights Scraper ✈︎</h1>
{% endblock %}

</div>
{% endblock %}

{% endblock %}

0 comments on commit a956bd0

Please sign in to comment.