Skip to content

Commit

Permalink
[IT-3396] Use a better jinja linter (Sage-Bionetworks-IT#1111)
Browse files Browse the repository at this point in the history
* Replace existing jinja linter with aristanetworks/j2lint[1] linter
* fix linter warnings/errors

[1] https://github.com/aristanetworks/j2lint
  • Loading branch information
zaro0508 authored Apr 2, 2024
1 parent f959ab7 commit 3855535
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 23 deletions.
15 changes: 0 additions & 15 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,6 @@ jobs:
with:
python-version: 3.9
- uses: pre-commit/[email protected]
jinja-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install jinja libraries
run: |
python -m pip install --upgrade jinja2==3.0.1
- name: Install jinja linter tool
run: git clone --single-branch https://github.com/drm/jinja2-lint.git /tmp/jinja2-lint && pushd /tmp/jinja2-lint && git checkout 75dcd5a
- name: Execute jinja linter
run: find . -type f -name "*.j2" -exec /tmp/jinja2-lint/j2lint.py '{}' +
test-npm-deps: # Useful for testing version updates
runs-on: ubuntu-latest
steps:
Expand Down
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ repos:
hooks:
- id: check-github-workflows
- id: check-github-actions
- repo: https://github.com/aristanetworks/j2lint.git
rev: v1.1.0
hooks:
- id: j2lint
args: [--ignore, S3, V1, --]
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Resources:
Name: !Ref ProductName
Description: This product provides an RStudio or Jupyter notebook, running on an EC2 instance.
ProvisioningArtifactParameters:
{{ sceptre_user_data.ProvisioningArtifactParameters|indent(8) }}
{{ sceptre_user_data.ProvisioningArtifactParameters | indent(8) }}
'Fn::Transform':
Name: 'AWS::Include'
Parameters:
Expand Down
2 changes: 1 addition & 1 deletion sceptre/scipool/templates/sc-product-ec2-linux-docker.j2
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Resources:
Name: !Ref ProductName
Description: "This product builds one Amazon Linux EC2 instance"
ProvisioningArtifactParameters:
{{ sceptre_user_data.ProvisioningArtifactParameters|indent(8) }}
{{ sceptre_user_data.ProvisioningArtifactParameters | indent(8) }}
'Fn::Transform':
Name: 'AWS::Include'
Parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Resources:
Description: This product builds one Linux EC2 instance using an Ubuntu AMI
with workflows software installed. Maintained by Sage Bionetworks.
ProvisioningArtifactParameters:
{{ sceptre_user_data.ProvisioningArtifactParameters|indent(8) }}
{{ sceptre_user_data.ProvisioningArtifactParameters | indent(8) }}
'Fn::Transform':
Name: 'AWS::Include'
Parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Resources:
Name: !Ref ProductName
Description: "This product builds one Linux EC2 instance, either Amazon Linux or Ubuntu"
ProvisioningArtifactParameters:
{{ sceptre_user_data.ProvisioningArtifactParameters|indent(8) }}
{{ sceptre_user_data.ProvisioningArtifactParameters | indent(8) }}
'Fn::Transform':
Name: 'AWS::Include'
Parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Resources:
Description: This product builds one Microsoft Windows EC2 instance with
Jumpcloud integration.
ProvisioningArtifactParameters:
{{ sceptre_user_data.ProvisioningArtifactParameters|indent(8) }}
{{ sceptre_user_data.ProvisioningArtifactParameters | indent(8) }}
'Fn::Transform':
Name: 'AWS::Include'
Parameters:
Expand Down
2 changes: 1 addition & 1 deletion sceptre/scipool/templates/sc-product-s3-private-enc.j2
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Resources:
Description: This product builds an AWS S3 bucket encrypted with private
access accessible from any source.
ProvisioningArtifactParameters:
{{ sceptre_user_data.ProvisioningArtifactParameters|indent(8) }}
{{ sceptre_user_data.ProvisioningArtifactParameters | indent(8) }}
'Fn::Transform':
Name: 'AWS::Include'
Parameters:
Expand Down
2 changes: 1 addition & 1 deletion sceptre/scipool/templates/sc-product-s3-synapse.j2
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Resources:
Description: This product builds an AWS S3 bucket with private access
for Synapse.
ProvisioningArtifactParameters:
{{ sceptre_user_data.ProvisioningArtifactParameters|indent(8) }}
{{ sceptre_user_data.ProvisioningArtifactParameters | indent(8) }}
'Fn::Transform':
Name: 'AWS::Include'
Parameters:
Expand Down
2 changes: 1 addition & 1 deletion sceptre/scipool/templates/sc-product-scheduled-jobs.j2
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Resources:
Name: !Ref ProductName
Description: "This product provisions AWS batch to execute scheduled jobs"
ProvisioningArtifactParameters:
{{ sceptre_user_data.ProvisioningArtifactParameters|indent(8) }}
{{ sceptre_user_data.ProvisioningArtifactParameters | indent(8) }}
'Fn::Transform':
Name: 'AWS::Include'
Parameters:
Expand Down

0 comments on commit 3855535

Please sign in to comment.