gemfilelint 0.4.0 → 0.5.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a2060f4fc9182c112139acb209f01d2e33912b25508f0685f75b78733daad2b
4
- data.tar.gz: bf61bd673a5163aecf6f1dd2d150379fc809ecdf6a9e0067ce62473e0cf2d657
3
+ metadata.gz: 0e7135ae80c989c01e298ca17342f0c619a4f4e638698f22bd2068047752cea5
4
+ data.tar.gz: b79fda41bf11cf8f7c037d8cb9f08175cdd93f8323499ae20c967b4d64eacd90
5
5
  SHA512:
6
- metadata.gz: 4130ead8d9a8b793b1cece83a2bfdae070225c5495370857acd5dc06adab2f4dae6af93bb74ee5dfe16415b82b8bc0d13887b6d6be5f0574e0e79c7fb3d58e42
7
- data.tar.gz: c46f5cdaace8230cd21c1c1b981a42031db5a93bacc0f788e366a990b63bc35cb91033c8f38649820a52a670e8ffefeb9957fda699c9ed1a78c59d516a062e22
6
+ metadata.gz: 7b262d41ba961bda4060a691e6f1a81d81240952f5f6d93aac4f6ae7deced8a4c92653a8809d920e7e22b75b8d215bcbe3276c56f18f12969c6db01b4fa9d9b8
7
+ data.tar.gz: 2c8189573ad2e9bb4f3337f694c1f0d446d757c5f9c477e19e454e5d673013c3db27dab5c59becce510b744a38863c4790ac1102d51b4b69cd4f7f6af0b5a013
@@ -4,3 +4,7 @@ updates:
4
4
  directory: "/"
5
5
  schedule:
6
6
  interval: "daily"
7
+ - package-ecosystem: "github-actions"
8
+ directory: "/"
9
+ schedule:
10
+ interval: "daily"
@@ -0,0 +1,22 @@
1
+ name: Dependabot auto-merge
2
+ on: pull_request
3
+
4
+ permissions:
5
+ contents: write
6
+ pull-requests: write
7
+
8
+ jobs:
9
+ dependabot:
10
+ runs-on: ubuntu-latest
11
+ if: ${{ github.actor == 'dependabot[bot]' }}
12
+ steps:
13
+ - name: Dependabot metadata
14
+ id: metadata
15
+ uses: dependabot/fetch-metadata@v3.1.0
16
+ with:
17
+ github-token: "${{ secrets.GITHUB_TOKEN }}"
18
+ - name: Enable auto-merge for Dependabot PRs
19
+ run: gh pr merge --auto --merge "$PR_URL"
20
+ env:
21
+ PR_URL: ${{github.event.pull_request.html_url}}
22
+ GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
@@ -1,7 +1,9 @@
1
1
  name: Main
2
+
2
3
  on:
3
4
  - push
4
- - pull_request_target
5
+ - pull_request
6
+
5
7
  jobs:
6
8
  ci:
7
9
  name: CI
@@ -12,23 +14,9 @@ jobs:
12
14
  - uses: actions/checkout@master
13
15
  - uses: ruby/setup-ruby@v1
14
16
  with:
15
- ruby-version: 3.0
17
+ ruby-version: '3.2'
16
18
  bundler-cache: true
17
19
  - name: Lint and test
18
20
  run: |
19
- bundle exec rubocop --parallel
21
+ bundle exec rake stree:check
20
22
  bundle exec rake test
21
- automerge:
22
- name: AutoMerge
23
- needs: ci
24
- runs-on: ubuntu-latest
25
- if: github.event_name == 'pull_request_target' && (github.actor == github.repository_owner || github.actor == 'dependabot[bot]')
26
- steps:
27
- - uses: actions/github-script@v3
28
- with:
29
- script: |
30
- github.pulls.merge({
31
- owner: context.payload.repository.owner.login,
32
- repo: context.payload.repository.name,
33
- pull_number: context.payload.pull_request.number
34
- })
data/CHANGELOG.md CHANGED
@@ -6,6 +6,18 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.5.0] - 2026-07-07
10
+
11
+ ### Added
12
+
13
+ - Support for Bundler 4.
14
+
15
+ ## [0.4.1] - 2021-11-17
16
+
17
+ ### Changed
18
+
19
+ - Require MFA for release.
20
+
9
21
  ## [0.4.0] - 2021-09-15
10
22
 
11
23
  ### Added
@@ -42,7 +54,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
42
54
 
