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

Linting with djLint? #1372

Open
koeaw opened this issue Nov 12, 2024 · 0 comments
Open

Linting with djLint? #1372

koeaw opened this issue Nov 12, 2024 · 0 comments
Labels
assets Static files, components defining or contributing to appearance question For any kind of question, whether about usage, contributing or the project in general tooling Tools, workflows, integrations etc. relevant to project maintenance, deployment, collaboration

Comments

@koeaw
Copy link
Contributor

koeaw commented Nov 12, 2024

I was wondering if there is a reason why we don't use djLint to lint but only to format-check templates (see also #1371).

I added workflows for both formatter and linter to TBF because I found the linter's suggestions for changes to APIS Core reasonable/mostly helpful for cleaner code when I tested it. The only rule I've ignored for now is H006, see acdh-oeaw/apis-instance-tbf@7ed3811.

Output for APIS Core, based on latest main (e14c806):

Linting 68/68 files ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 00:00    


apis_core/apis_entities/templates/apis_core/apis_entities/e53_place_detail.html
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
T003 7:0 Endblock should have name. Ex: {% endblock body %}. {% endblock %}
T003 23:0 Endblock should have name. Ex: {% endblock body %}. {% endblock %}

apis_core/apis_relations/templates/apis_relations/_ajax_form.html
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
D018 2:2 (Django) Internal links should use the {% url ... %} pattern. <form action="
H033 2:2 Extra whitespace found in form action. <form action="
H033 2:2 Extra whitespace found in form action. <form action=" {% if

apis_core/apis_relations/templates/apis_relations/_ajax_form_generic.html
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
D018 2:2 (Django) Internal links should use the {% url ... %} pattern. <form action="
H033 2:2 Extra whitespace found in form action. <form action="
H033 2:2 Extra whitespace found in form action. <form action=" {% if

apis_core/apis_relations/templates/apis_relations/edit_button_generic_ajax_form.html
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
H025 8:0 Tag seems to be an orphan. </a>

apis_core/apis_relations/templates/apis_relations/relations_detail_generic.html
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
T003 4:29 Endblock should have name. Ex: {% endblock body %}. {% endblock %}

apis_core/core/templates/base.html
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
H031 5:0 Consider adding meta keywords. <html lang="en"> <
T003 15:6 Endblock should have name. Ex: {% endblock body %}. {% endblock %}
T003 68:4 Endblock should have name. Ex: {% endblock body %}. {% endblock %}
H023 196:43 Do not use entity references. &times;
T003 204:25 Endblock should have name. Ex: {% endblock body %}. {% endblock %}
H006 223:16 Img tag should have height and width attributes. <img id="logo" 
T003 254:4 Endblock should have name. Ex: {% endblock body %}. {% endblock %}

apis_core/core/templates/partials/backtotopbtn.html
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
H023 13:8 Do not use entity references. &uarr;

apis_core/core/templates/partials/footer-left.html
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
H006 12:4 Img tag should have height and width attributes. <img src="{% static 
H006 18:4 Img tag should have height and width attributes. <img src="{% static 

apis_core/documentation/templates/documentation.html
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
T003 106:0 Endblock should have name. Ex: {% endblock body %}. {% endblock %}

apis_core/generic/templates/generic/generic_enrich.html
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
T003 14:0 Endblock should have name. Ex: {% endblock body %}. {% endblock %}

apis_core/generic/templates/generic/generic_merge.html
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
T003 42:0 Endblock should have name. Ex: {% endblock body %}. {% endblock %}

Linted 68 files, found 23 errors.
@koeaw koeaw added tooling Tools, workflows, integrations etc. relevant to project maintenance, deployment, collaboration assets Static files, components defining or contributing to appearance question For any kind of question, whether about usage, contributing or the project in general labels Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assets Static files, components defining or contributing to appearance question For any kind of question, whether about usage, contributing or the project in general tooling Tools, workflows, integrations etc. relevant to project maintenance, deployment, collaboration
Projects
None yet
Development

No branches or pull requests

1 participant