Skip to content

Commit

Permalink
Merge pull request #726 from canonical/config_djlint
Browse files Browse the repository at this point in the history
  • Loading branch information
immortalcodes authored Jun 7, 2024
2 parents 647a073 + 8ea5ad7 commit 252b151
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .djlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"blank_line_after_tag": "load,extends",
"blank_line_before_tag": "load,extends,block, macro",
"close_void_tags": true,
"ignore": "J018,H006,H021,H023,H029,T002,T003,T028,D018",
"include": "H017",
"indent": "2",
"max_blank_lines": 1,
"max_line_length": "120",
"profile": "jinja",
"format_css": true,
"format_js": true,
"css": {
"indent_size": 2
},
"js": {
"indent_size": 2
}
}
28 changes: 28 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,31 @@ jobs:

- name: Lint JavaScript
run: yarn lint-js

lint-jinja:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4

- name: Install node dependencies
run: yarn install --immutable

- name: Install python dependencies
run: |
python3 -m pip install --upgrade pip
sudo pip3 install djlint
- name: Get changed HTML files in the templates folder
id: changed-files
uses: tj-actions/changed-files@v43
with:
files: templates/**

- name: Lint jinja
if: steps.changed-files.outputs.any_changed == 'true'
env:
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
echo "The following files have changed: $CHANGED_FILES"
djlint $CHANGED_FILES --lint
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ canonicalwebteam.templatefinder==1.0.0
canonicalwebteam.image-template==1.3.1
pyyaml==6.0
gunicorn[gevent]
djlint==1.34.1

0 comments on commit 252b151

Please sign in to comment.