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

feat: add linting #1

Merged
merged 2 commits into from
Oct 26, 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
23 changes: 23 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Lint

on:
push: {}

concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
linting:
runs-on: ubuntu-latest
steps:
- name: Checkout Code Repository
uses: actions/checkout@v4

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

- name: Run pre-commit
uses: pre-commit/[email protected]
33 changes: 33 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
default_stages: [pre-commit]

default_language_version:
python: python3.12

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-json
- id: check-toml
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: check-builtin-literals
- id: check-case-conflict
- id: check-docstring-first
- id: detect-private-key

- repo: https://github.com/pycontribs/mirrors-prettier
rev: v3.3.3
hooks:
- id: prettier
args: ['--tab-width', '2', '--single-quote']
exclude: '\.(js|jsx|ts|tsx|scss|css|html)$'

- repo: https://github.com/Riverside-Healthcare/djLint
rev: v1.35.1
hooks:
- id: djlint-reformat-django
- id: djlint-django
28 changes: 16 additions & 12 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ Django Allauth templates with basic DaisyUI styling. You can find a list of avai

1. Copy the contents of the templates directory into your templates folder.
2. If not done already, register the templates in your settings.py, e.g., with:
```
TEMPLATES = [
{
"DIRS": [
str(APPS_DIR / "templates"),
],
"APP_DIRS": True,
...
},
]
```
3. Make sure to adjust the entry template `base.html` in `templates/allauth/layouts/entrance.html` and `templates/allauth/layouts/manage.html`
```
TEMPLATES = [
{
"DIRS": [
str(APPS_DIR / "templates"),
],
"APP_DIRS": True,
...
},
]
```
3. Make sure to adjust the entry template `base.html` in `templates/allauth/layouts/entrance.html` and `templates/allauth/layouts/manage.html`

## Development

This project uses `pre-commit`. Make sure to have it installed, e.g., in your python environment, to pass all checks.
16 changes: 16 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# ==== djLint ====
[tool.djlint]
blank_line_after_tag = "load,extends"
close_void_tags = true
format_css = true
format_js = true
ignore = "H006,H030,H031"
include = "H017,H035"
indent = 2
profile = "django"

[tool.djlint.css]
indent_size = 2

[tool.djlint.js]
indent_size = 2