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

@ -1,4 +1,5 @@
/* http://meyerweb.com/eric/tools/css/reset/
/*
http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/

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

@ -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,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

@ -15,7 +15,6 @@ describe TagsSubstitutionConcern, type: :model do
let(:template_concern) do
(Class.new do
include TagsSubstitutionConcern
public :replace_tags
def initialize(p, s)
@procedure = p
@ -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--')

707
yarn.lock

File diff suppressed because it is too large Load diff