Skip to content

Commit 4ecbeb4

Browse files
authored
Bump RuboCop to v1.45.x (#9305)
Merge pull request 9305
1 parent 66e6b2f commit 4ecbeb4

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

.rubocop.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ Style/RescueModifier:
447447
Style/SafeNavigation:
448448
Exclude:
449449
- lib/jekyll/document.rb
450+
- lib/jekyll/page.rb
450451
Style/SignalException:
451452
EnforcedStyle: only_raise
452453
Style/SingleArgumentDig:

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ group :test do
2323
gem "nokogiri", "~> 1.7"
2424
gem "rspec"
2525
gem "rspec-mocks"
26-
gem "rubocop", "~> 1.38.0"
26+
gem "rubocop", "~> 1.45.0"
2727
gem "rubocop-minitest"
2828
gem "rubocop-performance"
2929
gem "rubocop-rake"

lib/jekyll/static_file.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ module Jekyll
44
class StaticFile
55
extend Forwardable
66

7-
attr_reader :relative_path, :extname, :name
7+
attr_reader :relative_path, :extname,
8+
:type, # Returns the type of the collection if present, nil otherwise.
9+
:name
810

911
def_delegator :to_liquid, :to_json, :to_json
1012

@@ -34,6 +36,7 @@ def initialize(site, base, dir, name, collection = nil)
3436
@collection = collection
3537
@relative_path = File.join(*[@dir, @name].compact)
3638
@extname = File.extname(@name)
39+
@type = @collection&.label&.to_sym
3740
end
3841
# rubocop: enable Metrics/ParameterLists
3942

@@ -171,11 +174,6 @@ def url
171174
end
172175
end
173176

174-
# Returns the type of the collection if present, nil otherwise.
175-
def type
176-
@type ||= @collection.nil? ? nil : @collection.label.to_sym
177-
end
178-
179177
# Returns the front matter defaults defined for the file's URL and/or type
180178
# as defined in _config.yml.
181179
def defaults

0 commit comments

Comments
 (0)