lifen-ruby-style 1.0.1 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9380924908467fe4fe452a0755c80569b75475e8b166cd042a0eb593739dfa39
4
- data.tar.gz: 1c76b423b5b15c06539baf770e4a291d13aba7f9d04ab82fdb97c826208aec13
3
+ metadata.gz: 20241f5f06c6ce3ee92e87f234e659542f0565687e1e7102a79f837226c912fc
4
+ data.tar.gz: 7e58e92ccb1990f69f7aa22dacf6cdba5b3e95de1768a2b7b0213be9b7df3c8d
5
5
  SHA512:
6
- metadata.gz: 743a7c56568a5e721006fff6080377ecb53dfad03b91e11085122df8b1be243235350477699d43fce47e594fa4eef9b9e997386c5a5c17462a57928fa972566a
7
- data.tar.gz: e4000d1f5fe3d49347c90cbede0e5b8264ea02551784abf699212018c5f969fa6195216ffa76c6b43166e3b777d9ee3d35a3c11fda9a86723b4d892b367f59dd
6
+ metadata.gz: 4bbb9623066e0401253254f700006ea14d257f3aa3e0e2a2be563015d3a18a837f0844abb073558e2277825ddddaa46b9582caf107e26b85776faf10ae8d7f08
7
+ data.tar.gz: 5987a28429905604738cd997de2cd3e505069dba0bd26744bc25b7e6314dc25b80db503a92c28e95307418e5ce5995116abc0fb98bdb706e99014aca95394cba
@@ -19,6 +19,7 @@ PreCommit:
19
19
  RuboCop:
20
20
  enabled: true
21
21
  command: ["bundle", "exec", "rubocop"]
22
+ problem_on_unmodified_line: ignore
22
23
 
23
24
  GoFmt:
24
25
  enabled: false
@@ -33,7 +34,6 @@ CommitMsg:
33
34
 
34
35
  TextWidth:
35
36
  enabled: true
36
- on_warn: fail
37
37
 
38
38
  TrailingPeriod:
39
39
  enabled: true
data/README.md CHANGED
@@ -61,7 +61,7 @@ $ echo '--force-exclusion' > .rubocop
61
61
  ### 3. Config Overcommit
62
62
 
63
63
  ```bash
64
- $ curl https://raw.githubusercontent.com/honestica/lifen-ruby-style/master/default_overcommit.yml > .overcommit_test.yml
64
+ $ curl https://raw.githubusercontent.com/honestica/lifen-ruby-style/master/default_overcommit.yml > .overcommit.yml
65
65
  ```
66
66
 
67
67
  ### 4. Installer les dépendances
@@ -123,17 +123,20 @@ $ bundle exec overcommit --install
123
123
  - Paramétrage recommandé pour l'auto-formatting :
124
124
 
125
125
  ```json
126
+ "editor.formatOnPaste": true, // global auto-format code when pasting
127
+ "editor.formatOnSave": true, // global auto-format code when saving
126
128
  "[ruby]": {
127
- "editor.formatOnPaste": true, // auto-format ruby code when pasting
128
- "editor.formatOnSave": true // auto-format ruby code when saving
129
+ "editor.formatOnSave": false // disable auto-format on save only for ruby files
129
130
  },
130
131
  ```
131
132
 
132
133
  ou
133
134
 
134
135
  ```json
135
- "editor.formatOnPaste": true, // auto-format code when pasting
136
- "editor.formatOnSave": true, // auto-format code when saving
136
+ "[ruby]": {
137
+ "editor.formatOnPaste": true, // auto-format ruby code when pasting
138
+ "editor.formatOnSave": false // auto-format ruby code when saving
139
+ },
137
140
  ```
138
141
 
139
142
  ### 3. Bonus - Autres extensions utiles :
@@ -250,12 +253,28 @@ https://github.com/dense-analysis/ale
250
253
  ### Workflow
251
254
 
252
255
  - Je code ma feature en local. Mon environnement (projet + IDE) étant configuré, je suis alerté en direct des règles de style que j'enfreins. Certaines sont mêmes corrigées automatiquement, lors de la sauvegarde du fichier.
256
+ - Pour ignorer manuellement RuboCop sur des lignes données :
257
+
258
+ ```ruby
259
+ "I want to ignore the Style/StringLiterals rule on this line only" # rubocop:disable Style/StringLiterals
260
+
261
+ # rubocop:disable Style/StringLiterals
262
+ "I want to ignore the Style/StringLiterals rule on this line."
263
+ "and also on this one, because I like double quotes."
264
+ # rubocop:enable Style/StringLiterals
265
+ ```
266
+
253
267
  - Je commit :