43
55
  - 🎉 Initial release.
44
56
 
45
- [unreleased]: https://github.com/kddnewton/gemfilelint/compare/v0.4.0...HEAD
57
+ [unreleased]: https://github.com/kddnewton/gemfilelint/compare/v0.5.0...HEAD
58
+ [0.5.0]: https://github.com/kddnewton/gemfilelint/compare/v0.4.1...v0.5.0
59
+ [0.4.1]: https://github.com/kddnewton/gemfilelint/compare/v0.4.0...v0.4.1
46
60
  [0.4.0]: https://github.com/kddnewton/gemfilelint/compare/v0.3.0...v0.4.0
47
61
  [0.3.0]: https://github.com/kddnewton/gemfilelint/compare/v0.2.2...v0.3.0
48
62
  [0.2.2]: https://github.com/kddnewton/gemfilelint/compare/v0.2.1...v0.2.2
data/Gemfile CHANGED
@@ -3,3 +3,7 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gemspec
6
+
7
+ gem "minitest"
8
+ gem "rake"
9
+ gem "syntax_tree"
data/Gemfile.lock CHANGED
@@ -1,44 +1,37 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gemfilelint (0.4.0)
4
+ gemfilelint (0.5.0)
5
5
  bundler
6
+ logger
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
9
10
  specs:
10
- ast (2.4.2)
11
- minitest (5.14.4)
12
- parallel (1.21.0)
13
- parser (3.0.2.0)
14
- ast (~> 2.4.1)
15
- rainbow (3.0.0)
16
- rake (13.0.6)
17
- regexp_parser (2.1.1)
18
- rexml (3.2.5)
19
- rubocop (1.21.0)
20
- parallel (~> 1.10)
21
- parser (>= 3.0.0.0)
22
- rainbow (>= 2.2.2, < 4.0)
23
- regexp_parser (>= 1.8, < 3.0)
24
- rexml
25
- rubocop-ast (>= 1.9.1, < 2.0)
26
- ruby-progressbar (~> 1.7)
27
- unicode-display_width (>= 1.4.0, < 3.0)
28
- rubocop-ast (1.11.0)
29
- parser (>= 3.0.1.1)
30
- ruby-progressbar (1.11.0)
31
- unicode-display_width (2.1.0)
11
+ drb (2.2.3)
12
+ logger (1.7.0)
13
+ minitest (6.0.6)
14
+ drb (~> 2.0)
15
+ prism (~> 1.5)
16
+ prettier_print (1.2.1)
17
+ prism (1.9.0)
18
+ rake (13.4.2)
19
+ syntax_tree (6.3.0)
20
+ prettier_print (>= 1.2.0)
32
21
 
33
22
  PLATFORMS
23
+ arm64-darwin-21
24
+ arm64-darwin-22
25
+ arm64-darwin-23
34
26
  x86_64-darwin-19
27
+ x86_64-darwin-21
35
28
  x86_64-linux
36
29
 
37
30
  DEPENDENCIES
38
31
  gemfilelint!
39
32
  minitest
40
33
  rake
41
- rubocop
34
+ syntax_tree
42
35
 
43
36
  BUNDLED WITH
44
- 2.2.15
37
+ 4.0.4
data/README.md CHANGED
@@ -1,16 +1,16 @@
1
1
  # Gemfile lint
2
2
 
