bundler-why 0.1.0 → 0.1.1

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: ac50c4e539f7928944ee960faba8a98ceb9eb3f5ca06135efd684f385e81b420
4
- data.tar.gz: b93ed4b008830ff44fc8138568cf6ec33fe345164eb93e1c765ecfdea6a47553
3
+ metadata.gz: 585f389134eb3e8429d975a06f6c65496cc072a37b23aeb566596c11a400cfcf
4
+ data.tar.gz: f065ca1abfb2d665e99bd6a7cb84fc1ba6ac67ff9a84484a5dc362a2a471c9f0
5
5
  SHA512:
6
- metadata.gz: 6146c6debba323e2325ff5000a99e15dc3434669bfab9a83354928e7cfdf15bc9be50847bda681a3158e73b99d26047b944af78bc71019ce77b7fbe8e1b8377d
7
- data.tar.gz: 0561dc31c1f1567c1d806045471f827ff08a55c40d404dc263cc09116e5aef51d38ee9c970817bd18101ba83bb7632b8ad3c77f53e5b3b831c36545804e51659
6
+ metadata.gz: 936c971ad9b6eea628962946d2482fcc453657a2ec46b110105e27837fb5da4649528ab1b33d326f679db68340b9b574a498899d1fd8597cecd330c2658f1b35
7
+ data.tar.gz: 47359fe1a40e95dab89aa4ce61ddee7bf18411f510cf16f7eece01c5724d89f3b4df5c8de7b6d9efbc3203afb8c358b688b86aaa1e1dc159b8557b62dc98bfc7
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ Gemfile.lock
1
2
  /.bundle/
2
3
  /.yardoc
3
4
  /_yardoc/