254
268
  - Un hook de pre-commit lance une analyse RuboCop sur les fichiers "staged". Si l'analye renvoie des erreurs, le commit est bloqué.
255
269
  - Un hook vérifie le message de commit
256
270
  - Si je veux bypasser les hooks (déconseillé) : `OVERCOMMIT_DISABLE=1 git commit ...`
257
271
  - Je push (pas de hooks de pre-push paramétrés pour l'instant)
258
272
 
273
+ Attention :
274
+
275
+ - si vous faites "Ctrl+C" pendant qu'un hook overcommit tourne, overcommit fait un `git stash save` et vous pouvez retrouver ce qui a disparu avec `git stast list / show / pop`
276
+ - dans le même registre, ne faites pas de `watch .git/hooks/pre-commit`, si vous éditez vos fichiers dans une autre fenêtre, overcommit va régulièrement stasher vos modifs, et vous allez tourner en rond à éditer des fichiers qui changent sous vos pieds.
277
+
259
278
  ### Commandes Rubocop
260
279
 
261
280
  Pour de la vérification :
@@ -286,7 +305,7 @@ $ bundle exec rubocop --help
286
305
 
287
306
  ```bash
288
307
  $ OVERCOMMIT_DISABLE=1 git [command] # Executes the git command without running the hooks
289
- $ bundle exec overcommit --run # Run pre-commit hook against all git tracked files
308
+ $ bundle exec overcommit --run # Run pre-commit hook against all git tracked files
290
309
  ```
291
310
 
292
311
  Liste des commandes disponibles :
@@ -351,6 +370,7 @@ Vous allez vouloir tester localement les modifications de règle de style que vo
351
370
 
352
371
  ## TODO
353
372
 
373
+ [ ] Ajouter rubocop-daemon (arriver à faire une bonne intégration aux IDE)
354
374
  [ ] Ajouter le hook de pre-commit au CI
355
375
  [ ] Ajouter un hook de pre-push ?
356
376
  [ ] Ajouter `fasterer` si pertinent
@@ -19,6 +19,7 @@ PreCommit:
19
19
  RuboCop:
20
20
  enabled: true
21
21
  command: ["bundle", "exec", "rubocop"]
22
+ problem_on_unmodified_line: ignore
22
23
 
23
24
  GoFmt:
24
25
  enabled: false
@@ -33,7 +34,6 @@ CommitMsg:
33
34
 
34
35
  TextWidth:
35
36
  enabled: true
36
- on_warn: fail
37
37
 
38
38
  TrailingPeriod:
39
39
  enabled: true
@@ -17,12 +17,68 @@ AllCops:
17
17
  - "node_modules/**/*"
18
18
 
19
19
  # Waiting for default config
20
+ Lint/RaiseException:
21
+ Enabled: true
22
+ Lint/StructNewOverride:
23
+ Enabled: true
20
24
  Style/HashEachMethods:
21
25
  Enabled: true
22
26
  Style/HashTransformKeys:
23
27
  Enabled: true
24
28
  Style/HashTransformValues:
25
29
  Enabled: true
30
+ Layout/EmptyLinesAroundAttributeAccessor:
31
+ Enabled: true
32
+ Layout/SpaceAroundMethodCallOperator:
33
+ Enabled: true
34
+ Lint/DeprecatedOpenSSLConstant:
35
+ Enabled: true
36
+ Lint/DuplicateElsifCondition:
37
+ Enabled: true
38
+ Lint/MixedRegexpCaptureTypes:
39
+ Enabled: true
40
+ Style/AccessorGrouping:
41
+ Enabled: true
42
+ Style/ArrayCoercion:
43
+ Enabled: true
44
+ Style/BisectedAttrAccessor:
45
+ Enabled: true
46
+ Style/CaseLikeIf:
47
+ Enabled: true
48
+ Style/ExponentialNotation:
49
+ Enabled: true
50
+ Style/HashAsLastArrayItem:
51
+ Enabled: true
52
+ Style/HashLikeCase:
53
+ Enabled: true
54
+ Style/RedundantAssignment:
55
+ Enabled: true
56
+ Style/RedundantFetchBlock:
57
+ Enabled: true
58
+ Style/RedundantFileExtensionInRequire:
59
+ Enabled: true
60
+ Style/RedundantRegexpCharacterClass:
61
+ Enabled: true
62
+ Style/RedundantRegexpEscape:
63
+ Enabled: true
64
+ Style/SlicingWithRange:
65
+ Enabled: true
66
+ Performance/AncestorsInclude:
67
+ Enabled: true
68
+ Performance/BigDecimalWithNumericArgument:
69
+ Enabled: true
70
+ Performance/RedundantSortBlock:
71
+ Enabled: true
72
+ Performance/RedundantStringChars:
73
+ Enabled: true
74
+ Performance/ReverseFirst:
75
+ Enabled: true
76
+ Performance/SortReverse:
77
+ Enabled: true
78
+ Performance/Squeeze:
79
+ Enabled: true
80
+ Performance/StringInclude:
81
+ Enabled: true
26
82
 
27
83
  Layout/ArgumentAlignment:
28
84
  EnforcedStyle: with_fixed_indentation
@@ -87,12 +143,23 @@ Metrics/PerceivedComplexity:
87
143
  Naming/MemoizedInstanceVariableName:
88
144
  EnforcedStyleForLeadingUnderscores: required
89
145
 
146
+ RSpec/DescribeClass:
147
+ Exclude:
148
+ - spec/lib/tasks/deployment/**/*
149
+
150
+ Style/BlockDelimiters:
151
+ EnforcedStyle: braces_for_chaining
152
+
90
153
  Style/ClassAndModuleChildren:
91
154
  Enabled: false
92
155
 
93
156
  Style/Documentation:
94
157
  Enabled: false
95
158
 
159
+ Style/IfUnlessModifier:
160
+ Enabled: true
161
+ AutoCorrect: false
162
+
96
163
  Style/NumericLiterals:
97
164
  Strict: true
98
165
 
@@ -108,6 +175,17 @@ Style/SymbolArray:
108
175
  Style/WordArray:
109
176
  EnforcedStyle: brackets
110
177
 
178
+ Rails/DynamicFindBy:
179
+ Enabled: true
180
+ AutoCorrect: false
181
+
182
+ Rails/UnknownEnv:
183
+ Environments:
184
+ - production
185
+ - development
186
+ - test
187
+ - staging
188
+
111
189
  RSpec/AnyInstance:
112
190
  Enabled: false
113
191
 
@@ -120,11 +198,14 @@ RSpec/ExampleLength:
120
198
  RSpec/HookArgument:
121
199
  EnforcedStyle: each
122
200
 
201
+ RSpec/LetSetup:
202
+ Enabled: false
203
+
123
204
  RSpec/MultipleExpectations:
124
205
  Enabled: false
125
206
 
126
207
  RSpec/NestedGroups:
127
- Max: 4
208
+ Max: 5
128
209
 
129
210
  RSpec/NotToNot:
130
211
  EnforcedStyle: to_not
@@ -3,7 +3,7 @@
3
3
  module Lifen
4
4
  module RubyStyle
5
5
 
6
- VERSION = '1.0.1'
6
+ VERSION = '1.0.6'
7
7
 
8
8
  end
9
9
  end
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.require_paths = ['lib']
31
31
 
32
32
  spec.add_dependency 'overcommit'
33
- spec.add_dependency 'rubocop', '~> 0.8'
33
+ spec.add_dependency 'rubocop', '0.88'
34
34
  spec.add_dependency 'rubocop-performance', '~> 1.5'
35
35
  spec.add_dependency 'rubocop-rails', '~> 2.4'
36
36
  spec.add_dependency 'rubocop-rspec', '~> 1.38'
@@ -619,6 +619,12 @@ before(:each) do
619
619
  end
620
620
  ```
621
621
 
622
+ #### LetSetup
623
+
624
+ ```yaml
625
+ Enabled: false // does not check unreferenced let! calls being used for test setup
626
+ ```
627
+
622
628
  #### MultipleExpectations
623
629
 
624
630
  ```yaml
@@ -651,6 +657,22 @@ end
651
657
  Enabled: false // example groups can have the same description string.
652
658
  ```
653
659
 
660
+ #### Block Delimiters
661
+
662
+ ##### EnforcedStyle: braces_for_chaining
663
+
664
+ ```ruby
665
+ # bad
666
+ words.each do |word|
667
+ word.flip.flop
668
+ end.join("-")
669
+
670
+ # good
671
+ words.each { |word|
672
+ word.flip.flop
673
+ }.join("-")
674
+ ```
675
+
654
676
  </details>
655
677
 
656
678
  ### Default rules
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lifen-ruby-style
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Team Lifen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-05 00:00:00.000000000 Z
11
+ date: 2020-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: overcommit
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: rubocop
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: '0.8'
33
+ version: '0.88'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: '0.8'
40
+ version: '0.88'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rubocop-performance
43
43
  requirement: !ruby/object:Gem::Requirement