Merge pull request #2639 from betagouv/ec-lint

Add and use eclint
This commit is contained in:
gregoirenovel 2018-09-20 16:49:43 +02:00 committed by GitHub
commit 04153ff4e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 801 additions and 115 deletions

View file

@ -9,3 +9,6 @@ charset = utf-8
indent_size = 2
indent_style = space
trim_trailing_whitespace = true
[*.{ico,keep,pdf,svg}]
insert_final_newline = false

View file

@ -193,7 +193,7 @@
// CAUTION: IE hackery ahead
&::-ms-expand {
display: none; // remove default arrow in IE 10 and 11 */
}
}
// target Internet Explorer 9 to undo the custom arrow */
@media screen and (min-width:0\0) {

View file

@ -1,6 +1,7 @@
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
/*
http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
@ -12,37 +13,37 @@ b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
display: block;
}
body {
line-height: 1;
line-height: 1;
}
ol, ul {
list-style: none;
list-style: none;
}
blockquote, q {
quotes: none;
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
border-collapse: collapse;
border-spacing: 0;
}

View file

@ -76,5 +76,5 @@ class Users::CarteController < UsersController
multipolygone.to_json
end
end
end
end
end

View file

@ -0,0 +1,21 @@
module DemandeHelper
def nb_of_procedures_options
{
'je ne sais pas' => Pipedrive::DealAdapter::PIPEDRIVE_NB_OF_PROCEDURES_DO_NOT_KNOW_VALUE,
'1' => Pipedrive::DealAdapter::PIPEDRIVE_NB_OF_PROCEDURES_1_VALUE,
'1 à 10' => Pipedrive::DealAdapter::PIPEDRIVE_NB_OF_PROCEDURES_1_TO_10_VALUE,
'10 à 100 ' => Pipedrive::DealAdapter::PIPEDRIVE_NB_OF_PROCEDURES_10_TO_100_VALUE,
'plus de 100' => Pipedrive::DealAdapter::PIPEDRIVE_NB_OF_PROCEDURES_ABOVE_100_VALUE
}
end
def deadline_options
{
'le plus vite possible' => Pipedrive::DealAdapter::PIPEDRIVE_DEADLINE_ASAP_VALUE,
'dans les 3 prochains mois' => Pipedrive::DealAdapter::PIPEDRIVE_DEADLINE_NEXT_3_MONTHS_VALUE,
'dans les 6 prochains mois' => Pipedrive::DealAdapter::PIPEDRIVE_DEADLINE_NEXT_6_MONTHS_VALUE,
'dans les 12 prochains mois' => Pipedrive::DealAdapter::PIPEDRIVE_DEADLINE_NEXT_12_MONTHS_VALUE,
'pas de date' => Pipedrive::DealAdapter::PIPEDRIVE_DEADLINE_NO_DATE_VALUE
}
end
end

View file

@ -848,4 +848,4 @@
{
"nom": "ZIMBABWE"
}
]
]

View file

@ -8,7 +8,7 @@ class AdministrateurMailer < ApplicationMailer
@subject = "N'oubliez pas d'activer votre compte administrateur"
mail(to: administrateur.email,
subject: @subject,
reply_to: CONTACT_EMAIL)
subject: @subject,
reply_to: CONTACT_EMAIL)
end
end

View file

@ -7,7 +7,7 @@ class AdministrationMailer < ApplicationMailer
subject = "Création d'un compte admininistrateur"
mail(to: TECH_EMAIL,
subject: subject)
subject: subject)
end
def invite_admin(admin, reset_password_token, administration_id)
@ -17,16 +17,16 @@ class AdministrationMailer < ApplicationMailer
subject = "Activez votre compte administrateur"
mail(to: admin.email,
subject: subject,
reply_to: CONTACT_EMAIL)
subject: subject,
reply_to: CONTACT_EMAIL)
end
def refuse_admin(admin_email)
subject = "Votre demande de compte a été refusée"
mail(to: admin_email,
subject: subject,
reply_to: CONTACT_EMAIL)
subject: subject,
reply_to: CONTACT_EMAIL)
end
def dubious_procedures(procedures_and_type_de_champs)
@ -34,6 +34,6 @@ class AdministrationMailer < ApplicationMailer
subject = "[RGS] De nouvelles démarches comportent des champs interdits"
mail(to: EQUIPE_EMAIL,
subject: subject)
subject: subject)
end
end

View file

@ -7,8 +7,8 @@ class GestionnaireMailer < ApplicationMailer
subject = "Activez votre compte instructeur"
mail(to: gestionnaire.email,
subject: subject,
reply_to: CONTACT_EMAIL)
subject: subject,
reply_to: CONTACT_EMAIL)
end
def user_to_gestionnaire(email)

View file

@ -20,7 +20,7 @@ class InviteMailer < ApplicationMailer
email = invite.email
mail(to: email,
subject: subject,
reply_to: reply_to)
subject: subject,
reply_to: reply_to)
end
end

View file

@ -26,8 +26,8 @@ class PreactivateUsersMailer < ApplicationMailer
END_OF_MAIL
mail(to: model.email,
subject: subject,
reply_to: CONTACT_EMAIL,
body: body)
subject: subject,
reply_to: CONTACT_EMAIL,
body: body)
end
end

View file

@ -193,7 +193,7 @@ module TagsSubstitutionConcern
tags_and_datas
.map { |(tags, data)| [filter_tags(tags), data] }
.inject(text) { |acc, (tags, data)| replace_tags_with_values_from_data(acc, tags, data) }
end
end
def replace_type_de_champ_tags(text, types_de_champ, dossier_champs)
types_de_champ.inject(text) do |acc, tag|

View file

@ -1 +1 @@
<%= "togglePathMessage(true, #{@mine})" %>
<%= "togglePathMessage(true, #{@mine})" %>

View file

@ -46,11 +46,7 @@
Combien de démarches souhaitez-vous dématerialiser ?
%span.mandatory *
= select_tag :nb_of_procedures,
options_for_select({ 'je ne sais pas' => Pipedrive::DealAdapter::PIPEDRIVE_NB_OF_PROCEDURES_DO_NOT_KNOW_VALUE,
'1' => Pipedrive::DealAdapter::PIPEDRIVE_NB_OF_PROCEDURES_1_VALUE,
'1 à 10' => Pipedrive::DealAdapter::PIPEDRIVE_NB_OF_PROCEDURES_1_TO_10_VALUE,
'10 à 100 ' => Pipedrive::DealAdapter::PIPEDRIVE_NB_OF_PROCEDURES_10_TO_100_VALUE,
'plus de 100' => Pipedrive::DealAdapter::PIPEDRIVE_NB_OF_PROCEDURES_ABOVE_100_VALUE }),
options_for_select(nb_of_procedures_options),
prompt: 'choisir un intervalle',
required: true
@ -58,11 +54,7 @@
À quelle échance voudriez-vous dématerialiser ?
%span.mandatory *
= select_tag :deadline,
options_for_select({ 'le plus vite possible' => Pipedrive::DealAdapter::PIPEDRIVE_DEADLINE_ASAP_VALUE,
'dans les 3 prochains mois' => Pipedrive::DealAdapter::PIPEDRIVE_DEADLINE_NEXT_3_MONTHS_VALUE,
'dans les 6 prochains mois' => Pipedrive::DealAdapter::PIPEDRIVE_DEADLINE_NEXT_6_MONTHS_VALUE,
'dans les 12 prochains mois' => Pipedrive::DealAdapter::PIPEDRIVE_DEADLINE_NEXT_12_MONTHS_VALUE,
'pas de date' => Pipedrive::DealAdapter::PIPEDRIVE_DEADLINE_NO_DATE_VALUE }),
options_for_select(deadline_options),
prompt: 'choisir une échéance',
required: true

View file

@ -3,9 +3,9 @@
- if @facade.dossier.types_de_piece_justificative.size > 0
.col-lg-4.col-md-4.col-sm-4.col-xs-4.action
%a#maj_pj.action{ "data-target" => "#upload-pj-modal",
"data-toggle" => "modal",
:type => "button",
style: 'margin-bottom: 15px; margin-top: -30px;' }
"data-toggle" => "modal",
:type => "button",
style: 'margin-bottom: 15px; margin-top: -30px;' }
Modifier les documents
%br
= render partial: 'users/recapitulatif/modal_upload_pj'

View file

@ -9,4 +9,4 @@ error_form_siret('<%= invalid_siret %>');
function render_new_siret(){
$('.row.etape.etape-2').html("<%= escape_javascript(render partial: '/dossiers/etapes/etape_2/entreprise', locals: { facade: @facade } ) %>");
}
}

View file

@ -10,4 +10,4 @@ error_form_siret('<%= invalid_siret %>');
function render_new_siret(){
$('.row.etape.etape-2').html("<%= escape_javascript(render partial: '/dossiers/etapes/etape2', locals: { facade: @facade } ) %>");
}
}

View file

@ -3,4 +3,4 @@
<% end -%>
<br>
<%= link_to "Mot de passe oublié ?", new_password_path(resource_name) %><br />
<%= link_to "Mot de passe oublié ?", new_password_path(resource_name) %><br />

View file

@ -158,7 +158,7 @@ fr:
invalid_siret: "Le siret est incorrect"
procedure_not_found: "La démarche n'existe pas"
france_connect:
connexion: "Erreur lors de la connexion à France Connect."
connexion: "Erreur lors de la connexion à France Connect."
extension_white_list_error: "Le format de fichier de la pièce jointe n'est pas valide."
procedure_archived: "Cette démarche en ligne a été fermée, il n'est plus possible de déposer de dossier."

View file

@ -36,7 +36,7 @@ module Cellar
canonicalized_amz_headers = ""
canonicalized_resource = "/#{@bucket}/#{key}"
string_to_sign = "#{method}\n#{checksum}\n#{content_type}\n#{expires}#{date}\n" +
"#{canonicalized_amz_headers}#{canonicalized_resource}"
"#{canonicalized_amz_headers}#{canonicalized_resource}"
Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha1'), @secret_access_key, string_to_sign)).strip
end
end

View file

@ -3,5 +3,6 @@ task :lint do
sh "bundle exec haml-lint app/views/"
sh "bundle exec scss-lint app/assets/stylesheets/"
sh "bundle exec brakeman --no-pager"
sh "yarn lint:ec"
sh "yarn lint:js"
end

View file

@ -15,6 +15,7 @@
"turbolinks": "^5.1.1"
},
"devDependencies": {
"eclint": "^2.8.0",
"eslint": "^5.2.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-prettier": "^2.6.2",
@ -22,6 +23,7 @@
"webpack-dev-server": "^3.1.4"
},
"scripts": {
"lint:ec": "eclint check $({ git ls-files ; find vendor -type f ; echo 'db/schema.rb' ; } | sort | uniq -u)",
"lint:js": "eslint ./app/javascript ./config/webpack"
},
"engines": {

View file

@ -691,9 +691,9 @@ describe Admin::ProceduresController, type: :controller do
let(:procedure) { create :procedure, :published, administrateur: admin }
before do
subject
procedure.reload
end
subject
procedure.reload
end
it { expect(procedure.hidden_at).not_to be_nil }
it { expect(procedure.procedure_path).to be_nil }

View file

@ -55,7 +55,7 @@ describe CARTO::SGMAP::API do
before do
stub_request(:post, "https://apicarto.sgmap.fr/cadastre/geometrie")
.with(:body => /.*/,
:headers => { 'Content-Type' => 'application/json' })
:headers => { 'Content-Type' => 'application/json' })
.to_return(status: status, body: body)
end
context 'when geojson is empty' do