3
3
  [![Build Status](https://github.com/kddnewton/gemfilelint/workflows/Main/badge.svg)](https://github.com/kddnewton/gemfilelint/actions)
4
- [![Gem Version](https://img.shields.io/gem/v/gemfilelint.svg)](https://github.com/kddnewton/gemfilelint)
4
+ [![Gem Version](https://img.shields.io/gem/v/gemfilelint.svg)](https://rubygems.org/gems/gemfilelint)
5
5
 
6
6
  Lint your Gemfile! This will find common spelling mistakes in gems and remote sources so that you don't accidentally download code from places that you don't mean to. For example, if you have a Gemfile with the contents:
7
7
 
8
8
  ```ruby
9
- source 'https://rubyems.org'
9
+ source "https://rubyems.org"
10
10
 
11
- gem 'rails'
12
- gem 'puma'
13
- gem 'pg'
11
+ gem "rails"
12
+ gem "puma"
13
+ gem "pg"
14
14
  ```
15
15
 
16
16
  You might not be able to see the immediate issue, but there's a typo in your source declaration. While this will generally be harmless, as it will likely error, it's also possible that someone could register that domain and provide gems with modified content to execute their own code on your production system.
@@ -22,7 +22,7 @@ You might not be able to see the immediate issue, but there's a typo in your sou
22
22
  Add this line to your application's Gemfile:
23
23
 
24
24
  ```ruby
25
- gem 'gemfilelint'
25
+ gem "gemfilelint"
26
26
  ```
27
27
 
28
28
  And then execute:
@@ -63,12 +63,8 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
63
63
 
64
64
  ## Contributing
65
65
 
66
- Bug reports and pull requests are welcome on GitHub at https://github.com/kddnewton/gemfilelint. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/kddnewton/gemfilelint/blob/master/CODE_OF_CONDUCT.md).
66
+ Bug reports and pull requests are welcome on GitHub at https://github.com/kddnewton/gemfilelint.
67
67
 
68
68
  ## License
69
69
 
70
70
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
71
-
72
- ## Code of Conduct
73
-
74
- Everyone interacting in the Gemfilelint project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/kddnewton/gemfilelint/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "bundler/gem_tasks"
4
4
  require "rake/testtask"
5
+ require "syntax_tree/rake_tasks"
5
6
 
6
7
  Rake::TestTask.new(:test) do |t|
7
8
  t.libs << "test"
@@ -10,3 +11,11 @@ Rake::TestTask.new(:test) do |t|
10
11
  end
11
12
 
12
13
  task default: :test
14
+
15
+ configure = ->(task) do
16
+ task.source_files =
17
+ FileList[%w[Gemfile Rakefile *.gemspec lib/**/*.rb test/**/*.rb]]
18
+ end
19
+
20
+ SyntaxTree::Rake::CheckTask.new(&configure)
21
+ SyntaxTree::Rake::WriteTask.new(&configure)
data/exe/gemfilelint CHANGED
@@ -24,7 +24,7 @@ gemfiles = ARGV.any? ? ARGV : %w[./Gemfile]
24
24
  invalid = gemfiles.reject { |gemfile| File.file?(gemfile) }
25
25
 
26
26
  if invalid.any?
27
- warn("Could not find a gemfile at: #{invalid.join(', ')}")
27
+ warn("Could not find a gemfile at: #{invalid.join(", ")}")
28
28
  exit 2
29
29
  end
30
30
 
data/gemfilelint.gemspec CHANGED
@@ -2,29 +2,36 @@
2
2
 
3
3
  require_relative "lib/gemfilelint/version"
4
4
 
5
+ version = Gemfilelint::VERSION
6
+ repository = "https://github.com/kddnewton/gemfilelint"
7
+
5
8
  Gem::Specification.new do |spec|
6
- spec.name = "gemfilelint"
7
- spec.version = Gemfilelint::VERSION
8
- spec.authors = ["Kevin Newton"]
9
- spec.email = ["kddnewton@gmail.com"]
10
-
11
- spec.summary = "Lint your Gemfile!"
12
- spec.homepage = "https://github.com/kddnewton/gemfilelint"
13
- spec.license = "MIT"
14
-
15
- spec.files = Dir.chdir(__dir__) do
16
- `git ls-files -z`.split("\x0").reject do |f|
17
- f.match(%r{^(test|spec|features)/})
9
+ spec.name = "gemfilelint"
10
+ spec.version = version
11
+ spec.authors = ["Kevin Newton"]
12
+ spec.email = ["kddnewton@gmail.com"]
13
+
14
+ spec.summary = "Lint your Gemfile!"
15
+ spec.homepage = repository
16
+ spec.license = "MIT"
17
+
18
+ spec.metadata = {
19
+ "bug_tracker_uri" => "#{repository}/issues",
20
+ "changelog_uri" => "#{repository}/blob/v#{version}/CHANGELOG.md",
21
+ "source_code_uri" => repository,
22
+ "rubygems_mfa_required" => "true"
23
+ }
24
+
25
+ spec.files =
26
+ Dir.chdir(__dir__) do
27
+ `git ls-files -z`.split("\x0")
28
+ .reject { |f| f.match(%r{^(test|spec|features)/}) }
18
29
  end
19
- end
20
30
 
21
- spec.bindir = "exe"
22
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.bindir = "exe"
32
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
33
  spec.require_paths = ["lib"]
24
34
 
25
35
  spec.add_dependency "bundler"
26
-
27
- spec.add_development_dependency "minitest"
28
- spec.add_development_dependency "rake"
29
- spec.add_development_dependency "rubocop"
36
+ spec.add_dependency "logger"
30
37
  end
@@ -0,0 +1,94 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gemfilelint
4
+ # Note that this used to be a part of bundler, but got removed in 4.0.0, so we
5
+ # have copied the implementation in here. The LICENSE is below for reference.
6
+ #
7
+ # The MIT License
8
+ #
9
+ # Portions copyright
10
+ # (c) 2010-2019 André Arko Portions copyright
11
+ # (c) 2009 Engine Yard
12
+ #
13
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ # of this software and associated documentation files (the "Software"), to
15
+ # deal in the Software without restriction, including without limitation the
16
+ # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
17
+ # sell copies of the Software, and to permit persons to whom the Software is
18
+ # furnished to do so, subject to the following conditions:
19
+ #
20
+ # The above copyright notice and this permission notice shall be included in
21
+ # all copies or substantial portions of the Software.
22
+ #
23
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28
+ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
29
+ # IN THE SOFTWARE.
30
+ #
31
+ class SimilarityDetector
32
+ SimilarityScore = Struct.new(:string, :distance)
33
+
34
+ # initialize with an array of words to be matched against
35
+ def initialize(corpus)
36
+ @corpus = corpus
37
+ end
38
+
39
+ # return an array of words similar to 'word' from the corpus
40
+ def similar_words(word, limit = 3)
41
+ words_by_similarity =
42
+ @corpus.map do |w|
43
+ SimilarityScore.new(w, levenshtein_distance(word, w))
44
+ end
45
+ words_by_similarity
46
+ .select { |s| s.distance <= limit }
47
+ .sort_by(&:distance)
48
+ .map(&:string)
49
+ end
50
+
51
+ # return the result of 'similar_words', concatenated into a list
52
+ # (eg "a, b, or c")
53
+ def similar_word_list(word, limit = 3)
54
+ words = similar_words(word, limit)
55
+ if words.length == 1
56
+ words[0]
57
+ elsif words.length > 1
58
+ [words[0..-2].join(", "), words[-1]].join(" or ")
59
+ end
60
+ end
61
+
62
+ protected
63
+
64
+ # https://www.informit.com/articles/article.aspx?p=683059&seqNum=36
65
+ def levenshtein_distance(this, that, ins = 2, del = 2, sub = 1)
66
+ # ins, del, sub are weighted costs
67
+ return nil if this.nil?
68
+ return nil if that.nil?
69
+ dm = [] # distance matrix
70
+
71
+ # Initialize first row values
72
+ dm[0] = (0..this.length).collect { |i| i * ins }
73
+ fill = [0] * (this.length - 1)
74
+
75
+ # Initialize first column values
76
+ (1..that.length).each { |i| dm[i] = [i * del, fill.flatten] }
77
+
78
+ # populate matrix
79
+ (1..that.length).each do |i|
80
+ (1..this.length).each do |j|
81
+ # critical comparison
82
+ dm[i][j] = [
83
+ dm[i - 1][j - 1] + (this[j - 1] == that[i - 1] ? 0 : sub),
84
+ dm[i][j - 1] + ins,
85
+ dm[i - 1][j] + del
86
+ ].min
87
+ end
88
+ end
89
+
90
+ # The last value in matrix is the Levenshtein distance between the strings
91
+ dm[that.length][this.length]
92
+ end
93
+ end
94
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gemfilelint
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.0"
5
5
  end
data/lib/gemfilelint.rb CHANGED
@@ -1,11 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "delegate"
4
3
  require "logger"
5
-
6
4
  require "bundler"
7
- require "bundler/similarity_detector"
8
5
 
6
+ require "gemfilelint/similarity_detector"
9
7
  require "gemfilelint/version"
10
8
 
11
9
  module Gemfilelint
@@ -13,7 +11,7 @@ module Gemfilelint
13
11
  attr_reader :detector, :haystack
14
12
 
15
13
  def initialize(haystack)
16
- @detector = Bundler::SimilarityDetector.new(haystack)
14
+ @detector = SimilarityDetector.new(haystack)
17
15
  @haystack = haystack
18
16
  end
19
17
 
@@ -28,7 +26,7 @@ module Gemfilelint
28
26
  class Dependency < Struct.new(:path, :name, :suggestions)
29
27
  def to_s
30
28
  <<~ERR
31
- Gem \"#{name}\" is possibly misspelled, suggestions:
29
+ Gem "#{name}" is possibly misspelled, suggestions:
32
30
  #{suggestions.map { |suggestion| " * #{suggestion}" }.join("\n")}"
33
31
  ERR
34
32
  end
@@ -43,7 +41,7 @@ module Gemfilelint
43
41
  class Remote < Struct.new(:path, :name, :suggestions)
44
42
  def to_s
45
43
  <<~ERR
46
- Source \"#{name}\" is possibly misspelled, suggestions:
44
+ Source "#{name}" is possibly misspelled, suggestions:
47
45
  #{suggestions.map { |suggestion| " * #{suggestion}" }.join("\n")}
48
46
  ERR
49
47
  end
@@ -53,14 +51,22 @@ module Gemfilelint
53
51
  module Parser
54
52
  class Valid < Struct.new(:path, :dsl)
55
53
  def each_offense(ignore: [])
56
- dependencies.each do |dependency|
57
- next if ignore.include?(dependency)
58
-
59
- yield dependency_offense_for(dependency)
54
+ dependencies.each do |name|
55
+ next if ignore.include?(name)
56
+
57
+ if (corrections = Gemfilelint.dependencies.correct(name)).any?
58
+ yield Offenses::Dependency.new(path, name, corrections.first(5))
59
+ else
60
+ yield nil
61
+ end
60
62
  end
61
63
 
62
- remotes.each do |remote|
63
- yield remote_offense_for(remote)
64
+ remotes.each do |uri|
65
+ if (corrections = Gemfilelint.remotes.correct(uri)).any?
66
+ yield Offenses::Remote.new(path, uri, corrections)
67
+ else
68
+ yield nil
69
+ end
64
70
  end
65
71
  end
66
72
 
@@ -70,28 +76,14 @@ module Gemfilelint
70
76
  dsl.dependencies.map(&:name)
71
77
  end
72
78
 
73
- def dependency_offense_for(name)
74
- corrections = Gemfilelint.dependencies.correct(name)
75
- return if corrections.empty?
76
-
77
- Offenses::Dependency.new(path, name, corrections.first(5))
78
- end
79
-
80
79
  # Lol wut, there has got to be a better way to do this
81
80
  def remotes
82
81
  sources = dsl.instance_variable_get(:@sources)
83
82
  rubygems =
84
83
  sources.instance_variable_get(:@rubygems_aggregate) ||
85
- sources.instance_variable_get(:@global_rubygems_source)
86
-
87
- rubygems.remotes.map(&:to_s)
88
- end
89
-
90
- def remote_offense_for(uri)
91
- corrections = Gemfilelint.remotes.correct(uri)
92
- return if corrections.empty?
84
+ sources.instance_variable_get(:@global_rubygems_source)
93
85
 
94
- Offenses::Remote.new(path, uri, corrections)
86
+ rubygems ? rubygems.remotes.map(&:to_s) : []
95
87
  end
96
88
  end
97
89
 
@@ -125,22 +117,31 @@ module Gemfilelint
125
117
 
126
118
  def initialize(ignore: [], logger: nil)
127
119
  @ignore = ignore
128
- @logger = logger || make_logger
120
+ @logger =
121
+ logger ||
122
+ Logger
123
+ .new($stdout)
124
+ .tap do |creating|
125
+ creating.level = :info
126
+ creating.formatter = ->(*, message) { message }
127
+ end
129
128
  end
130
129
 
131
- # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
132
- def lint(*paths)
133
- logger.info("Inspecting gemfiles at #{paths.join(', ')}\n")
130
+ def lint(*paths) # rubocop:disable Naming/PredicateMethod
131
+ logger.info("Inspecting gemfiles at #{paths.join(", ")}\n")
134
132
 
135
133
  offenses = []
136
-
137
- each_offense_for(paths) do |offense|
138
- if offense
139
- offenses << offense
140
- logger.info("W".colorize(:magenta))
141
- else
142
- logger.info(".".colorize(:green))
143
- end
134
+ paths.each do |path|
135
+ Parser
136
+ .for(path)
137
+ .each_offense(ignore: ignore) do |offense|
138
+ if offense
139
+ offenses << offense
140
+ logger.info("W".colorize(:magenta))
141
+ else
142
+ logger.info(".".colorize(:green))
143
+ end
144
+ end
144
145
  end
145
146
 
146
147
  logger.info("\n")
@@ -148,33 +149,16 @@ module Gemfilelint
148
149
  if offenses.empty?
149
150
  true
150
151
  else
151
- messages = offenses.map { |offense| offense_to_message(offense) }
152
+ messages =
153
+ offenses.map do |offense|
154
+ "#{offense.path.colorize(:cyan)}: " \
155
+ "#{"W".colorize(:magenta)}: #{offense}"
156
+ end
157
+
152
158
  logger.info("\nOffenses:\n\n#{messages.join("\n")}\n")
153
159
  false
154
160
  end
155
161
  end
156
- # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
157
-
158
- private
159
-
160
- def each_offense_for(paths)
161
- paths.each do |path|
162
- Parser.for(path).each_offense(ignore: ignore) do |offense|
163
- yield offense
164
- end
165
- end
166
- end
167
-
168
- def make_logger
169
- Logger.new($stdout).tap do |creating|
170
- creating.level = :info
171
- creating.formatter = ->(*, message) { message }
172
- end
173
- end
174
-
175
- def offense_to_message(offense)
176
- "#{offense.path.colorize(:cyan)}: #{'W'.colorize(:magenta)}: #{offense}"
177
- end
178
162
  end
179
163
 
180
164
  class << self
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemfilelint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Newton
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2021-09-15 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -25,48 +24,19 @@ dependencies:
25
24
  - !ruby/object:Gem::Version
26
25
  version: '0'
27
26
  - !ruby/object:Gem::Dependency
28
- name: minitest
27
+ name: logger
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - ">="
32
31
  - !ruby/object:Gem::Version
33
32
  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: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rubocop
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
33
+ type: :runtime
63
34
  prerelease: false
64
35
  version_requirements: !ruby/object:Gem::Requirement
65
36
  requirements:
66
37
  - - ">="
67
38
  - !ruby/object:Gem::Version
68
39
  version: '0'
69
- description:
70
40
  email:
71
41
  - kddnewton@gmail.com
72
42
  executables:
@@ -75,11 +45,10 @@ extensions: []
75
45
  extra_rdoc_files: []
76
46
  files:
77
47
  - ".github/dependabot.yml"
48
+ - ".github/workflows/auto-merge.yml"
78
49
  - ".github/workflows/main.yml"
79
50
  - ".gitignore"
80
- - ".rubocop.yml"
81
51
  - CHANGELOG.md
82
- - CODE_OF_CONDUCT.md
83
52
  - Gemfile
84
53
  - Gemfile.lock
85
54
  - LICENSE
@@ -91,13 +60,17 @@ files:
91
60
  - exe/gemfilelint
92
61
  - gemfilelint.gemspec
93
62
  - lib/gemfilelint.rb
63
+ - lib/gemfilelint/similarity_detector.rb
94
64
  - lib/gemfilelint/version.rb
95
65
  - lib/gems.txt
96
66
  homepage: https://github.com/kddnewton/gemfilelint
97
67
  licenses:
98
68
  - MIT
99
- metadata: {}
100
- post_install_message:
69
+ metadata:
70
+ bug_tracker_uri: https://github.com/kddnewton/gemfilelint/issues
71
+ changelog_uri: https://github.com/kddnewton/gemfilelint/blob/v0.5.0/CHANGELOG.md
72
+ source_code_uri: https://github.com/kddnewton/gemfilelint
73
+ rubygems_mfa_required: 'true'
101
74
  rdoc_options: []
102
75
  require_paths:
103
76
  - lib
@@ -112,8 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
85
  - !ruby/object:Gem::Version
113
86
  version: '0'
114
87
  requirements: []
115
- rubygems_version: 3.2.3
116
- signing_key:
88
+ rubygems_version: 4.0.3
117
89
  specification_version: 4
118
90
  summary: Lint your Gemfile!
119
91
  test_files: []
data/.rubocop.yml DELETED
@@ -1,23 +0,0 @@
1
- AllCops:
2
- DisplayCopNames: true
3
- DisplayStyleGuide: true
4
- TargetRubyVersion: 2.7
5
- NewCops: enable
6
- SuggestExtensions: false
7
- Exclude:
8
- - 'vendor/**/*'
9
-
10
- Gemspec/RequiredRubyVersion:
11
- Enabled: false
12
-
13
- Style/Documentation:
14
- Enabled: false
15
-
16
- Style/ExplicitBlockArgument:
17
- Enabled: false
18
-
19
- Style/StringLiterals:
20
- EnforcedStyle: double_quotes
21
-
22
- Style/StructInheritance:
23
- Enabled: false
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
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 kddnewton@gmail.com. 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 [https://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: https://contributor-covenant.org
74
- [version]: https://contributor-covenant.org/version/1/4/