rubocop-action_policy 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/lib/rubocop/action_policy/version.rb +9 -0
- data/lib/rubocop/cop/action_policy/application_policy.rb +36 -0
- data/lib/rubocop-action_policy.rb +2 -7
- metadata +3 -3
- data/lib/rubocop-action_policy/action_policy/application_policy.rb +0 -34
- data/lib/rubocop-action_policy/version.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 067e993c329a5fe58f1bb57369cfefcec167614e94bd2c8898c4e4145f210d79
|
4
|
+
data.tar.gz: 98e44c09ede0f2b6f521f7802248ac7b4908ca01878b3c66b4b1062e3f12f772
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fe12b92950404457886f97b6a6fe10f3569e698c1bd9ed9a0bd5c5b60a1d0137b1de03fea5196f3400dcf46a5c9bb7a2d1436502f2488b8b03d46dab23e01af
|
7
|
+
data.tar.gz: 1a99fd04367f2f4c530adc9f7ccaf89a4593defb870e2e847e7a24a183f0e94684a7240cc2668b9720bc88773f3939e721ffa5ae68eb668bf3b3e1cdcf393a31
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rubocop-rails"
|
4
|
+
|
5
|
+
module Rubocop
|
6
|
+
module Cop
|
7
|
+
module ActionPolicy
|
8
|
+
# Checks that your policies are subclasses of `ApplicationPolicy`.
|
9
|
+
#
|
10
|
+
# @safety
|
11
|
+
# This cop's autocorrection is unsafe because it may let the logic from `ApplicationPolicy`
|
12
|
+
# sneak into a policy that is not purposed to inherit logic common among other policies.
|
13
|
+
#
|
14
|
+
# @example
|
15
|
+
#
|
16
|
+
# # good
|
17
|
+
# class MyPolicy < ApplicationPolicy
|
18
|
+
# # ...
|
19
|
+
# end
|
20
|
+
#
|
21
|
+
# # bad
|
22
|
+
# class MyPolicy < ActionPolicy::Base
|
23
|
+
# # ...
|
24
|
+
# end
|
25
|
+
class ApplicationPolicy < RuboCop::Cop::Base
|
26
|
+
extend RuboCop::Cop::AutoCorrector
|
27
|
+
|
28
|
+
MSG = "Policies should subclass `ApplicationPolicy`."
|
29
|
+
SUPERCLASS = "ApplicationPolicy"
|
30
|
+
BASE_PATTERN = "(const (const nil? :ActionPolicy) :Base)"
|
31
|
+
|
32
|
+
include RuboCop::Cop::EnforceSuperclass
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -1,9 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "rubocop
|
4
|
-
require_relative "rubocop
|
5
|
-
|
6
|
-
module RubocopActionPolicy
|
7
|
-
class Error < StandardError; end
|
8
|
-
# Your code goes here...
|
9
|
-
end
|
3
|
+
require_relative "rubocop/action_policy/version"
|
4
|
+
require_relative "rubocop/cop/action_policy/application_policy"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-action_policy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thorsten Kohpeiss
|
@@ -67,8 +67,8 @@ files:
|
|
67
67
|
- README.md
|
68
68
|
- Rakefile
|
69
69
|
- lib/rubocop-action_policy.rb
|
70
|
-
- lib/rubocop
|
71
|
-
- lib/rubocop
|
70
|
+
- lib/rubocop/action_policy/version.rb
|
71
|
+
- lib/rubocop/cop/action_policy/application_policy.rb
|
72
72
|
- sig/rubocop-action_policy.rbs
|
73
73
|
homepage: https://github.com/Nordplaner/rubocop-action_policy
|
74
74
|
licenses:
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "rubocop-rails"
|
4
|
-
|
5
|
-
module RubocopActionPolicy
|
6
|
-
module ActionPolicy
|
7
|
-
# Checks that your policies are subclasses of `ApplicationPolicy`.
|
8
|
-
#
|
9
|
-
# @safety
|
10
|
-
# This cop's autocorrection is unsafe because it may let the logic from `ApplicationPolicy`
|
11
|
-
# sneak into a policy that is not purposed to inherit logic common among other policies.
|
12
|
-
#
|
13
|
-
# @example
|
14
|
-
#
|
15
|
-
# # good
|
16
|
-
# class MyPolicy < ApplicationPolicy
|
17
|
-
# # ...
|
18
|
-
# end
|
19
|
-
#
|
20
|
-
# # bad
|
21
|
-
# class MyPolicy < ActionPolicy::Base
|
22
|
-
# # ...
|
23
|
-
# end
|
24
|
-
class ApplicationPolicy < RuboCop::Cop::Base
|
25
|
-
extend RuboCop::Cop::AutoCorrector
|
26
|
-
|
27
|
-
MSG = "Policies should subclass `ApplicationPolicy`."
|
28
|
-
SUPERCLASS = "ApplicationPolicy"
|
29
|
-
BASE_PATTERN = "(const (const nil? :ActionPolicy) :Base)"
|
30
|
-
|
31
|
-
include RuboCop::Cop::EnforceSuperclass
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|