rubocop-require_tools 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b20ad6033b7915ee352db9db7b7cfbd6846fb73f
4
+ data.tar.gz: b3f218ecf1be560e74bf91d9353030025e835791
5
+ SHA512:
6
+ metadata.gz: f1f68429ee33c1fdab8b5db203a0b7ca4f1e70207b91f9d464e63e80ab34032fd37cbd0af83244a8ad6c654d97ed2ec192903976d7176da0d2e3dcd1deb86799
7
+ data.tar.gz: 44f066daa7fe75a92fb9e20f9469f8c138f141fe2716c9a95447642d730bf8422804bfc63fb23607e5a633326fd4714a899442465c9ebe0c4912acf04a3300bc
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ .DS_Store
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,38 @@
1
+ AllCops:
2
+ Exclude:
3
+ - spec/**/*
4
+ TargetRubyVersion: "2.1" # 2.0 doesn't work because rubocop dropped it
5
+
6
+ Style/RedundantSelf:
7
+ Enabled: false
8
+
9
+ Metrics/ClassLength:
10
+ Max: 500
11
+
12
+ # We're not living in the 90's anymore, people can deal with long lines
13
+ Metrics/LineLength:
14
+ Enabled: false
15
+
16
+ Metrics/MethodLength:
17
+ Enabled: false
18
+
19
+ Metrics/AbcSize:
20
+ Enabled: false
21
+
22
+ Metrics/BlockLength:
23
+ Enabled: false
24
+
25
+ Metrics/CyclomaticComplexity:
26
+ Enabled: false
27
+
28
+ Style/ClassCheck:
29
+ Enabled: false
30
+
31
+ Security/MarshalLoad:
32
+ Enabled: false
33
+
34
+ Style/RedundantReturn:
35
+ Enabled: false
36
+
37
+ Style/RescueModifier:
38
+ Enabled: false
@@ -0,0 +1,16 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.1
5
+ before_install: gem install bundler
6
+ install: bundle install --path vendor/bundle
7
+ script:
8
+ - bundle exec rake test
9
+ deploy:
10
+ provider: rubygems
11
+ api_key:
12
+ secure: KEY_HERE
13
+ gem: rubocop-require_tools
14
+ on:
15
+ branch: master
16
+ repo: milch/rubocop-require_tools
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at manu@supermil.ch. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in rubocop-require_tools.gemspec
6
+ gemspec
@@ -0,0 +1,57 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rubocop-require_tools (0.1.0)
5
+ rubocop (~> 0.49)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.3.0)
11
+ coderay (1.1.2)
12
+ diff-lcs (1.3)
13
+ method_source (0.9.0)
14
+ parallel (1.12.1)
15
+ parser (2.4.0.2)
16
+ ast (~> 2.3)
17
+ powerpack (0.1.1)
18
+ pry (0.11.3)
19
+ coderay (~> 1.1.0)
20
+ method_source (~> 0.9.0)
21
+ rainbow (3.0.0)
22
+ rake (10.5.0)
23
+ rspec (3.7.0)
24
+ rspec-core (~> 3.7.0)
25
+ rspec-expectations (~> 3.7.0)
26
+ rspec-mocks (~> 3.7.0)
27
+ rspec-core (3.7.1)
28
+ rspec-support (~> 3.7.0)
29
+ rspec-expectations (3.7.0)
30
+ diff-lcs (>= 1.2.0, < 2.0)
31
+ rspec-support (~> 3.7.0)
32
+ rspec-mocks (3.7.0)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.7.0)
35
+ rspec-support (3.7.0)
36
+ rubocop (0.52.1)
37
+ parallel (~> 1.10)
38
+ parser (>= 2.4.0.2, < 3.0)
39
+ powerpack (~> 0.1)
40
+ rainbow (>= 2.2.2, < 4.0)
41
+ ruby-progressbar (~> 1.7)
42
+ unicode-display_width (~> 1.0, >= 1.0.1)
43
+ ruby-progressbar (1.9.0)
44
+ unicode-display_width (1.3.0)
45
+
46
+ PLATFORMS
47
+ ruby
48
+
49
+ DEPENDENCIES
50
+ bundler (~> 1.16)
51
+ pry
52
+ rake (~> 10.0)
53
+ rspec (~> 3.0)
54
+ rubocop-require_tools!
55
+
56
+ BUNDLED WITH
57
+ 1.16.0
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Manu Wallner
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,39 @@
1
+ # Require tools for Rubocop
2
+
3
+ This is an extension for rubocop. It contains tools to analyze your code and work with require statements. Currently it will only check whether there are possibly any missing requires in your code.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'rubocop-require_tools'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Then, require this extension in your project's `.rubocop.yml`:
18
+
19
+ ```YAML
20
+ require: rubocop-require_tools
21
+ ```
22
+
23
+ ## Development
24
+
25
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
26
+
27
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
28
+
29
+ ## Contributing
30
+
31
+ Bug reports and pull requests are welcome on GitHub at https://github.com/milch/rubocop-require_tools. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
32
+
33
+ ## License
34
+
35
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
36
+
37
+ ## Code of Conduct
38
+
39
+ Everyone interacting in the rubocop-require_tools project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/rubocop-require_tools/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,12 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'rubocop/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec) do |task|
6
+ task.rspec_opts = '--format progress'
7
+ end
8
+ RuboCop::RakeTask.new(:rubocop)
9
+
10
+ task default: :test
11
+
12
+ task test: %i[spec rubocop]
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'rubocop/require_tools'
5
+ require 'pry'
6
+
7
+ PRY.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,234 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rubocop'
4
+ require_relative '../../helper/state'
5
+
6
+ module RuboCop
7
+ module Cop
8
+ module Require
9
+ # Checks for missing require statements in your code
10
+ #
11
+ # @example
12
+ # # bad
13
+ # Faraday.new
14
+ #
15
+ # # good
16
+ # require 'faraday'
17
+ #
18
+ # Faraday.new
19
+ class MissingRequireStatement < Cop
20
+ MSG = '`%<constant>s` not found, you\'re probably missing a require statement or there is a cycle in your dependencies.'.freeze
21
+
22
+ attr_writer :timeline
23
+
24
+ def timeline
25
+ @timeline ||= []
26
+ end
27
+
28
+ # Builds
29
+ def investigate(processed_source)
30
+ processing_methods = self.methods.select { |m| m.to_s.start_with? 'process_' }
31
+
32
+ stack = [processed_source.ast]
33
+ skip = Set.new
34
+ until stack.empty?
35
+ node = stack.pop
36
+ next unless node
37
+ results = processing_methods.map { |m| self.send(m, node, processed_source) }.compact
38
+
39
+ next if node.kind_of? Hash
40
+
41
+ to_skip, to_push = %i[skip push].map { |mode| results.flat_map { |r| r[mode] }.compact }
42
+
43
+ skip.merge(to_skip)
44
+
45
+ children_to_explore = node.children
46
+ .select { |c| c.kind_of? RuboCop::AST::Node }
47
+ .reject { |c| skip.include? c }
48
+ .reverse
49
+ stack.push(*to_push)
50
+ stack.push(*children_to_explore)
51
+ end
52
+
53
+ #
54
+ err_events = check_timeline(timeline).group_by { |e| e[:name] }.values
55
+ err_events.each do |events|
56
+ first = events.first
57
+ node = first[:node]
58
+ message = format(
59
+ MSG,
60
+ constant: first[:name]
61
+ )
62
+ add_offense(node, message: message)
63
+ end
64
+ end
65
+
66
+ def_node_matcher :extract_inner_const, <<-PATTERN
67
+ (const $!nil? _)
68
+ PATTERN
69
+
70
+ def_node_matcher :extract_const, <<-PATTERN
71
+ (const _ $_)
72
+ PATTERN
73
+
74
+ def find_consts(node)
75
+ inner = node
76
+ outer_const = extract_const(node)
77
+ return unless outer_const
78
+ consts = [outer_const]
79
+ while (inner = extract_inner_const(inner))
80
+ const = extract_const(inner)
81
+ consts << const
82
+ end
83
+ consts.reverse
84
+ end
85
+
86
+ def process_const(node, _source)
87
+ return unless node.kind_of? RuboCop::AST::Node
88
+ consts = find_consts(node)
89
+ return unless consts
90
+ const_name = consts.join('::')
91
+
92
+ self.timeline << { event: :const_access, name: const_name, node: node }
93
+
94
+ { skip: node.children }
95
+ end
96
+
97
+ def_node_matcher :extract_const_assignment, <<-PATTERN
98
+ (casgn nil? $_ ...)
99
+ PATTERN
100
+
101
+ def process_const_assign(node, _source)
102
+ const_assign_name = extract_const_assignment(node)
103
+ return unless const_assign_name
104
+
105
+ self.timeline << { event: :const_assign, name: const_assign_name }
106
+
107
+ { skip: node.children }
108
+ end
109
+
110
+ def_node_matcher :is_module_or_class?, <<-PATTERN
111
+ ({module class} ...)
112
+ PATTERN
113
+
114
+ def_node_matcher :has_superclass?, <<-PATTERN
115
+ (class (const ...) (const ...) ...)
116
+ PATTERN
117
+
118
+ def process_definition(node, _source)
119
+ if node.kind_of? Hash
120
+ self.timeline << node
121
+ return
122
+ end
123
+
124
+ return unless is_module_or_class?(node)
125
+ name = find_consts(node.children.first).join('::')
126
+ inherited = find_consts(node.children[1]).join('::') if has_superclass?(node)
127
+
128
+ # Inheritance technically has to happen before the actual class definition
129
+ self.timeline << { event: :const_inherit, name: inherited, node: node } if inherited
130
+
131
+ self.timeline << { event: :const_def, name: name }
132
+
133
+ # First child is the module/class name => skip or it'll be picked up by `process_const`
134
+ skip_list = [node.children.first]
135
+ skip_list << node.children[1] if inherited
136
+
137
+ push_list = []
138
+ push_list << { event: :const_undef, name: name }
139
+
140
+ { skip: skip_list, push: push_list }
141
+ end
142
+
143
+ def_node_matcher :extract_require, <<-PATTERN
144
+ (send nil? ${:require :require_relative} (str $_))
145
+ PATTERN
146
+
147
+ def process_require(node, source)
148
+ return unless node.kind_of? RuboCop::AST::Node
149
+ required = extract_require(node)
150
+ return unless required && required.length == 2
151
+ method, file = required
152
+ self.timeline << { event: method, file: file, path: source.path }
153
+
154
+ { skip: node.children }
155
+ end
156
+
157
+ private
158
+
159
+ # Returns the problematic events from the timeline, i.e. those for which a require might be missing
160
+ def check_timeline(timeline)
161
+ return [] unless Process.respond_to?(:fork)
162
+
163
+ # To avoid having to marshal/unmarshal the nodes, the fork will just return indices with an error
164
+ err_indices = perform_in_fork do
165
+ state = RuboCop::RequireTools::State.new
166
+ err_indices = []
167
+ timeline.each_with_index do |event, i|
168
+ case event[:event]
169
+ when :require
170
+ state.require(file: event[:file])
171
+ when :require_relative
172
+ path_to_investigated_file = event[:path]
173
+ relative_path = File.expand_path(File.join(File.dirname(path_to_investigated_file), event[:file]))
174
+ state.require_relative(relative_path: relative_path)
175
+ when :const_access
176
+ err_indices << i unless state.access_const(const_name: event[:name])
177
+ when :const_def
178
+ state.define_const(const_name: event[:name])
179
+
180
+ outdated = outdated_errors(err_indices.map { |e| timeline[e] }, state)
181
+ err_indices = err_indices.reject { |e| outdated.include?(timeline[e]) }
182
+ when :const_undef
183
+ state.undefine_const(const_name: event[:name])
184
+ when :const_assign
185
+ state.const_assigned(const_name: event[:name])
186
+
187
+ previous_errors = err_indices.map { |e| timeline[e] }
188
+ outdated = outdated_errors(previous_errors, state)
189
+ err_indices = err_indices.reject { |e| outdated.include?(timeline[e]) }
190
+ when :const_inherit
191
+ success = state.access_const(const_name: event[:name])
192
+ if success
193
+ state.define_const(const_name: event[:name], is_part_of_stack: false)
194
+ else
195
+ err_indices << i
196
+ end
197
+ end
198
+ end
199
+ err_indices
200
+ end
201
+
202
+ err_indices.map { |i| timeline[i] }
203
+ end
204
+
205
+ def outdated_errors(error_events, state)
206
+ error_events
207
+ .select { |e| %i[const_access const_inherit].include? e[:event] } # Only these types can be resolved by definitions later in the file
208
+ .select { |e| state.access_const(const_name: e[:name], local_only: true) }
209
+ end
210
+
211
+ def perform_in_fork
212
+ r, w = IO.pipe
213
+
214
+ # The close statements are as they are used in the IO#pipe documentation
215
+ pid = Process.fork do
216
+ r.close
217
+ result = yield
218
+ Marshal.dump(result, w)
219
+ w.close
220
+ end
221
+
222
+ w.close
223
+ result = Marshal.load(r)
224
+ r.close
225
+ _, status = Process.waitpid2(pid)
226
+
227
+ raise 'An error occured while forking' unless status.to_i.zero?
228
+
229
+ return result
230
+ end
231
+ end
232
+ end
233
+ end
234
+ end
@@ -0,0 +1,73 @@
1
+ module RuboCop
2
+ module RequireTools
3
+ # Contains current state of an inspected file
4
+ class State
5
+ attr_accessor :defined_constants
6
+ attr_accessor :const_stack
7
+
8
+ def initialize
9
+ self.defined_constants = []
10
+ self.const_stack = []
11
+ end
12
+
13
+ def require(file: nil)
14
+ Kernel.require(file)
15
+ rescue NameError, LoadError => ex
16
+ puts "Note: Could not load #{file}:"
17
+ puts ex.message
18
+ puts 'Check your dependencies, they could be circular'
19
+ end
20
+
21
+ def require_relative(relative_path: nil)
22
+ Kernel.require_relative(relative_path)
23
+ rescue NameError, LoadError => ex
24
+ puts "Note: Could not load relative file #{relative_path}:"
25
+ puts ex.message
26
+ puts 'Check your dependencies, they could be circular'
27
+ end
28
+
29
+ def access_const(const_name: nil, local_only: false)
30
+ name = const_name.to_s.sub(/^:*/, '').sub(/:*$/, '') # Strip leading/trailing ::
31
+
32
+ # If const_stack is ["A", "B", "C"] all of A, A::B, A::B::C are valid lookup combinations
33
+ prefixes = self.const_stack.reduce([]) { |a, c| a << [a.last, c].compact.join('::') }
34
+
35
+ # I use const_get here because in testing const_get and const_defined? have yielded different results
36
+ unless local_only
37
+ result = Object.const_get(name) rescue nil # Defined elsewhere, top-level
38
+ result ||= self.defined_constants.find { |c| Object.const_get("#{c}::#{name}") rescue nil } # Defined elsewhere, nested
39
+ end
40
+
41
+ result ||= self.defined_constants.find { |c| name == c } # Defined in this file, other module/class
42
+ prefixes.each do |prefix|
43
+ result ||= self.defined_constants.find { |c| [name, "#{prefix}::#{name}"].include? c } # Defined in this file, other module/class
44
+ result ||= prefix == name # Defined in this file, in current module/class
45
+ end
46
+
47
+ return result
48
+ end
49
+
50
+ def define_const(const_name: nil, is_part_of_stack: true)
51
+ new = []
52
+ self.defined_constants.each do |c|
53
+ found = Object.const_get("#{c}::#{const_name}") rescue nil
54
+ new << found.to_s if found
55
+ end
56
+ self.defined_constants.push(*new)
57
+ self.const_stack.push(const_name) if is_part_of_stack
58
+ self.defined_constants.push(const_name.to_s, self.const_stack.join('::'))
59
+ self.defined_constants.uniq!
60
+ end
61
+
62
+ def undefine_const(const_name: nil) # rubocop:disable Lint/UnusedMethodArgument
63
+ self.const_stack.pop
64
+ end
65
+
66
+ def const_assigned(const_name: nil)
67
+ full_name = (self.const_stack + [const_name]).join('::')
68
+ self.defined_constants << full_name
69
+ self.defined_constants.uniq!
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,2 @@
1
+ require_relative 'require_tools/version'
2
+ require_relative 'cop/require/missing_require_statement'
@@ -0,0 +1,5 @@
1
+ module RuboCop
2
+ module RequireTools
3
+ VERSION = '0.1.0'.freeze
4
+ end
5
+ end
@@ -0,0 +1,36 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'rubocop/require_tools/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'rubocop-require_tools'
7
+ spec.version = RuboCop::RequireTools::VERSION
8
+ spec.authors = ['Manu Wallner']
9
+ spec.email = ['manu@supermil.ch']
10
+
11
+ spec.summary = 'Checks require statements in your code'
12
+ spec.description = <<-DESC.gsub(/^\s\s/, '')
13
+ Available Cops in this extension:
14
+
15
+ - MissingRequireStatement:
16
+ Missing require statements can cause implicit dependencies in your projects that are error prone and hard to maintain.
17
+ DESC
18
+
19
+ spec.homepage = 'https://github.com/milch/rubocop-require_tools'
20
+ spec.license = 'MIT'
21
+
22
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
23
+ f.match(%r{^(test|spec|features)/})
24
+ end
25
+ spec.bindir = 'exe'
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ['lib']
28
+
29
+ spec.add_runtime_dependency 'rubocop', '~> 0.49'
30
+
31
+ spec.add_development_dependency 'pry'
32
+
33
+ spec.add_development_dependency 'bundler', '~> 1.16'
34
+ spec.add_development_dependency 'rake', '~> 10.0'
35
+ spec.add_development_dependency 'rspec', '~> 3.0'
36
+ end
metadata ADDED
@@ -0,0 +1,134 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubocop-require_tools
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Manu Wallner
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-01-08 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.49'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.49'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.16'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.16'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ description: |
84
+ Available Cops in this extension:
85
+ - MissingRequireStatement:
86
+ Missing require statements can cause implicit dependencies in your projects that are error prone and hard to maintain.
87
+ email:
88
+ - manu@supermil.ch
89
+ executables: []
90
+ extensions: []
91
+ extra_rdoc_files: []
92
+ files:
93
+ - ".gitignore"
94
+ - ".rspec"
95
+ - ".rubocop.yml"
96
+ - ".travis.yml"
97
+ - CODE_OF_CONDUCT.md
98
+ - Gemfile
99
+ - Gemfile.lock
100
+ - LICENSE.txt
101
+ - README.md
102
+ - Rakefile
103
+ - bin/console
104
+ - bin/setup
105
+ - lib/rubocop/cop/require/missing_require_statement.rb
106
+ - lib/rubocop/helper/state.rb
107
+ - lib/rubocop/require_tools.rb
108
+ - lib/rubocop/require_tools/version.rb
109
+ - rubocop-require_tools.gemspec
110
+ homepage: https://github.com/milch/rubocop-require_tools
111
+ licenses:
112
+ - MIT
113
+ metadata: {}
114
+ post_install_message:
115
+ rdoc_options: []
116
+ require_paths:
117
+ - lib
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ requirements: []
129
+ rubyforge_project:
130
+ rubygems_version: 2.6.11
131
+ signing_key:
132
+ specification_version: 4
133
+ summary: Checks require statements in your code
134
+ test_files: []