View file

@ -2,21 +2,21 @@ describe EmailSanitizableConcern, type: :model do
describe 'sanitize_email' do
let(:email_concern) do
(Class.new do
include EmailSanitizableConcern
attr_accessor :email
include EmailSanitizableConcern
attr_accessor :email
def initialize(email)
self.email = email
end
def initialize(email)
self.email = email
end
def [](key)
self.send(key)
end
def [](key)
self.send(key)
end
def []=(key, value)
self.send("#{key}=", value)
end
end).new(email)
def []=(key, value)
self.send("#{key}=", value)
end
end).new(email)
end
before do

View file

@ -14,18 +14,17 @@ describe TagsSubstitutionConcern, type: :model do
let(:template_concern) do
(Class.new do
include TagsSubstitutionConcern
public :replace_tags
include TagsSubstitutionConcern
def initialize(p, s)
@procedure = p
self.class.const_set(:DOSSIER_STATE, s)
end
def initialize(p, s)
@procedure = p
self.class.const_set(:DOSSIER_STATE, s)
end
def procedure
@procedure
end
end).new(procedure, state)
def procedure
@procedure
end
end).new(procedure, state)
end
describe 'replace_tags' do
@ -35,7 +34,7 @@ describe TagsSubstitutionConcern, type: :model do
before { Timecop.freeze(Time.now) }
subject { template_concern.replace_tags(template, dossier) }
subject { template_concern.send(:replace_tags, template, dossier) }
after { Timecop.return }
@ -253,7 +252,7 @@ describe TagsSubstitutionConcern, type: :model do
let(:template) { '--motivation-- --date de décision--' }
let(:state) { Dossier.states.fetch(:en_instruction) }
subject { template_concern.replace_tags(template, dossier) }
subject { template_concern.send(:replace_tags, template, dossier) }
it "does not treat motivation or date de décision as tags" do
is_expected.to eq('--motivation-- --date de décision--')

View file

@ -114,4 +114,4 @@
"type": "Feature"
}
]
}
}

View file

@ -6,4 +6,4 @@
"query": "Paris",
"type": "FeatureCollection",
"features": []
}
}

View file

@ -180,4 +180,4 @@
}
},
"gateway_error": false
}
}

View file

@ -46,4 +46,4 @@
}
},
"gateway_error": false
}
}

View file

@ -29,4 +29,4 @@
]
}
}
}
}

View file

@ -26,4 +26,4 @@
]
]
}
}
}

View file

@ -1214,4 +1214,4 @@
}
}
]
}
}

View file

@ -27,4 +27,4 @@
}
}
]
}
}

View file

@ -27,4 +27,4 @@
"mise_a_jour": 1392295833
},
"date_extraction_donnees": 1427210585
}
}

707
yarn.lock

File diff suppressed because it is too large Load diff