mirror of
https://github.com/varvet/pundit.git
synced 2022-11-09 12:30:11 -05:00
Update Rubocop to most recent version.
- `required_ruby_version >= 2.5` is because JRuby is still compliant with Ruby 2.5. I assume this means that in order to support JRuby we need to support Ruby 2.5.
This commit is contained in:
parent
2823669370
commit
cbc7479cf7
5 changed files with 20 additions and 12 deletions
|
@ -1,4 +1,5 @@
|
|||
AllCops:
|
||||
NewCops: enable
|
||||
TargetRubyVersion: 2.6
|
||||
Exclude:
|
||||
- "lib/generators/**/templates/**/*"
|
||||
|
@ -15,7 +16,7 @@ Metrics/ModuleLength:
|
|||
Exclude:
|
||||
- "**/*_spec.rb"
|
||||
|
||||
Metrics/LineLength:
|
||||
Layout/LineLength:
|
||||
Max: 120
|
||||
|
||||
Metrics/AbcSize:
|
||||
|
@ -27,7 +28,7 @@ Metrics/CyclomaticComplexity:
|
|||
Metrics/PerceivedComplexity:
|
||||
Enabled: false
|
||||
|
||||
Layout/AlignParameters:
|
||||
Layout/ParameterAlignment:
|
||||
EnforcedStyle: with_fixed_indentation
|
||||
|
||||
Layout/CaseIndentation:
|
||||
|
@ -63,5 +64,5 @@ Style/Not:
|
|||
Style/DoubleNegation:
|
||||
Enabled: false
|
||||
|
||||
Documentation:
|
||||
Style/Documentation:
|
||||
Enabled: false # TODO: Enable again once we have more docs
|
||||
|
|
|
@ -24,13 +24,13 @@ module Pundit
|
|||
failure_message_proc = lambda do |policy|
|
||||
was_were = @violating_permissions.count > 1 ? "were" : "was"
|
||||
"Expected #{policy} to grant #{permissions.to_sentence} on " \
|
||||
"#{record} but #{@violating_permissions.to_sentence} #{was_were} not granted"
|
||||
"#{record} but #{@violating_permissions.to_sentence} #{was_were} not granted"
|
||||
end
|
||||
|
||||
failure_message_when_negated_proc = lambda do |policy|
|
||||
was_were = @violating_permissions.count > 1 ? "were" : "was"
|
||||
"Expected #{policy} not to grant #{permissions.to_sentence} on " \
|
||||
"#{record} but #{@violating_permissions.to_sentence} #{was_were} granted"
|
||||
"#{record} but #{@violating_permissions.to_sentence} #{was_were} granted"
|
||||
end
|
||||
|
||||
if respond_to?(:match_when_negated)
|
||||
|
|
|
@ -13,6 +13,7 @@ Gem::Specification.new do |gem|
|
|||
gem.summary = "OO authorization for Rails"
|
||||
gem.homepage = "https://github.com/varvet/pundit"
|
||||
gem.license = "MIT"
|
||||
gem.required_ruby_version = ">= 2.5"
|
||||
|
||||
gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
||||
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
||||
|
@ -26,7 +27,9 @@ 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.19.0"
|
||||
gem.add_development_dependency "rubocop-rake"
|
||||
gem.add_development_dependency "rubocop-rspec"
|
||||
gem.add_development_dependency "simplecov", ">= 0.17.0"
|
||||
gem.add_development_dependency "yard"
|
||||
end
|
||||
|
|
|
@ -113,9 +113,10 @@ RSpec.describe Pundit::PolicyFinder do
|
|||
end
|
||||
|
||||
context "with a class that doesn't have an associated policy" do
|
||||
class self::Foo; end # rubocop:disable Lint/ConstantDefinitionInBlock, Lint/EmptyClass, Style/ClassAndModuleChildren
|
||||
|
||||
it "returns nil" do
|
||||
class Foo; end
|
||||
object = described_class.new(Foo)
|
||||
object = described_class.new(self.class::Foo)
|
||||
|
||||
expect(object.policy).to eq nil
|
||||
end
|
||||
|
|
|
@ -80,6 +80,7 @@ end
|
|||
|
||||
class CommentScope
|
||||
attr_reader :original_object
|
||||
|
||||
def initialize(original_object)
|
||||
@original_object = original_object
|
||||
end
|
||||
|
@ -114,7 +115,7 @@ class Comment
|
|||
end
|
||||
|
||||
class CommentsRelation
|
||||
def initialize(empty = false)
|
||||
def initialize(empty = false) # rubocop:disable Style/OptionalBooleanParameter
|
||||
@empty = empty
|
||||
end
|
||||
|
||||
|
@ -127,11 +128,11 @@ class CommentsRelation
|
|||
end
|
||||
end
|
||||
|
||||
class Article; end
|
||||
class Article; end # rubocop:disable Lint/EmptyClass
|
||||
|
||||
class BlogPolicy < Struct.new(:user, :blog); end
|
||||
|
||||
class Blog; end
|
||||
class Blog; end # rubocop:disable Lint/EmptyClass
|
||||
|
||||
class ArtificialBlog < Blog
|
||||
def self.policy_class
|
||||
|
@ -227,7 +228,8 @@ class NilClassPolicy < Struct.new(:user, :record)
|
|||
end
|
||||
end
|
||||
|
||||
class Wiki; end
|
||||
class Wiki; end # rubocop:disable Lint/EmptyClass
|
||||
|
||||
class WikiPolicy
|
||||
class Scope
|
||||
# deliberate typo method
|
||||
|
@ -238,6 +240,7 @@ end
|
|||
class Thread
|
||||
def self.all; end
|
||||
end
|
||||
|
||||
class ThreadPolicy < Struct.new(:user, :thread)
|
||||
class Scope < Struct.new(:user, :scope)
|
||||
def resolve
|
||||
|
|
Loading…
Add table
Reference in a new issue