Skip to content

Commit

Permalink
bump rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
benbalter committed Sep 16, 2021
1 parent 19a8978 commit 3765d28
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 10 deletions.
9 changes: 8 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
require: rubocop-jekyll
inherit_from: .rubocop_todo.yml

require:
- rubocop-jekyll
- rubocop-performance
- rubocop-rspec

inherit_gem:
rubocop-jekyll: .rubocop.yml

AllCops:
Exclude:
- vendor/**/*
NewCops: enable

Metrics/BlockLength:
Exclude:
Expand Down
69 changes: 69 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2021-09-16 19:13:45 UTC using RuboCop version 1.18.4.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# Configuration parameters: Include.
# Include: **/*.gemspec
Gemspec/RequiredRubyVersion:
Exclude:
- 'jekyll-relative-links.gemspec'

# Offense count: 1
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 24

# Offense count: 1
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers.
# SupportedStyles: snake_case, normalcase, non_integer
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339
Naming/VariableNumber:
Exclude:
- 'spec/jekyll-relative-links/generator_spec.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: SafeMultiline.
Performance/DeletePrefix:
Exclude:
- 'lib/jekyll-relative-links/generator.rb'

# Offense count: 14
# Configuration parameters: Prefixes.
# Prefixes: when, with, without
RSpec/ContextWording:
Exclude:
- 'spec/jekyll-relative-links/generator_spec.rb'

# Offense count: 2
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
# Include: **/*_spec*rb*, **/spec/**/*
RSpec/FilePath:
Exclude:
- 'spec/jekyll-relative-links/context_spec.rb'
- 'spec/jekyll-relative-links/generator_spec.rb'

# Offense count: 4
RSpec/MultipleExpectations:
Max: 2

# Offense count: 17
# Configuration parameters: AllowSubject.
RSpec/MultipleMemoizedHelpers:
Max: 13

# Offense count: 10
# Configuration parameters: IgnoreSharedExamples.
RSpec/NamedSubject:
Exclude:
- 'spec/jekyll-relative-links/context_spec.rb'
- 'spec/jekyll-relative-links/generator_spec.rb'

# Offense count: 6
RSpec/NestedGroups:
Max: 5
4 changes: 3 additions & 1 deletion jekyll-relative-links.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Gem::Specification.new do |s|
s.add_dependency "jekyll", ">= 3.3", "< 5.0"
s.add_development_dependency "kramdown-parser-gfm", "~> 1.0"
s.add_development_dependency "rspec", "~> 3.5"
s.add_development_dependency "rubocop", "~> 0.71"
s.add_development_dependency "rubocop", "~> 1.0"
s.add_development_dependency "rubocop-jekyll", "~> 0.10"
s.add_development_dependency "rubocop-performance", "~> 1.5"
s.add_development_dependency "rubocop-rspec", "~> 2.0"
end
2 changes: 1 addition & 1 deletion lib/jekyll-relative-links/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Generator < Jekyll::Generator
FRAGMENT_REGEX = %r!(#.+?|)?!.freeze
TITLE_REGEX = %r{(\s+"(?:\\"|[^"])*(?<!\\)"|\s+"(?:\\'|[^'])*(?<!\\)')?}.freeze
FRAG_AND_TITLE_REGEX = %r!#{FRAGMENT_REGEX}#{TITLE_REGEX}!.freeze
INLINE_LINK_REGEX = %r!\[#{LINK_TEXT_REGEX}\]\(([^\)]+?)#{FRAG_AND_TITLE_REGEX}\)!.freeze
INLINE_LINK_REGEX = %r!\[#{LINK_TEXT_REGEX}\]\(([^)]+?)#{FRAG_AND_TITLE_REGEX}\)!.freeze
REFERENCE_LINK_REGEX = %r!^\s*?\[#{LINK_TEXT_REGEX}\]: (.+?)#{FRAG_AND_TITLE_REGEX}\s*?$!.freeze
LINK_REGEX = %r!(#{INLINE_LINK_REGEX}|#{REFERENCE_LINK_REGEX})!.freeze
CONVERTER_CLASS = Jekyll::Converters::Markdown
Expand Down
3 changes: 2 additions & 1 deletion spec/jekyll-relative-links/context_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# frozen_string_literal: true

RSpec.describe JekyllRelativeLinks::Context do
let(:site) { fixture_site("site") }
subject { described_class.new(site) }

let(:site) { fixture_site("site") }

it "stores the site" do
expect(subject.site).to eql(site)
end
Expand Down
12 changes: 6 additions & 6 deletions spec/jekyll-relative-links/generator_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# frozen_string_literal: true

RSpec.describe JekyllRelativeLinks::Generator do
subject { described_class.new(site.config) }

let(:site_config) do
overrides["relative_links"] = plugin_config if plugin_config
overrides
Expand All @@ -17,9 +19,7 @@
let(:item) { doc_by_path(site, "_items/some-item.md") }
let(:item_2) { doc_by_path(site, "_items/some-subdir/another-item.md") }

subject { described_class.new(site.config) }

before(:each) do
before do
site.reset
site.read
end
Expand All @@ -32,11 +32,11 @@
before { subject.instance_variable_set "@site", site }

it "knows when an extension is markdown" do
expect(subject.send(:markdown_extension?, ".md")).to eql(true)
expect(subject.send(:markdown_extension?, ".md")).to be(true)
end

it "knows when an extension isn't markdown" do
expect(subject.send(:markdown_extension?, ".html")).to eql(false)
expect(subject.send(:markdown_extension?, ".html")).to be(false)
end

it "knows the markdown converter" do
Expand Down Expand Up @@ -344,7 +344,7 @@
before { page_by_path(site, "page.md").content = nil }

it "doesn't error out" do
expect { subject.generate(site) }.to_not raise_error
expect { subject.generate(site) }.not_to raise_error
end
end
end

0 comments on commit 3765d28

Please sign in to comment.