@@ -0,0 +1,344 @@
1
+ Layout/ArgumentAlignment:
2
+ EnforcedStyle: with_fixed_indentation
3
+
4
+ # Used consistently, both leading and trailing styles are valid, but
5
+ # Singlebrook happens to use the trailing style.
6
+ Layout/DotPosition:
7
+ EnforcedStyle: trailing
8
+
9
+ Layout/EmptyLineAfterGuardClause:
10
+ Enabled: false
11
+
12
+ # This cop has a bug in 0.52.0
13
+ # https://github.com/bbatsov/rubocop/issues/5224
14
+ Layout/EmptyLinesAroundArguments:
15
+ Enabled: false
16
+
17
+ Layout/EmptyLinesAroundAttributeAccessor:
18
+ Enabled: true
19
+
20
+ # Indent arrays so that the first element is relative to the first position of
21
+ # the line where the opening bracket is.
22
+ Layout/FirstArrayElementIndentation:
23
+ EnforcedStyle: consistent
24
+
25
+ Layout/LineLength:
26
+ Max: 100
27
+
28
+ # In a multiline method call, put the closing parenthesis on its own line.
29
+ # The first argument may either be on the first line, or the second. Both of the
30
+ # following are correct:
31
+ #
32
+ # ```
33
+ # # A. correct
34
+ # create(:user,
35
+ # client: foo,
36
+ # long_line: blah
37
+ # )
38
+ #
39
+ # # B. also correct
40
+ # create(
41
+ # :user,
42
+ # client: foo,
43
+ # long_line: blah
44
+ # )
45
+ #
46
+ # # C. not preferred
47
+ # user = create :user,
48
+ # client: foo,
49
+ # long_line: blah
50
+ # ```
51
+ #
52
+ # Rubocop supports B, but not A. This project allows both, so this cop is
53
+ # disabled.
54
+ Layout/MultilineMethodCallBraceLayout:
55
+ Enabled: false
56
+
57
+ Layout/MultilineMethodCallIndentation:
58
+ EnforcedStyle: indented
59
+
60
+ Layout/MultilineOperationIndentation:
61
+ EnforcedStyle: indented
62
+
63
+ Layout/ParameterAlignment:
64
+ EnforcedStyle: with_fixed_indentation
65
+
66
+ # This cop has a bug in 0.83.0
67
+ # https://github.com/rubocop-hq/rubocop/issues/7962
68
+ Lint/ParenthesesAsGroupedExpression:
69
+ Exclude:
70
+ - app/autoload/compliance/programs/pre_qar_to_qar/preconditions.rb
71
+
72
+ Layout/SpaceAroundMethodCallOperator:
73
+ Enabled: true
74
+
75
+ Lint/DeprecatedOpenSSLConstant:
76
+ Enabled: true
77
+
78
+ Lint/MixedRegexpCaptureTypes:
79
+ Enabled: true
80
+
81
+ Lint/RaiseException:
82
+ Enabled: true
83
+
84
+ # Sometimes splat is convenient, sometimes unnecessary. Too subtle to lint.
85
+ Lint/RedundantSplatExpansion:
86
+ Enabled: false
87
+
88
+ Lint/StructNewOverride:
89
+ Enabled: true
90
+
91
+ Metrics/AbcSize:
92
+ Exclude:
93
+ - 'db/migrate/*'
94
+ - 'spec/support/assemblies/**/*'
95
+
96
+ # Compared to metrics like `AbcSize` or `CyclomaticComplexity`, number of
97
+ # lines is not a useful metric.
98
+ Metrics/ClassLength:
99
+ Enabled: false
100
+
101
+ # Compared to metrics like `AbcSize` or `CyclomaticComplexity`, number of
102
+ # lines is not a useful metric.
103
+ Metrics/BlockLength:
104
+ Enabled: false
105
+
106
+ # Compared to metrics like `AbcSize` or `CyclomaticComplexity`, the number of
107
+ # lines in a method is not a useful metric. It's common to have very long
108
+ # methods (> 50 lines) which are quite simple. For example, a method that
109
+ # returns a long string with only a few interpolations.
110
+ Metrics/MethodLength:
111
+ Enabled: false
112
+
113
+ # Compared to metrics like `AbcSize` or `CyclomaticComplexity`, the number of
114
+ # lines in a module is not a useful metric.
115
+ Metrics/ModuleLength:
116
+ Enabled: false
117
+
118
+ # Too strict. Not all methods named `set_x` would make sense named `x=`.
119
+ Naming/AccessorMethodName:
120
+ Enabled: false
121
+
122
+ # It is a decades-old convention to use EOS as a heredoc delimiter. There is
123
+ # not enough value in changinge this convention. SQL should still be used as
124
+ # a delimiter when appropriate.
125
+ Naming/HeredocDelimiterNaming:
126
+ Enabled: false
127
+
128
+ # It is reasonable to use mathematical symbols in comments, or to relish what
129
+ # little multilingualism we have in America by using native spellings, like
130
+ # "façade" or "naïve".
131
+ Style/AsciiComments:
132
+ Enabled: false
133
+
134
+ # Giving the ivar a leading underscore implies that it should not be
135
+ # set/referencd outside of the memoization method.
136
+ Naming/MemoizedInstanceVariableName:
137
+ EnforcedStyleForLeadingUnderscores: required
138
+
139
+ # Sometimes two chars, or even one, is acceptable.
140
+ Naming/MethodParameterName:
141
+ Enabled: false
142
+
143
+ # Use numbers wherever you like in your variables. Who cares.
144
+ Naming/VariableNumber:
145
+ Enabled: false
146
+
147
+ # safe_load is necessary for end-user input, and unnecessary for files
148
+ # written by devs. The export config, for example, is written by devs.
149
+ Security/YAMLLoad:
150
+ Exclude:
151
+ - 'app/services/clients/exporter.rb'
152
+
153
+ # Use the semantic style. If a block has side effects use `do`, and if it is
154
+ # pure use `{}`. This style is too nuanced for a linter, so the cop is
155
+ # disabled.
156
+ Style/BlockDelimiters:
157
+ Enabled: false
158
+
159
+ Style/ClassAndModuleChildren:
160
+ EnforcedStyle: nested
161
+
162
+ Style/Documentation:
163
+ Exclude:
164
+ - 'test/**/*'
165
+
166
+ # Use double negation wherever it would otherwise be impractical to convert
167
+ # a value to an actual boolean.
168
+ Style/DoubleNegation:
169
+ Enabled: false
170
+
171
+ Style/EmptyElse:
172
+ EnforcedStyle: empty
173
+
174
+ Style/EmptyMethod:
175
+ EnforcedStyle: expanded
176
+
177
+ Style/ExponentialNotation:
178
+ Enabled: false
179
+
180
+ # Concerns:
181
+ # 1. In 0.52.0, this complains about `strftime('%x')`. Annotating tokens in
182
+ # e.g. strftime would just be duplicating documenation.
183
+ # 2. Annotating tokens in long format strings could make such lines very long.
184
+ # 3. Annotation is not necessary in format strings with small numbers of tokens.
185
+ Style/FormatStringToken:
186
+ Enabled: false
187
+
188
+ # The decision of when to use a guard clause is too nuanced for a linter.
189
+ Style/GuardClause:
190
+ Enabled: false
191
+
192
+ # `hash.keys.each` is totally fine.
193
+ Style/HashEachMethods:
194
+ Enabled: false
195
+
196
+ Style/HashTransformKeys:
197
+ Enabled: true
198
+
199
+ Style/HashTransformValues:
200
+ Enabled: true
201
+
202
+ # Avoid postfix (aka. modifier) conditional operator, except on the simplest
203
+ # of lines. This is too nuanced for a linter.
204
+ Style/IfUnlessModifier:
205
+ Enabled: false
206
+
207
+ # When using a multiline proc in a hash (eg. `validates`), I don't want to use
208
+ # lambda because then I'd have commas immediately after the "end", like `end,`.
209
+ Style/Lambda:
210
+ Enabled: false
211
+
212
+ # There is a known issue with `MixinGrouping` in rubocop 0.48.0
213
+ # https://github.com/bbatsov/rubocop/issues/4172
214
+ Style/MixinGrouping:
215
+ Enabled: false
216
+
217
+ # Disabled, because we like to write tests like:
218
+ #
219
+ # expect(
220
+ # foo :bar, :baz
221
+ # ).to # whatever
222
+ #
223
+ # When there's only one argument, and it's on its own line, there's no problem.
224
+ Style/NestedParenthesizedCalls:
225
+ Enabled: false
226
+
227
+ Style/Next:
228
+ MinBodyLength: 5 # The default of 3 is too low for my taste.
229
+
230
+ # This is a new cop in rubocop 0.41, and I'm not sure if I want to adopt it yet.
231
+ Style/NumericLiteralPrefix:
232
+ Enabled: false
233
+
234
+ # Use `x > 0` because it is more specific than `x.positive?`.
235
+ # However, `x.zero?` is acceptable because it is specific enough.
236
+ Style/NumericPredicate:
237
+ Enabled: false
238
+
239
+ # This cop complains about lovely things like:
240
+ # `gsub(/(\w*)/) { $1.capitalize }`
241
+ # I wouldn't want to write this differently.
242
+ Style/PerlBackrefs:
243
+ Enabled: false
244
+
245
+ Style/RedundantFetchBlock:
246
+ Enabled: true
247
+
248
+ Style/RedundantRegexpCharacterClass:
249
+ Enabled: true
250
+
251
+ # Disabled because it has a bug in 0.85.0
252
+ # https://github.com/rubocop-hq/rubocop/pull/8073
253
+ Style/RedundantRegexpEscape:
254
+ Enabled: false
255
+
256
+ # The decision of when to use slashes `/foo/` or percent-r `%r{foo}` is too
257
+ # subtle to lint. Use whichever requires fewer backslash escapes.
258
+ Style/RegexpLiteral:
259
+ Enabled: false
260
+
261
+ # Disabled because it is overzealous in 0.50.0.
262
+ # https://github.com/bbatsov/rubocop/issues/4731
263
+ Style/SafeNavigation:
264
+ Enabled: false
265
+
266
+ # The new recommendation to use `acc` and `elem` instead of `a` and `e` is fine,
267
+ # if someone wants to change it. For now, it's fine to keep `a` and `e`.
268
+ Style/SingleLineBlockParams:
269
+ Methods:
270
+ - reduce:
271
+ - a
272
+ - e
273
+ - inject:
274
+ - a
275
+ - e
276
+
277
+ Style/SlicingWithRange:
278
+ Enabled: true
279
+
280
+ # This cop wants us to use `warn` instead of `$stderr.puts` but that change
281
+ # would be neither compatible nor desirable.
282
+ # https://github.com/bbatsov/rubocop/issues/4888
283
+ Style/StderrPuts:
284
+ Enabled: false
285
+
286
+ # Use `%i[]` symbol arrays frequently, they are often good. Too subtle to lint,
287
+ # though.
288
+ Style/SymbolArray:
289
+ Enabled: false
290
+
291
+ Style/SymbolProc:
292
+ Exclude:
293
+ # cancan 3.0.0 has a bug that prevents us from using symbol-to-proc
294
+ # https://github.com/CanCanCommunity/cancancan/issues/584
295
+ - app/autoload/abilities/universal.rb
296
+
297
+ Style/TernaryParentheses:
298
+ EnforcedStyle: require_parentheses_when_complex
299
+
300
+ # This cop has a bug in rubocop 0.62.0:
301
+ # https://github.com/rubocop-hq/rubocop/issues/6627
302
+ Style/TrailingCommaInArguments:
303
+ Enabled: false
304
+
305
+ # Predicate methods, aka. question-mark methods, such as `def x?; @x; end` are
306
+ # acceptable. See https://github.com/bbatsov/rubocop/issues/2736 for discussion.
307
+ Style/TrivialAccessors:
308
+ AllowPredicates: true
309
+
310
+ # Avoid postfix loops (e.g. `x until y`) except in utterly simple situations.
311
+ # This is too nuanced for a linter.
312
+ Style/WhileUntilModifier:
313
+ Enabled: false
314
+
315
+ # `%w` is good, and should be used often, but it's too subtle to lint.
316
+ # Consider the following:
317
+ #
318
+ # ```ruby
319
+ # MODULE_ACTIVENESS = [
320
+ # ['All Modules', ''],
321
+ # ['Active', 'true'],
322
+ # ['Inactive', 'false']
323
+ # ].freeze
324
+ # ```
325
+ #
326
+ # We can't use `%w` on the first option, therefore we don't want to use it on
327
+ # the subsequent options.
328
+ Style/WordArray:
329
+ Enabled: false
330
+
331
+ # We would like to use this cop, but it doesn't work in 0.49.
332
+ Style/YodaCondition:
333
+ Enabled: false
334
+
335
+ # Consider A and B below. A is more like normal English than B.
336
+ #
337
+ # ```
338
+ # # A
339
+ # qar_modules.length > 0 || question_assignments.length > 0
340
+ # # B
341
+ # !qar_modules.empty? || !question_assignments.empty?
342
+ # ```
343
+ Style/ZeroLengthPredicate:
344
+ Enabled: false
@@ -0,0 +1,14 @@
1
+ # Changelog
2
+
3
+ This project follows [semver 2.0.0](http://semver.org/spec/v2.0.0.html) and the
4
+ recommendations of [keepachangelog.com](http://keepachangelog.com/).
5
+
6
+ ## 0.1.1
7
+
8
+ ### Fixed
9
+
10
+ - Remove accidental `require` of debugger
11
+
12
+ ## 0.1.0
13
+
14
+ Initial release
@@ -18,7 +18,7 @@ To test a change, in the first tab I make a WIP commit then in the second tab I
18
18
  ```
19
19
  rm -rf /Users/jared/git/banana/.bundle/plugin
20
20
  bundler plugin install bundler-why \
21
- --git file:///Users/jared/git/bundler-why \
21
+ --git file:///Users/jared/git/bundler-why --branch trunk \
22
22
  --verbose --retry=1
23
23
  bundle why tzinfo
24
24
  ```
data/Gemfile CHANGED
@@ -1,7 +1,9 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in bundler-why.gemspec
4
6
  gemspec
5
7
 
6
- gem "rake", "~> 12.0"
7
- gem "minitest", "~> 5.0"
8
+ gem 'minitest', '~> 5.0'
9
+ gem 'rubocop', '~> 0.86.0'
data/LICENSE.md CHANGED
@@ -12,7 +12,7 @@ We build software to further this vision of a just world, or at the very least,
12
12
 
13
13
  **Terms**
14
14
 
15
- *Copyright* (c) *(year)* *(owner)*. All rights reserved.
15
+ *Copyright* (c) *(2020)* *(Jared Beck)*. All rights reserved.
16
16
  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
17
17
 
18
18
  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
data/README.md CHANGED
@@ -12,7 +12,7 @@ business_time -> tzinfo
12
12
 
13
13
  ## License
14
14
 
15
- [Do No Harm License][LICENSE.md]
15
+ [Do No Harm License](LICENSE.md)
16
16
 
17
17
  By using this software you accept the terms of the license.
18
18
 
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "bundler/why"
4
+ require 'bundler/setup'
5
+ require 'bundler/why'
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
7
8
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +11,5 @@ require "bundler/why"
10
11
  # require "pry"
11
12
  # Pry.start
12
13
 
13
- require "irb"
14
+ require 'irb'
14
15
  IRB.start(__FILE__)
data/bin/test CHANGED
@@ -1,3 +1,4 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
+ bundle exec rubocop
3
4
  ruby -I test test/bundler/why_test.rb
@@ -1,21 +1,23 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'lib/bundler/why/version'
2
4
 
3
5
  Gem::Specification.new do |spec|
4
- spec.name = "bundler-why"
6
+ spec.name = 'bundler-why'
5
7
  spec.licenses = ['Nonstandard']
6
8
  spec.version = ::Bundler::Why.gem_version.to_s
7
- spec.authors = ["Jared Beck"]
8
- spec.email = ["jared@jaredbeck.com"]
9
+ spec.authors = ['Jared Beck']
10
+ spec.email = ['jared@jaredbeck.com']
9
11
  spec.summary = 'Explains the presence of a dependency.'
10
12
  spec.homepage = 'https://github.com/jaredbeck/bundler-why'
11
- spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
12
- spec.metadata["homepage_uri"] = spec.homepage
13
- spec.metadata["source_code_uri"] = spec.homepage
14
- spec.metadata["changelog_uri"] = spec.homepage
15
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
13
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
14
+ spec.metadata['homepage_uri'] = spec.homepage
15
+ spec.metadata['source_code_uri'] = spec.homepage
16
+ spec.metadata['changelog_uri'] = spec.homepage
17
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
16
18
  `git ls-files -z`.
17
19
  split("\x0").
18
20
  reject { |f| f.match(%r{^(test|spec|features)/}) }
19
21
  end
20
- spec.require_paths = ["lib"]
22
+ spec.require_paths = ['lib']
21
23
  end
@@ -1,5 +1,7 @@
1
- require "bundler/why/command"
2
- require "bundler/why/version"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/why/command'
4
+ require 'bundler/why/version'
3
5
 
4
6
  module Bundler
5
7
  module Why
@@ -1,12 +1,12 @@
1
- require 'byebug'
2
- $stdout.sync = true
1
+ # frozen_string_literal: true
3
2
 
4
3
  module Bundler
5
4
  module Why
5
+ # Registers and defines the `why` command.
6
6
  class Command < ::Bundler::Plugin::API
7
- command "why"
7
+ command 'why'
8
8
 
9
- def exec(command, args)
9
+ def exec(_command, args)
10
10
  if args.length == 1
11
11
  why(args.first)
12
12
  else
@@ -16,18 +16,11 @@ module Bundler
16
16
 
17
17
  private
18
18
 
19
- # `Bundler.load` is a memoized method, so it's OK if we call it a few
20
- # times.
21
- # @return Bundler::Runtime
22
- def runtime
23
- Bundler.load
24
- end
25
-
26
19
  # @param spec_set Bundler::SpecSet
27
20
  # @param gem_name String
28
21
  # @return Bundler::StubSpecification
29
22
  def find_one_spec_in_set(spec_set, gem_name)
30
- specs = runtime.specs[gem_name]
23
+ specs = spec_set[gem_name]
31
24
  if specs.length == 1
32
25
  specs.first
33
26
  else
@@ -47,6 +40,7 @@ module Bundler
47
40
  # @param gem_name String
48
41
  # @void
49
42
  def why(gem_name)
43
+ runtime = Bundler.load
50
44
  spec_set = runtime.specs
51
45
  spec = find_one_spec_in_set(spec_set, gem_name)
52
46
  traverse(spec_set, spec)
@@ -1,7 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bundler
4
+ # :nodoc:
2
5
  module Why
3
6
  def self.gem_version
4
- ::Gem::Version.new('0.1.0')
7
+ ::Gem::Version.new('0.1.1')
5
8
  end
6
9
  end
7
10
  end
data/plugins.rb CHANGED
@@ -1 +1,3 @@
1
- require "bundler/why"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/why'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler-why
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared Beck
@@ -18,8 +18,10 @@ extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
20
  - ".gitignore"
21
+ - ".rubocop.yml"
21
22
  - ".ruby-version"
22
23
  - ".travis.yml"
24
+ - CHANGELOG.md
23
25
  - CONTRIBUTING.md
24
26
  - Gemfile
25
27
  - LICENSE.md