mapotempo_rubocop 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3325e6acfd79be4e62d14b9f8e73f9b43d402600fca5d498f236d603ff6f98c7
4
+ data.tar.gz: bf5cbea947007f57366e141372ab626ba28fa08c9ffa2bf335cf6ab84345d14d
5
+ SHA512:
6
+ metadata.gz: 2bcb75cc25c79db891e20ed581962cd75c8b59e636a1c0ade63340578ac95cbad0d12925eefa86bff7e927df3ca3ddea24a22f2eebd2d49c9ca9657069113755
7
+ data.tar.gz: 3b90e434fa4bb308ff82d8a943feb01564333e09b9b4440378301497f31c90b17aabd7c9b8b41a9b348f362b2065834ccb0d474f262e0d206479160c9fb7027a
data/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # MapotempoRubocop
2
+ ![Test](https://github.com/Mapotempo/mapotempo_rubocop/actions/workflows/main.yml/badge.svg)
3
+ ![Deliver](https://github.com/Mapotempo/mapotempo_rubocop/actions/workflows/deliver.yml/badge.svg)
4
+
5
+ This is Mapotempo's rubocop rules for all its projects.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'mapotempo_rubocop', github: 'Mapotempo/mapotempo_rubocop'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+
20
+ Create a `.rubocop.yml` file at root of your project and add the following lines in it
21
+
22
+ ```yml
23
+ inherit_gem:
24
+ mapotempo_rubocop:
25
+ - rubocop-default.yml
26
+ ```
27
+
28
+ ---
29
+
30
+ Pour les utilisateurs de Sublime, aller dans `Preferences > Package Settings > Sublime Linter > Settings`
31
+ ```yml
32
+ {
33
+ "linters": {
34
+ "rubocop": {
35
+ "use_bundle_exec": true,
36
+ "env": {
37
+ "PATH": "~/.rbenv/shims:$PATH"
38
+ },
39
+ }
40
+ }
41
+ }
42
+ ```
43
+
44
+ Ajouter aussi le chemin exact du bundler. exemple : `~/.rbenv/shims/bundle`
45
+
46
+ ```yml
47
+ {
48
+ paths": {
49
+ "linux": ["~/npm_folder/bin", "~/.rbenv/shims", "~/.rbenv/shims/bundle"],
50
+ "osx": [],
51
+ "windows": []
52
+ },
53
+ }
54
+ ```
55
+ ---
56
+
57
+
58
+ ## License
59
+
60
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rake/testtask'
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << 'test'
8
+ t.libs << 'lib'
9
+ t.test_files = FileList['test/**/*_test.rb']
10
+ end
11
+
12
+ task default: :test
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MapotempoRubocop
4
+ VERSION = ENV['GEM_VERSION'] || '0.0.0'
5
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'mapotempo_rubocop/version'
4
+
5
+ module MapotempoRubocop
6
+ class Error < StandardError; end
7
+ end
data/rubocop-all.yml ADDED
@@ -0,0 +1,10 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.5
3
+ # Cop names are not displayed in offense messages by default. Change behavior
4
+ # by overriding DisplayCopNames, or by giving the -D/--display-cop-names
5
+ # option.
6
+ DisplayCopNames: true
7
+ # Style guide URLs are not displayed in offense messages by default. Change
8
+ # behavior by overriding DisplayStyleGuide, or by giving the
9
+ # -S/--display-style-guide option.
10
+ DisplayStyleGuide: false
@@ -0,0 +1,12 @@
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-minitest
4
+
5
+ inherit_from:
6
+ - rubocop-all.yml
7
+ - rubocop-layout.yml
8
+ - rubocop-lint.yml
9
+ - rubocop-metrics.yml
10
+ - rubocop-naming.yml
11
+ - rubocop-style.yml
12
+ - rubocop-performance.yml
@@ -0,0 +1,17 @@
1
+ Layout/LineLength:
2
+ Max: 120
3
+
4
+ Layout/SpaceBeforeBlockBraces:
5
+ Enabled: false
6
+
7
+ Layout/SpaceInsideHashLiteralBraces:
8
+ Enabled: false
9
+
10
+ Layout/FirstHashElementIndentation:
11
+ Enabled: false
12
+
13
+ Layout/FirstArrayElementIndentation:
14
+ Enabled: false
15
+
16
+ Layout/CommentIndentation:
17
+ Enabled: false
data/rubocop-lint.yml ADDED
@@ -0,0 +1,5 @@
1
+ Lint/RaiseException:
2
+ Enabled: true
3
+
4
+ Lint/StructNewOverride:
5
+ Enabled: true
@@ -0,0 +1,14 @@
1
+ Metrics/MethodLength:
2
+ Max: 30
3
+
4
+ Metrics/ClassLength:
5
+ Max: 1000
6
+
7
+ Metrics/AbcSize:
8
+ Enabled: false
9
+
10
+ Metrics/PerceivedComplexity:
11
+ Enabled: false
12
+
13
+ Metrics/CyclomaticComplexity:
14
+ Enabled: false
@@ -0,0 +1,2 @@
1
+ Naming/MethodParameterName:
2
+ Enabled: false
@@ -0,0 +1,47 @@
1
+ # Use `caller(n..n)` instead of `caller`.
2
+ Performance/Caller:
3
+ Enabled: false
4
+
5
+ # Use `casecmp` rather than `downcase ==`.
6
+ Performance/Casecmp:
7
+ Enabled: true
8
+
9
+ # Use `str.{start,end}_with?(x, ..., y, ...)` instead of
10
+ # `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
11
+ Performance/DoubleStartEndWith:
12
+ Enabled: true
13
+
14
+ # Use `Range#cover?` instead of `Range#include?`.
15
+ Performance/RangeInclude:
16
+ Enabled: true
17
+
18
+ # This cop identifies the use of a `&block` parameter and `block.call`
19
+ # where `yield` would do just as well.
20
+ Performance/RedundantBlockCall:
21
+ Enabled: true
22
+
23
+ # This cop identifies use of `Regexp#match` or `String#match in a context
24
+ # where the integral return value of `=~` would do just as well.
25
+ Performance/RedundantMatch:
26
+ Enabled: true
27
+
28
+ # This cop identifies places where `Hash#merge!` can be replaced by
29
+ # `Hash#[]=`.
30
+ Performance/RedundantMerge:
31
+ Enabled: true
32
+ MaxKeyValuePairs: 1
33
+
34
+ # Use `start_with?` instead of a regex match anchored to the beginning of a
35
+ # string.
36
+ Performance/StartWith:
37
+ Enabled: true
38
+
39
+ # Use `tr` instead of `gsub` when you are replacing the same number of
40
+ # characters. Use `delete` instead of `gsub` when you are deleting
41
+ # characters.
42
+ Performance/StringReplacement:
43
+ Enabled: true
44
+
45
+ # Checks for `.times.map` calls.
46
+ Performance/TimesMap:
47
+ Enabled: true
data/rubocop-style.yml ADDED
@@ -0,0 +1,62 @@
1
+ Style/AsciiComments:
2
+ Enabled: false
3
+
4
+ Style/Documentation:
5
+ Enabled: false
6
+
7
+ Style/BlockDelimiters:
8
+ Enabled: false
9
+
10
+ Style/MultilineBlockChain:
11
+ Enabled: false
12
+
13
+ Style/MultilineTernaryOperator:
14
+ Enabled: false
15
+
16
+ Style/DoubleNegation:
17
+ Enabled: false
18
+
19
+ Style/NegatedIf:
20
+ Enabled: false
21
+
22
+ Style/TrailingCommaInArrayLiteral:
23
+ Enabled: false
24
+
25
+ Style/TrailingCommaInHashLiteral:
26
+ Enabled: false
27
+
28
+ Style/TrailingCommaInArguments:
29
+ Enabled: false
30
+
31
+ Style/NumericLiterals:
32
+ Enabled: false
33
+
34
+ Style/IfUnlessModifier:
35
+ Enabled: false
36
+
37
+ Style/ClassAndModuleChildren:
38
+ Enabled: false
39
+
40
+ Style/RedundantSelf:
41
+ Enabled: false
42
+
43
+ Style/SymbolArray:
44
+ Enabled: false
45
+
46
+ Style/WordArray:
47
+ Enabled: false
48
+
49
+ Style/RaiseArgs:
50
+ EnforcedStyle: compact
51
+
52
+ Style/ParallelAssignment:
53
+ Enabled: false
54
+
55
+ Style/HashEachMethods:
56
+ Enabled: true
57
+
58
+ Style/HashTransformValues:
59
+ Enabled: true
60
+
61
+ Style/HashTransformKeys:
62
+ Enabled: true
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'test_helper'
4
+
5
+ class MapotempoRubocopTest < Minitest::Test
6
+ def test_that_it_has_a_version_number
7
+ refute_nil ::MapotempoRubocop::VERSION
8
+ end
9
+
10
+ def test_config_is_correct
11
+ parallel = ENV['RUBOCOP_PARALLEL'] || ENV['CI'] ? '--parallel' : nil
12
+ # parallel option could cause not to use rubocop from bundle
13
+ options = "#{parallel} -f c --config .rubocop.yml --fail-level E --display-only-fail-level-offenses"
14
+ cmd = "bundle exec rubocop ./* #{options}"
15
+ o = system(cmd, [:out, :err] => '/dev/null')
16
+ assert o, "New Rubocop offenses added to the project, run: #{cmd}"
17
+ end
18
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
4
+ require 'mapotempo_rubocop'
5
+
6
+ require 'minitest/autorun'
7
+ require 'byebug'
8
+ require 'minitest/focus'
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mapotempo_rubocop
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Valentin Le Guennec
8
+ - Yann Grégoire
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2021-04-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rubocop
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: 0.81.0
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: 0.81.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: rubocop-minitest
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: 0.8.1
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 0.8.1
42
+ - !ruby/object:Gem::Dependency
43
+ name: rubocop-performance
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: 1.5.2
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: 1.5.2
56
+ - !ruby/object:Gem::Dependency
57
+ name: bundler
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: 1.17.3
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: 1.17.3
70
+ - !ruby/object:Gem::Dependency
71
+ name: rake
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '10.0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '10.0'
84
+ description: Rubocop rules in mapotempo projects.
85
+ email:
86
+ - val.leguennec@gmail.com
87
+ - yann@mapotempo.com
88
+ executables: []
89
+ extensions: []
90
+ extra_rdoc_files: []
91
+ files:
92
+ - README.md
93
+ - Rakefile
94
+ - lib/mapotempo_rubocop.rb
95
+ - lib/mapotempo_rubocop/version.rb
96
+ - rubocop-all.yml
97
+ - rubocop-default.yml
98
+ - rubocop-layout.yml
99
+ - rubocop-lint.yml
100
+ - rubocop-metrics.yml
101
+ - rubocop-naming.yml
102
+ - rubocop-performance.yml
103
+ - rubocop-style.yml
104
+ - test/mapotempo_rubocop_test.rb
105
+ - test/test_helper.rb
106
+ homepage: https://mapotempo.com
107
+ licenses:
108
+ - MIT
109
+ metadata: {}
110
+ post_install_message:
111
+ rdoc_options: []
112
+ require_paths:
113
+ - lib
114
+ required_ruby_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ requirements: []
125
+ rubygems_version: 3.1.2
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: Mapotempo rubocop
129
+ test_files:
130
+ - test/mapotempo_rubocop_test.rb
131
+ - test/test_helper.rb