ci: make pre-commit check style (#70186) #341

Merged
fpeters merged 2 commits from wip/70186-jenkins-pre-commit into main 2023-06-29 12:50:59 +02:00
34 changed files with 208 additions and 197 deletions

1
Jenkinsfile vendored
View File

@ -7,6 +7,7 @@ pipeline {
stage('Checks') {
steps {
script {
sh 'tox -rv' // makes pre-commit check style
if (env.GIT_BRANCH.startsWith('wip/')) {
sh 'make css'
}

View File

@ -2,13 +2,13 @@
{% load i18n %}
{% block registration %}
<div class="cell--body">
{% block registration-password-form-pre %}
<p>
Après validation de votre adresse électronique, il vous sera envoyé un courriel
pour ouvrir votre compte.
</p>
{% endblock %}
{{ block.super }}
</div>
<div class="cell--body">
{% block registration-password-form-pre %}
<p>
Après validation de votre adresse électronique, il vous sera envoyé un courriel
pour ouvrir votre compte.
</p>
{% endblock %}
{{ block.super }}
</div>
{% endblock %}

View File

@ -1,31 +1,31 @@
{% for feature in json.features %}
<div class="chantier" data-chantier-id="{{feature.properties.IDCHANTIER}}" style="display: none">
<h3>{{ feature.properties.TYPE }}<br>
<span class="chantier--dates">
{% with year=feature.properties.DEBUT|slice:":4" month=feature.properties.DEBUT|slice:"4:6" day=feature.properties.DEBUT|slice:"6:8" %}
{% with date=year|add:"-"|add:month|add:"-"|add:day|date %}
du {{date}}
{%endwith %}
{% endwith %}
{% with year=feature.properties.FIN|slice:":4" month=feature.properties.FIN|slice:"4:6" day=feature.properties.FIN|slice:"6:8" %}
{% with date=year|add:"-"|add:month|add:"-"|add:day|date %}
au {{date}}
{%endwith %}
{%endwith %}
</span>
</h3>
<div>
<p class="chantier--localisations">{{ feature.properties.LOCALISATIONS|safe }}</p>
<div class="chantier" data-chantier-id="{{feature.properties.IDCHANTIER}}" style="display: none">
<h3>{{ feature.properties.TYPE }}<br>
<span class="chantier--dates">
{% with year=feature.properties.DEBUT|slice:":4" month=feature.properties.DEBUT|slice:"4:6" day=feature.properties.DEBUT|slice:"6:8" %}
{% with date=year|add:"-"|add:month|add:"-"|add:day|date %}
du {{date}}
{%endwith %}
{% endwith %}
{% with year=feature.properties.FIN|slice:":4" month=feature.properties.FIN|slice:"4:6" day=feature.properties.FIN|slice:"6:8" %}
{% with date=year|add:"-"|add:month|add:"-"|add:day|date %}
au {{date}}
{%endwith %}
{%endwith %}
</span>
</h3>
<div>
<p class="chantier--localisations">{{ feature.properties.LOCALISATIONS|safe }}</p>
{% if feature.properties.INCIDENCE_CIRCULATION %}<p><span class="chantier--libelle">Incidence circulation :</span> {{feature.properties.INCIDENCE_CIRCULATION}}</p>{% endif %}
{% if feature.properties.INCIDENCE_STATIONNEMENT %}<p><span class="chantier--libelle">Incidence sur le stationnement :</span> {{feature.properties.INCIDENCE_STATIONNEMENT}}</p>{% endif %}
{% if feature.properties.NATURE %}<p><span class="chantier--libelle">Nature :</span> {{feature.properties.NATURE }}</p>{% endif %}
{% if feature.properties.MOUVRAGE %}<p><span class="chantier--libelle">Maîtrise douvrage :</span> {{feature.properties.MOUVRAGE }}</p>{% endif %}
{% if feature.properties.INCIDENCE_CIRCULATION %}<p><span class="chantier--libelle">Incidence circulation :</span> {{feature.properties.INCIDENCE_CIRCULATION}}</p>{% endif %}
{% if feature.properties.INCIDENCE_STATIONNEMENT %}<p><span class="chantier--libelle">Incidence sur le stationnement :</span> {{feature.properties.INCIDENCE_STATIONNEMENT}}</p>{% endif %}
{% if feature.properties.NATURE %}<p><span class="chantier--libelle">Nature :</span> {{feature.properties.NATURE }}</p>{% endif %}
{% if feature.properties.MOUVRAGE %}<p><span class="chantier--libelle">Maîtrise douvrage :</span> {{feature.properties.MOUVRAGE }}</p>{% endif %}
{% if montpellier_signalement_uri %}
<p><a class="pk-button" href="{{ montpellier_signalement_uri }}?chantier_ext={{feature.properties.IDCHANTIER}}">Signalement</a></p>
{% endif %}
{% if montpellier_signalement_uri %}
<p><a class="pk-button" href="{{ montpellier_signalement_uri }}?chantier_ext={{feature.properties.IDCHANTIER}}">Signalement</a></p>
{% endif %}
</div>
</div>
</div>
</div>
{% endfor %}

View File

@ -1,36 +1,36 @@
{% for feature in json.data %}
<div class="chantier" data-chantier-id="{{feature.display_id}}" style="display: none">
<h3>{{ feature.fields.chantier }}<br>
<span class="chantier--dates">
{% with date=feature.fields.debutchantier|date %}
du {{date}}
{% endwith %}
{% with date=feature.fields.finchantier|date %}
au {{date}}
{% endwith %}
</span>
</h3>
<div>
<p class="chantier--localisations">{{ feature.fields.numero|default:"" }} {{ feature.fields.rue }}, {{ feature.fields.commune }}</p>
<div class="chantier" data-chantier-id="{{feature.display_id}}" style="display: none">
<h3>{{ feature.fields.chantier }}<br>
<span class="chantier--dates">
{% with date=feature.fields.debutchantier|date %}
du {{date}}
{% endwith %}
{% with date=feature.fields.finchantier|date %}
au {{date}}
{% endwith %}
</span>
</h3>
<div>
<p class="chantier--localisations">{{ feature.fields.numero|default:"" }} {{ feature.fields.rue }}, {{ feature.fields.commune }}</p>
<p>{{feature.fields.descriptifchantier|safe}}</p>
<p>{{feature.fields.descriptifchantier|safe}}</p>
{% if feature.fields.contacts %}<p><span class="chantier--libelle">Contacts :</span> {{feature.fields.contacts }}</p>{% endif %}
{% if feature.fields.categoriechantier %}<p><span class="chantier--libelle">Catégorie :</span> {{feature.fields.categoriechantier }}</p>{% endif %}
{% if feature.fields.emploisgeneres %}<p><span class="chantier--libelle">Emplois générés :</span> {{feature.fields.emploisgeneres }}</p>{% endif %}
{% if feature.fields.montanttravaux %}<p><span class="chantier--libelle">Montant des travaux :</span> {{feature.fields.montanttravaux }}</p>{% endif %}
{% if feature.fields.contacts %}<p><span class="chantier--libelle">Contacts :</span> {{feature.fields.contacts }}</p>{% endif %}
{% if feature.fields.categoriechantier %}<p><span class="chantier--libelle">Catégorie :</span> {{feature.fields.categoriechantier }}</p>{% endif %}
{% if feature.fields.emploisgeneres %}<p><span class="chantier--libelle">Emplois générés :</span> {{feature.fields.emploisgeneres }}</p>{% endif %}
{% if feature.fields.montanttravaux %}<p><span class="chantier--libelle">Montant des travaux :</span> {{feature.fields.montanttravaux }}</p>{% endif %}
{% if feature.fields.url or montpellier_signalement_uri %}
<p>
{% if feature.fields.url %}
<a class="pk-button" href="{{ feature.fields.url }}">Plus dinfos</a>
{% endif %}
{% if montpellier_signalement_uri %}
<a class="pk-button" href="{{ montpellier_signalement_uri }}?chantier={{feature.id}}">Signalement</a>
{% endif %}
</p>
{% endif %}
{% if feature.fields.url or montpellier_signalement_uri %}
<p>
{% if feature.fields.url %}
<a class="pk-button" href="{{ feature.fields.url }}">Plus dinfos</a>
{% endif %}
{% if montpellier_signalement_uri %}
<a class="pk-button" href="{{ montpellier_signalement_uri }}?chantier={{feature.id}}">Signalement</a>
{% endif %}
</p>
{% endif %}
</div>
</div>
</div>
</div>
{% endfor %}

View File

@ -14,40 +14,40 @@
<p>{{ maintenance_message|default:"" }}</p>
</main>
</body>
<style>
html, body {
margin: 0;
padding: 0;
font-family: sans-serif;
background: #eee;
color: black;
font-size: 100%;
}
<style>
html, body {
margin: 0;
padding: 0;
font-family: sans-serif;
background: #eee;
color: black;
font-size: 100%;
}
body {
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
}
body {
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
}
main {
border: 5px solid {% firstof theme_color black %};
margin: auto auto;
padding: 1em;
max-width: 70ex;
flex: 1;
background: white;
}
main {
border: 5px solid {% firstof theme_color black %};
margin: auto auto;
padding: 1em;
max-width: 70ex;
flex: 1;
background: white;
}
h1 {
margin-top: 0;
border-bottom: 2px solid {% firstof theme_color black %};
font-size: 200%;
}
h1 {
margin-top: 0;
border-bottom: 2px solid {% firstof theme_color black %};
font-size: 200%;
}
p {
font-size: 120%;
}
</style>
p {
font-size: 120%;
}
</style>
</html>

View File

@ -23,17 +23,17 @@
</nav>
{% block nav-button-script %}
<script>
(function() {
const nav_button = document.getElementById('nav-button');
const nav_button_label = document.getElementById('nav-button--label');
nav_button.addEventListener('click', function() {
if (nav_button.classList.toggle('toggled')) {
nav_button_label.textContent = 'Fermer le menu';
} else {
nav_button_label.textContent = 'Ouvrir le menu';
}
});
})();
</script>
<script>
(function() {
const nav_button = document.getElementById('nav-button');
const nav_button_label = document.getElementById('nav-button--label');
nav_button.addEventListener('click', function() {
if (nav_button.classList.toggle('toggled')) {
nav_button_label.textContent = 'Fermer le menu';
} else {
nav_button_label.textContent = 'Ouvrir le menu';
}
});
})();
</script>
{% endblock %}

View File

@ -1,5 +1,5 @@
{% extends "qommon/forms/widget.html" %}
{% block widget-control %}
{% include "qommon/forms/widgets/reservations-enfant.html" with widget_prefix="toulouse-maelis" %}
{% include "qommon/forms/widgets/reservations-enfant.html" with widget_prefix="toulouse-maelis" %}
{% endblock %}

View File

@ -21,7 +21,7 @@
{{ block.content|safe }}
{% else %}
<div id="frontend-registration-{{ id }}" class="a2-block">
{{ block.content|safe }}
{{ block.content|safe }}
{% endif %}
</div>
{% endfor %}

View File

@ -7,13 +7,13 @@
{% endblock %}{
{% block content %}
<div id="fc-button-wrapper">
<div id="fc-button">
<a href="{{ login_url }}"
title="{% trans 'Log in with FranceConnect' %}"
class="button connexion{% if popup %} js-fc-popup{% endif %}">
</a>
<div id="fc-button-wrapper">
<div id="fc-button">
<a href="{{ login_url }}"
title="{% trans 'Log in with FranceConnect' %}"
class="button connexion{% if popup %} js-fc-popup{% endif %}">
</a>
</div>
</div>
</div>
{% endblock %}

View File

@ -1,5 +1,5 @@
{% extends "authentic2_auth_fc/registration.html" %}
{% block registration-block-title %}
<h3>Je midentifie avec FranceConnect</h3>
<h3>Je midentifie avec FranceConnect</h3>
{% endblock %}

View File

@ -5,9 +5,9 @@
{% endblock %}
{% block intro-text %}
<p>
<p>
Un code de suivi est associé à chaque demande afin de faciliter vos
échanges avec les services de la Mairie. Pour retrouver votre demande via le code de suivi, indiquez-le
ci-dessous :
</p>
ci-dessous :
</p>
{% endblock %}

View File

@ -2,18 +2,18 @@
{% load combo assets %}
{% block content-pre %}
{% if page.description or page.picture %}
<div class="cci-page-header">
<div class="cci-page-header--title-background">
<h1 class="cci-page-header--title">
{{page.title}}
</h1>
</div>
{% if page.description %}
<div class="cci-page-header--description">
{{ page.description }}
</div>
{% endif %}
{% if page.description or page.picture %}
<div class="cci-page-header">
<div class="cci-page-header--title-background">
<h1 class="cci-page-header--title">
{{page.title}}
</h1>
</div>
{% if page.description %}
<div class="cci-page-header--description">
{{ page.description }}
</div>
{% endif %}
{% endif %}
</div>
{% endif %}
{% endblock %}

View File

@ -1,5 +1,5 @@
{% extends "authentic2/base.html" %}
{% block columns-top %}
<a href="{% url 'account_management' %}" id="dordogne-connect-logo" title="Dordogne Connect"></a>
<a href="{% url 'account_management' %}" id="dordogne-connect-logo" title="Dordogne Connect"></a>
{% endblock %}

View File

@ -1,6 +1,6 @@
{% extends "authentic2/login_password_form.html" %}
{% block login %}
<h3 class="login-password-title">Vos identifiants</h3>
{{ block.super }}
<h3 class="login-password-title">Vos identifiants</h3>
{{ block.super }}
{% endblock %}

View File

@ -5,7 +5,7 @@
<div class="cd28-page-header--content">
{% placeholder "page-header" name="En-tête de la page" optional=True %}
{% skeleton_extra_placeholder page-header-default %}
{% end_skeleton_extra_placeholder %}
</div>
</header>
{% end_skeleton_extra_placeholder %}
</div>
</header>
{% endblock %}

View File

@ -1,5 +1,5 @@
{% extends "authentic2/login_password_form.html" %}
{% block login-block-title %}
<h2>Sidentifier</h2>
<h2>Sidentifier</h2>
{% endblock %}

View File

@ -1,5 +1,5 @@
{% extends "authentic2_auth_fc/login.html" %}
{% block login-block-title %}
<h2>FranceConnect</h2>
<h2>FranceConnect</h2>
{% endblock %}

View File

@ -64,7 +64,7 @@
{% for categories in form_categories.values|dictsort:"title" %}
{% with categories.variables|get:"ou-label"|default:categories.title as commune_name %}
{% if commune_name != request.session.mellon_session.city.0 and categories.slug != 'agglo' %}
<option value="{{ categories.slug }}" data-url="{{ categories.base_url }}tryauth">{{ commune_name }}</option>
<option value="{{ categories.slug }}" data-url="{{ categories.base_url }}tryauth">{{ commune_name }}</option>
{% endif %}
{% endwith %}
{% endfor %}

View File

@ -99,12 +99,12 @@
{% endblock %}
{% block body-bottom %}
{% skeleton_extra_placeholder service-worker %}
{% if page.pk %} {# limit this to concrete pages on combo (ex: not 404) #}
{% if pwa_display == "standalone" %}
<script src="/service-worker-registration.js"></script>
{% endif %}
{% if page.pk %} {# limit this to concrete pages on combo (ex: not 404) #}
{% if pwa_display == "standalone" %}
<script src="/service-worker-registration.js"></script>
{% endif %}
{% end_skeleton_extra_placeholder %}
{% endblock %}
</body>
{% endif %}
{% end_skeleton_extra_placeholder %}
{% endblock %}
</body>
</html>

View File

@ -4,7 +4,7 @@
{% block cell-header %}
{% get_asset "wcs:category:picture:"|add:cell.category_reference as asset %}
<h2 class="cell--title {% if asset %} with-asset{% endif %}"
{% if asset %} style="background-image: url({% asset_url asset crop="center" %})"{% endif %}>
{% if asset %} style="background-image: url({% asset_url asset crop="center" %})"{% endif %}>
<span>{{ title }}</span>
</h2>
{% if category_description %}

View File

@ -1,9 +1,9 @@
{% extends "combo/page_template.html" %}
{% block footer-post %}
<div id="footer-bottom" class="clearfix">
<div>
{% placeholder "footer-bottom" name="Bas du pied de page" acquired=True optional=True %}
<div id="footer-bottom" class="clearfix">
<div>
{% placeholder "footer-bottom" name="Bas du pied de page" acquired=True optional=True %}
</div>
</div>
</div>
{% endblock %}

View File

@ -1,12 +1,12 @@
{% extends 'combo/link-list-cell.html' %}
{% block cell-header %}
{% if title %}<h2 class="cell--title">{{ title }}</h2>{% endif %}
{% if links|length == 1 %}
<a href={{ links.0.url }}>
{% endif %}
{% include "combo/asset_picture_fragment.html" %}
{% if links|length == 1 %}
</a>
{% endif %}
{% if title %}<h2 class="cell--title">{{ title }}</h2>{% endif %}
{% if links|length == 1 %}
<a href={{ links.0.url }}>
{% endif %}
{% include "combo/asset_picture_fragment.html" %}
{% if links|length == 1 %}
</a>
{% endif %}
{% endblock cell-header %}

View File

@ -1,20 +1,20 @@
<h2>{{ title }}</h2>
{% if not json.err %}
<div class="links-list list-of-forms">
<ul>
{% for item in json.data %}
<li>
<a href="{{ item.url }}">
<span class="form-title">{{ item.name }}</span>
<span class="form-number">{{ item.datetime|datetime }}</span>
<span class="form-status">{{ item.status }}</span>
</a>
</li>
{% endfor %}
</ul>
</div>
<div class="links-list list-of-forms">
<ul>
{% for item in json.data %}
<li>
<a href="{{ item.url }}">
<span class="form-title">{{ item.name }}</span>
<span class="form-number">{{ item.datetime|datetime }}</span>
<span class="form-status">{{ item.status }}</span>
</a>
</li>
{% endfor %}
</ul>
</div>
{% else %}
<div class="cell--body">
<p class="empty-message">Il ny a aucune demande en cours.</p>
</div>
<div class="cell--body">
<p class="empty-message">Il ny a aucune demande en cours.</p>
</div>
{% endif %}

View File

@ -1,5 +1,5 @@
{% extends "authentic2_auth_fc/registration.html" %}
{% block registration-block-title %}
<h2>Je midentifie avec FranceConnect</h2>
<h2>Je midentifie avec FranceConnect</h2>
{% endblock %}

View File

@ -1,5 +1,5 @@
{% extends "authentic2_auth_fc/registration.html" %}
{% block registration-block-title %}
<h2>avec FranceConnect</h2>
<h2>avec FranceConnect</h2>
{% endblock %}

View File

@ -4,7 +4,7 @@
{% block cell-header %}
{% get_asset "wcs:category:picture:"|add:cell.category_reference as asset %}
<h2 class="cell--title{% if asset %} has-picture{% endif %}"
{% if asset %}style="background-image: url({% asset_url asset size="160x160" crop="center" %})"{% endif %}>
{% if asset %}style="background-image: url({% asset_url asset size="160x160" crop="center" %})"{% endif %}>
{{ title }}
</h2>
{% if category_description %}

View File

@ -1,7 +1,7 @@
{% extends "authentic2/login_password_registration_form.html" %}
{% block registration-block-title %}
<h3>Sinscrire avec mon adresse électronique</h3>
<h3>Sinscrire avec mon adresse électronique</h3>
{% endblock %}
{% block registration-password-form-pre %}

View File

@ -1,5 +1,5 @@
{% extends "authentic2_auth_fc/registration.html" %}
{% block registration-block-title %}
<h3>Sinscrire avec FranceConnect</h3>
<h3>Sinscrire avec FranceConnect</h3>
{% endblock %}

View File

@ -5,9 +5,9 @@
{% block extra_css %}
<style>
html {
{% if tao_primary_color %}
--tao-primary-color: {{ tao_primary_color }};
{% endif %}
{% if tao_primary_color %}
--tao-primary-color: {{ tao_primary_color }};
{% endif %}
}
{% if menu_icons %}

View File

@ -1,6 +1,6 @@
{% extends "authentic2_auth_fc/explanation.html" %}
{% block fc-explanation %}
<h3>FranceConnect</h3>
{{ block.super }}
<h3>FranceConnect</h3>
{{ block.super }}
{% endblock %}

View File

@ -1,9 +1,9 @@
{% if request.session.mellon_session %}
{% with preferred_username=request.session.mellon_session.preferred_username.0 %}
{{ user.first_name }} {% firstof preferred_username user.last_name %}
{% endwith %}
{% with preferred_username=request.session.mellon_session.preferred_username.0 %}
{{ user.first_name }} {% firstof preferred_username user.last_name %}
{% endwith %}
{% elif user.attributes %}
{{ user.first_name }} {% firstof user.attributes.preferred_username user.last_name %}
{% else %}
{{ user.get_full_name }}
{{ user.get_full_name }}
{% endif %}

View File

@ -1,7 +1,7 @@
{% extends "authentic2/login_password_form.html" %}
{% block login %}
<p><strong>Vous navez pas de compte à lUniversité ?</strong> Dans ce cas, utilisez votre adresse électronique personnelle. Si vous navez pas de compte, enregistrez-vous sur le site.</p>
<p><strong>Vous navez pas de compte à lUniversité ?</strong> Dans ce cas, utilisez votre adresse électronique personnelle. Si vous navez pas de compte, enregistrez-vous sur le site.</p>
{{ block.super }}
{% endblock %}

View File

@ -13,7 +13,7 @@
<div class="theme-page-header--content">{% placeholder "page-header" name="En-tête de la page" optional=True %}</div>
</header>
{%skeleton_extra_placeholder after-header %}
{% end_skeleton_extra_placeholder %}
{% end_skeleton_extra_placeholder %}
{% endblock %}
{% block content-post %}

10
tox.ini Normal file
View File

@ -0,0 +1,10 @@
[tox]
envlist = codestyle
skipsdist = True
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/publik-base-theme/{env:BRANCH_NAME:}
[testenv]
deps =
codestyle: pre-commit
commands =
codestyle: pre-commit run --all-files --show-diff-on-failure