bookingsync-stylecheck 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8a1309b3cddf9f65ab4df791bc3e0558e4f32cf2
4
+ data.tar.gz: d568c0841fe106da299dec454d64bd81448aa99d
5
+ SHA512:
6
+ metadata.gz: d51723bfd06e3889f708fd3dd92c5c5be694d564a64a056c2d72ded74c891d8b05c226e978a2cb8c4b0a49f1eb974f219a770bf037cf239ba655153dfdb7f740
7
+ data.tar.gz: 66c63b2fd3b6714b17ab411c505cde2f633a6377dd0786c266ad38973140c29710d30d4cfdd47c2b21e6fa914271b277ff22f33d00f5a75e8d8092e7649c6a49
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2014 BookingSync SAS
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # bookingsync-stylecheck
2
+
3
+ This gem should streamline using of rubocop and potentially other automated stylecheck tools.
4
+
5
+ # install
6
+
7
+ Just add to gemfile and new rake task should be available
8
+
9
+ * `bundle exec rake style`
10
+
11
+ This for now just prepares a rubocop config and runs the rubocop check
@@ -0,0 +1,583 @@
1
+ # These are all the cops that are enabled in the default configuration.
2
+ AllCops:
3
+ DisabledByDefault: true
4
+ TargetRubyVersion: 2.2
5
+ Exclude:
6
+ - "db/**/*"
7
+ - "tmp/**/*"
8
+ - "vendor/**/*"
9
+ - "bin/**/*"
10
+ - "log/**/*"
11
+
12
+ Style/AccessModifierIndentation:
13
+ Enabled: true
14
+
15
+ Style/AccessorMethodName:
16
+ Enabled: false
17
+
18
+ Style/Alias:
19
+ Enabled: false
20
+
21
+ Style/AlignArray:
22
+ Enabled: false
23
+
24
+ Style/AlignHash:
25
+ Enabled: false
26
+
27
+ Style/AlignParameters:
28
+ EnforcedStyle: with_fixed_indentation
29
+ Enabled: false
30
+
31
+ Style/AndOr:
32
+ Enabled: false
33
+
34
+ Style/ArrayJoin:
35
+ Enabled: false
36
+
37
+ Style/AsciiComments:
38
+ Enabled: false
39
+
40
+ Style/AsciiIdentifiers:
41
+ Enabled: false
42
+
43
+ Style/Attr:
44
+ Enabled: false
45
+
46
+ Style/BeginBlock:
47
+ Enabled: false
48
+
49
+ Style/BarePercentLiterals:
50
+ Enabled: false
51
+
52
+ Style/BlockComments:
53
+ Enabled: false
54
+
55
+ Style/BlockEndNewline:
56
+ Enabled: false
57
+
58
+ Style/BracesAroundHashParameters:
59
+ Enabled: true
60
+ EnforcedStyle: context_dependent
61
+
62
+ Style/CaseEquality:
63
+ Enabled: false
64
+
65
+ Style/CaseIndentation:
66
+ Enabled: false
67
+
68
+ Style/CharacterLiteral:
69
+ Enabled: false
70
+
71
+ Style/ClassAndModuleCamelCase:
72
+ Enabled: false
73
+
74
+ Style/ClassAndModuleChildren:
75
+ Enabled: false
76
+
77
+ Style/ClassCheck:
78
+ Enabled: false
79
+
80
+ Style/ClassMethods:
81
+ Enabled: false
82
+
83
+ Style/ClassVars:
84
+ Enabled: false
85
+
86
+ Style/ColonMethodCall:
87
+ Enabled: false
88
+
89
+ Style/CommentAnnotation:
90
+ Enabled: false
91
+
92
+ Style/CommentIndentation:
93
+ Enabled: false
94
+
95
+ Style/ConstantName:
96
+ Enabled: false
97
+
98
+ Style/DefWithParentheses:
99
+ Enabled: false
100
+
101
+ Style/DeprecatedHashMethods:
102
+ Enabled: false
103
+
104
+ Style/Documentation:
105
+ Enabled: false
106
+
107
+ Style/DotPosition:
108
+ Enabled: false
109
+
110
+ Style/DoubleNegation:
111
+ Enabled: false
112
+
113
+ Style/EachWithObject:
114
+ Enabled: false
115
+
116
+ Style/ElseAlignment:
117
+ Enabled: false
118
+
119
+ Style/EmptyElse:
120
+ Enabled: false
121
+
122
+ Style/EmptyLineBetweenDefs:
123
+ Enabled: false
124
+
125
+ Style/EmptyLines:
126
+ Enabled: false
127
+
128
+ Style/EmptyLinesAroundAccessModifier:
129
+ Enabled: false
130
+
131
+ Style/EmptyLinesAroundBlockBody:
132
+ Enabled: false
133
+
134
+ Style/EmptyLinesAroundClassBody:
135
+ Enabled: false
136
+
137
+ Style/EmptyLinesAroundModuleBody:
138
+ Enabled: false
139
+
140
+ Style/EmptyLinesAroundMethodBody:
141
+ Enabled: false
142
+
143
+ Style/EmptyLiteral:
144
+ Enabled: false
145
+
146
+ Style/EndBlock:
147
+ Enabled: false
148
+
149
+ Style/EndOfLine:
150
+ Enabled: false
151
+
152
+ Style/EvenOdd:
153
+ Enabled: false
154
+
155
+ Style/FileName:
156
+ Enabled: false
157
+
158
+ Style/FlipFlop:
159
+ Enabled: false
160
+
161
+ Style/For:
162
+ Enabled: false
163
+
164
+ Style/FormatString:
165
+ Enabled: false
166
+
167
+ Style/GlobalVars:
168
+ Enabled: false
169
+
170
+ Style/GuardClause:
171
+ Enabled: false
172
+
173
+ Style/HashSyntax:
174
+ Enabled: true
175
+
176
+ Style/IfUnlessModifier:
177
+ Enabled: false
178
+
179
+ Style/IfWithSemicolon:
180
+ Enabled: false
181
+
182
+ Style/IndentationConsistency:
183
+ Enabled: false
184
+
185
+ Style/IndentationWidth:
186
+ Enabled: false
187
+
188
+ Style/IndentArray:
189
+ Enabled: false
190
+
191
+ Style/IndentHash:
192
+ Enabled: false
193
+
194
+ Style/InfiniteLoop:
195
+ Enabled: false
196
+
197
+ Style/Lambda:
198
+ Enabled: false
199
+
200
+ Style/LambdaCall:
201
+ Enabled: false
202
+
203
+ Style/LeadingCommentSpace:
204
+ Enabled: false
205
+
206
+ Style/LineEndConcatenation:
207
+ Enabled: false
208
+
209
+ Style/MethodCallParentheses:
210
+ Enabled: true
211
+
212
+ Style/MethodDefParentheses:
213
+ Enabled: false
214
+
215
+ Style/MethodName:
216
+ Enabled: false
217
+
218
+ Style/ModuleFunction:
219
+ Enabled: false
220
+
221
+ Style/MultilineBlockChain:
222
+ Enabled: false
223
+
224
+ Style/MultilineBlockLayout:
225
+ Enabled: false
226
+
227
+ Style/MultilineIfThen:
228
+ Enabled: false
229
+
230
+ Style/MultilineOperationIndentation:
231
+ Enabled: false
232
+
233
+ Style/MultilineTernaryOperator:
234
+ Enabled: false
235
+
236
+ Style/NegatedIf:
237
+ Enabled: false
238
+
239
+ Style/NegatedWhile:
240
+ Enabled: false
241
+
242
+ Style/NestedTernaryOperator:
243
+ Enabled: false
244
+
245
+ Style/Next:
246
+ Enabled: false
247
+
248
+ Style/NilComparison:
249
+ Enabled: false
250
+
251
+ Style/NonNilCheck:
252
+ Enabled: false
253
+
254
+ Style/Not:
255
+ Enabled: false
256
+
257
+ Style/NumericLiterals:
258
+ Enabled: false
259
+
260
+ Style/OneLineConditional:
261
+ Enabled: false
262
+
263
+ Style/OpMethod:
264
+ Enabled: false
265
+
266
+ Style/ParenthesesAroundCondition:
267
+ Enabled: false
268
+
269
+ Style/PercentLiteralDelimiters:
270
+ Enabled: false
271
+
272
+ Style/PercentQLiterals:
273
+ Enabled: false
274
+
275
+ Style/PerlBackrefs:
276
+ Enabled: false
277
+
278
+ Style/PredicateName:
279
+ Enabled: false
280
+
281
+ Style/Proc:
282
+ Enabled: false
283
+
284
+ Style/RaiseArgs:
285
+ Enabled: false
286
+
287
+ Style/RedundantBegin:
288
+ Enabled: true
289
+
290
+ Style/RedundantException:
291
+ Enabled: true
292
+
293
+ Style/RedundantReturn:
294
+ Enabled: true
295
+
296
+ Style/RedundantSelf:
297
+ Enabled: true
298
+
299
+ Style/RegexpLiteral:
300
+ Enabled: false
301
+
302
+ Style/RescueModifier:
303
+ Enabled: false
304
+
305
+ Style/SelfAssignment:
306
+ Enabled: false
307
+
308
+ Style/Semicolon:
309
+ Enabled: false
310
+
311
+ Style/SignalException:
312
+ Enabled: false
313
+
314
+ Style/SingleLineBlockParams:
315
+ Enabled: true
316
+
317
+ Style/SingleLineMethods:
318
+ Enabled: true
319
+
320
+ Style/SpaceBeforeFirstArg:
321
+ Enabled: false
322
+
323
+ Style/SpaceAfterColon:
324
+ Enabled: true
325
+
326
+ Style/SpaceAfterComma:
327
+ Enabled: true
328
+
329
+ Style/SpaceAroundKeyword:
330
+ Enabled: true
331
+
332
+ Style/SpaceAfterMethodName:
333
+ Enabled: true
334
+
335
+ Style/SpaceAfterNot:
336
+ Enabled: true
337
+
338
+ Style/SpaceAfterSemicolon:
339
+ Enabled: true
340
+
341
+ Style/SpaceBeforeBlockBraces:
342
+ Enabled: false
343
+
344
+ Style/SpaceBeforeComma:
345
+ Enabled: false
346
+
347
+ Style/SpaceBeforeComment:
348
+ Enabled: false
349
+
350
+ Style/SpaceBeforeSemicolon:
351
+ Enabled: false
352
+
353
+ Style/SpaceInsideBlockBraces:
354
+ Enabled: true
355
+
356
+ Style/SpaceAroundEqualsInParameterDefault:
357
+ Enabled: true
358
+
359
+ Style/SpaceAroundOperators:
360
+ Enabled: true
361
+
362
+ Style/SpaceInsideBrackets:
363
+ Enabled: true
364
+
365
+ Style/SpaceInsideHashLiteralBraces:
366
+ Enabled: true
367
+
368
+ Style/SpaceInsideParens:
369
+ Enabled: true
370
+
371
+ Style/SpaceInsideRangeLiteral:
372
+ Enabled: false
373
+
374
+ Style/SpecialGlobalVars:
375
+ Enabled: false
376
+
377
+ Style/StringLiterals:
378
+ Enabled: false
379
+
380
+ Style/StringLiteralsInInterpolation:
381
+ Enabled: false
382
+
383
+ Style/SymbolProc:
384
+ Enabled: false
385
+
386
+ Style/Tab:
387
+ Enabled: true
388
+
389
+ Style/TrailingBlankLines:
390
+ Enabled: true
391
+
392
+ Style/TrailingCommaInArguments:
393
+ Enabled: true
394
+
395
+ Style/TrailingWhitespace:
396
+ Enabled: true
397
+
398
+ Style/TrivialAccessors:
399
+ Enabled: false
400
+
401
+ Style/UnlessElse:
402
+ Enabled: false
403
+
404
+ Style/UnneededCapitalW:
405
+ Enabled: false
406
+
407
+ Style/UnneededPercentQ:
408
+ Enabled: false
409
+
410
+ Style/VariableInterpolation:
411
+ Enabled: false
412
+
413
+ Style/VariableName:
414
+ Enabled: false
415
+
416
+ Style/WhenThen:
417
+ Enabled: false
418
+
419
+ Style/WhileUntilDo:
420
+ Enabled: false
421
+
422
+ Style/WhileUntilModifier:
423
+ Enabled: false
424
+
425
+ Style/WordArray:
426
+ Enabled: false
427
+
428
+ #################### Metrics ################################
429
+
430
+ Metrics/AbcSize:
431
+ Enabled: false
432
+
433
+ Metrics/BlockNesting:
434
+ Enabled: false
435
+
436
+ Metrics/ClassLength:
437
+ Enabled: false
438
+
439
+ Metrics/CyclomaticComplexity:
440
+ Enabled: false
441
+
442
+ Metrics/LineLength:
443
+ Enabled: false
444
+
445
+ Metrics/MethodLength:
446
+ Enabled: false
447
+
448
+ Metrics/ParameterLists:
449
+ Enabled: false
450
+
451
+ Metrics/PerceivedComplexity:
452
+ Enabled: false
453
+
454
+ #################### Lint ################################
455
+ ### Warnings
456
+
457
+ Lint/AmbiguousOperator:
458
+ Enabled: false
459
+
460
+ Lint/AmbiguousRegexpLiteral:
461
+ Enabled: false
462
+
463
+ Lint/AssignmentInCondition:
464
+ Enabled: false
465
+
466
+ Lint/BlockAlignment:
467
+ Enabled: false
468
+
469
+ Lint/ConditionPosition:
470
+ Enabled: false
471
+
472
+ Lint/Debugger:
473
+ Enabled: false
474
+
475
+ Lint/DefEndAlignment:
476
+ Enabled: false
477
+
478
+ Lint/DeprecatedClassMethods:
479
+ Enabled: false
480
+
481
+ Lint/ElseLayout:
482
+ Enabled: false
483
+
484
+ Lint/EmptyEnsure:
485
+ Enabled: false
486
+
487
+ Lint/EmptyInterpolation:
488
+ Enabled: false
489
+
490
+ Lint/EndAlignment:
491
+ Enabled: false
492
+
493
+ Lint/EndInMethod:
494
+ Enabled: false
495
+
496
+ Lint/EnsureReturn:
497
+ Enabled: false
498
+
499
+ Lint/Eval:
500
+ Enabled: false
501
+
502
+ Lint/HandleExceptions:
503
+ Enabled: false
504
+
505
+ Lint/InvalidCharacterLiteral:
506
+ Enabled: false
507
+
508
+ Lint/LiteralInCondition:
509
+ Enabled: false
510
+
511
+ Lint/LiteralInInterpolation:
512
+ Enabled: false
513
+
514
+ Lint/Loop:
515
+ Enabled: false
516
+
517
+ Lint/ParenthesesAsGroupedExpression:
518
+ Enabled: false
519
+
520
+ Lint/RequireParentheses:
521
+ Enabled: false
522
+
523
+ Lint/RescueException:
524
+ Enabled: false
525
+
526
+ Lint/ShadowingOuterLocalVariable:
527
+ Enabled: false
528
+
529
+ Lint/StringConversionInInterpolation:
530
+ Enabled: false
531
+
532
+ Lint/UnderscorePrefixedVariableName:
533
+ Enabled: false
534
+
535
+ Lint/UnusedBlockArgument:
536
+ Enabled: false
537
+
538
+ Lint/UnusedMethodArgument:
539
+ Enabled: false
540
+
541
+ Lint/UnreachableCode:
542
+ Enabled: false
543
+
544
+ Lint/UselessAccessModifier:
545
+ Enabled: false
546
+
547
+ Lint/UselessAssignment:
548
+ Enabled: false
549
+
550
+ Lint/UselessComparison:
551
+ Enabled: false
552
+
553
+ Lint/UselessElseWithoutRescue:
554
+ Enabled: false
555
+
556
+ Lint/UselessSetterCall:
557
+ Enabled: false
558
+
559
+ Lint/Void:
560
+ Enabled: false
561
+
562
+ ##################### Rails ##################################
563
+
564
+ Rails/ActionFilter:
565
+ Enabled: false
566
+
567
+ Rails/Delegate:
568
+ Enabled: false
569
+
570
+ Rails/HasAndBelongsToMany:
571
+ Enabled: false
572
+
573
+ Rails/Output:
574
+ Enabled: false
575
+
576
+ Rails/ReadWriteAttribute:
577
+ Enabled: false
578
+
579
+ Rails/ScopeArgs:
580
+ Enabled: false
581
+
582
+ Rails/Validation:
583
+ Enabled: false
@@ -0,0 +1,13 @@
1
+ module BookingSync
2
+ # style checking for booking sync projects
3
+ module Stylecheck
4
+ class << self
5
+ def root
6
+ Gem::Specification.find_by_name('bookingsync-stylecheck').gem_dir
7
+ end
8
+ end
9
+ end
10
+ end
11
+
12
+ require 'bookingsync/stylecheck/rubocop_helpers'
13
+ require 'bookingsync/stylecheck/railtie'
@@ -0,0 +1,11 @@
1
+ module BookingSync
2
+ module Stylecheck
3
+ # auto loading rake tasks
4
+ class Railtie < Rails::Railtie
5
+ rake_tasks do
6
+ rake_path = File.join(File.dirname(__FILE__), '../tasks/*.rake')
7
+ Dir[rake_path].each { |f| load f }
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ require 'fileutils'
2
+
3
+ module BookingSync
4
+ module Stylecheck
5
+ # helper to nicely update rubocop config
6
+ module RubocopHelpers
7
+ class << self
8
+ def config
9
+ File.join(BookingSync::Stylecheck.root, 'config', 'rubocop.yml')
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,30 @@
1
+ require 'fileutils'
2
+
3
+ namespace :style do
4
+ namespace :rubocop do
5
+ desc 'Run RuboCop with auto_correct'
6
+ task :with_auto_correct do
7
+ options = ['--rails', '--auto-correct']
8
+ options += ['--fail-level', 'refactor']
9
+ options += ['-c', BookingSync::Stylecheck::RubocopHelpers.config]
10
+ sh "bundle exec rubocop #{options.join(' ')}" do |ok, _res|
11
+ abort 'Fix code style errors' unless ok
12
+ end
13
+ end
14
+
15
+ desc 'Run RuboCop without auto_correct'
16
+ task :without_auto_correct do
17
+ options = ['--rails']
18
+ options += ['--fail-level', 'refactor']
19
+ options += ['-c', BookingSync::Stylecheck::RubocopHelpers.config]
20
+ sh "bundle exec rubocop #{options.join(' ')}" do |ok, _res|
21
+ abort 'Fix code style errors' unless ok
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ desc 'Check codestyle and fix common errors'
28
+ task :style do
29
+ Rake::Task['style:rubocop:with_auto_correct'].invoke
30
+ end
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bookingsync-stylecheck
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Piotr Marciniak
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rubocop
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.39.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.39.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: railties
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '4'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '4'
41
+ description: Wraps rubocop for simple and consisten experience
42
+ email: mandaryyyn@gmail.com
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files: []
46
+ files:
47
+ - MIT-LICENSE
48
+ - README.md
49
+ - config/rubocop.yml
50
+ - lib/bookingsync/stylecheck.rb
51
+ - lib/bookingsync/stylecheck/railtie.rb
52
+ - lib/bookingsync/stylecheck/rubocop_helpers.rb
53
+ - lib/bookingsync/tasks/rubocop.rake
54
+ homepage: http://gihub.com/BookingSync/bookingsync-stylecheck
55
+ licenses:
56
+ - MIT
57
+ metadata: {}
58
+ post_install_message:
59
+ rdoc_options: []
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ requirements: []
73
+ rubyforge_project:
74
+ rubygems_version: 2.4.8
75
+ signing_key:
76
+ specification_version: 4
77
+ summary: Automatic style check for bookingsync projects
78
+ test_files: []