Skip to content

Commit

Permalink
Merge pull request #708 from MarceloAGuimaraes/update-rubocop
Browse files Browse the repository at this point in the history
Update rubocop
  • Loading branch information
Burgestrand authored Jan 17, 2022
2 parents 748b262 + 4bb0c7d commit 3c725c7
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
11 changes: 8 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ AllCops:
TargetRubyVersion: 2.6
Exclude:
- "lib/generators/**/templates/**/*"
SuggestExtensions: false
NewCops: disable

Metrics/BlockLength:
Exclude:
Expand All @@ -15,7 +17,7 @@ Metrics/ModuleLength:
Exclude:
- "**/*_spec.rb"

Metrics/LineLength:
Layout/LineLength:
Max: 120

Metrics/AbcSize:
Expand All @@ -27,7 +29,10 @@ Metrics/CyclomaticComplexity:
Metrics/PerceivedComplexity:
Enabled: false

Layout/AlignParameters:
Gemspec/RequiredRubyVersion:
Enabled: false

Layout/ParameterAlignment:
EnforcedStyle: with_fixed_indentation

Layout/CaseIndentation:
Expand Down Expand Up @@ -63,5 +68,5 @@ Style/Not:
Style/DoubleNegation:
Enabled: false

Documentation:
Style/Documentation:
Enabled: false # TODO: Enable again once we have more docs
2 changes: 1 addition & 1 deletion pundit.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Gem::Specification.new do |gem|
gem.add_development_dependency "pry"
gem.add_development_dependency "rake"
gem.add_development_dependency "rspec", ">= 3.0.0"
gem.add_development_dependency "rubocop", "0.74.0"
gem.add_development_dependency "rubocop", "1.24.0"
gem.add_development_dependency "simplecov", ">= 0.17.0"
gem.add_development_dependency "yard"
end
2 changes: 1 addition & 1 deletion spec/policy_finder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

require "spec_helper"

class Foo; end
RSpec.describe Pundit::PolicyFinder do
let(:user) { double }
let(:post) { Post.new(user) }
Expand Down Expand Up @@ -114,7 +115,6 @@

context "with a class that doesn't have an associated policy" do
it "returns nil" do
class Foo; end
object = described_class.new(Foo)

expect(object.policy).to eq nil
Expand Down
4 changes: 2 additions & 2 deletions spec/pundit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
let(:article) { Article.new }
let(:artificial_blog) { ArtificialBlog.new }
let(:article_tag) { ArticleTag.new }
let(:comments_relation) { CommentsRelation.new }
let(:empty_comments_relation) { CommentsRelation.new(true) }
let(:comments_relation) { CommentsRelation.new(empty: false) }
let(:empty_comments_relation) { CommentsRelation.new(empty: true) }
let(:tag_four_five_six) { ProjectOneTwoThree::TagFourFiveSix.new(user) }
let(:avatar_four_five_six) { ProjectOneTwoThree::AvatarFourFiveSix.new }
let(:wiki) { Wiki.new }
Expand Down
5 changes: 4 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def self.policy_class

class CommentScope
attr_reader :original_object

def initialize(original_object)
@original_object = original_object
end
Expand Down Expand Up @@ -114,7 +115,7 @@ class Comment
end

class CommentsRelation
def initialize(empty = false)
def initialize(empty: false)
@empty = empty
end

Expand Down Expand Up @@ -232,6 +233,7 @@ def destroy?
end

class Wiki; end

class WikiPolicy
class Scope
# deliberate typo method
Expand All @@ -242,6 +244,7 @@ def initalize; end
class Thread
def self.all; end
end

class ThreadPolicy < Struct.new(:user, :thread)
class Scope < Struct.new(:user, :scope)
def resolve
Expand Down

0 comments on commit 3c725c7

Please sign in to comment.