rubocop-action_policy 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32f3126b7aedbe9b08e36167f89ead0604b26b3d85391dbf83d7fe6a1f54b910
4
- data.tar.gz: 4c5a58d710d46aa49f539426700f200e5b0db27f840120abc85804f0836393e2
3
+ metadata.gz: 6512ff7d7b9b06406159ebd7992ed52967814826258d69f6195d5f91c60296f4
4
+ data.tar.gz: 3c1d467686731d9f50be2f359efea331410808d7af986006f66d27a3bb05bf3c
5
5
  SHA512:
6
- metadata.gz: 6abd9fa19b68096fe6155110b5209fa349bc296264b517c15d89499f764f5751f10428e94587454fdd56ea4094a09e12a9683e24eeca8a66df2032b8d42c0bdd
7
- data.tar.gz: acbd47dfcd3641a40ec4d71f149eb9cca3136b2b997227ff3a053d5e4ee45ea420a2d38f09ab06a0c17bc6693e8446ad781ae509e02f78cd609003e49c797476
6
+ metadata.gz: c145c40869a9c4464b1c75ae2f17fea46734bbb1c84cfe25b5da6938ba6ed80fbdf8c90b7a0702e45393bd6f4d52dd69fcc7532d6dc26f991cabb6255381a756
7
+ data.tar.gz: 195d5f40398a101e1f0faeec18cfb9c8b7d002f508245f8701aafe6fc75ccb6f6d5c33581d11a27d8acaa433b4ccf4363eebc8777b508688bac42afc74c40fef
data/.rubocop.yml ADDED
@@ -0,0 +1,27 @@
1
+ require:
2
+ - rubocop-rails
3
+ - rubocop-rspec
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 3.0
7
+
8
+ Layout/LineLength:
9
+ Max: 120
10
+
11
+ Metrics/BlockLength:
12
+ Max: 75
13
+
14
+ Naming/FileName:
15
+ Exclude:
16
+ - lib/rubocop-action_policy.rb
17
+
18
+ RSpec/ExampleLength:
19
+ Max: 11
20
+
21
+ Style/StringLiterals:
22
+ Enabled: true
23
+ EnforcedStyle: double_quotes
24
+
25
+ Style/StringLiteralsInInterpolation:
26
+ Enabled: true
27
+ EnforcedStyle: double_quotes
data/CHANGELOG.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ## [Unreleased]
2
2
 
3
- ## [0.1.0] - 2022-10-12
3
+ ## [0.1.1] - 2022-10-12
4
4
 
5
5
  - Initial release
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rubocop
4
+ module ActionPolicy
5
+ module Version
6
+ STRING = "0.1.2"
7
+ end
8
+ end
9
+ end
@@ -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-action_policy/version"
4
- require_relative "rubocop-action_policy/action_policy/application_policy"
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"
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/rubocop/action_policy/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "rubocop-action_policy"
7
+ spec.version = Rubocop::ActionPolicy::Version::STRING
8
+ spec.authors = ["Thorsten Kohpeiss"]
9
+ spec.email = ["thk@nordplaner.dk"]
10
+
11
+ spec.summary = "Automatic ActionPolicy code style checking tool."
12
+ spec.homepage = "https://github.com/Nordplaner/rubocop-action_policy"
13
+ spec.license = "MIT"
14
+ spec.required_ruby_version = ">= 3.0"
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+ spec.metadata["source_code_uri"] = spec.homepage
18
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ spec.files = Dir.chdir(__dir__) do
23
+ `git ls-files -z`.split("\x0").reject do |f|
24
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
25
+ end
26
+ end
27
+ spec.bindir = "bin"
28
+ spec.executables = spec.files.grep(%r{\Abin/}) { |f| File.basename(f) }
29
+ spec.require_paths = ["lib"]
30
+
31
+ spec.add_runtime_dependency "rubocop"
32
+ spec.add_runtime_dependency "rubocop-rails"
33
+ spec.add_runtime_dependency "rubocop-rspec"
34
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-action_policy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thorsten Kohpeiss
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-12 00:00:00.000000000 Z
11
+ date: 2023-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- description:
55
+ description:
56
56
  email:
57
57
  - thk@nordplaner.dk
58
58
  executables: []
@@ -60,6 +60,7 @@ extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
62
  - ".rspec"
63
+ - ".rubocop.yml"
63
64
  - CHANGELOG.md
64
65
  - CODE_OF_CONDUCT.md
65
66
  - Gemfile
@@ -67,8 +68,9 @@ files:
67
68
  - README.md
68
69
  - Rakefile
69
70
  - lib/rubocop-action_policy.rb
70
- - lib/rubocop-action_policy/action_policy/application_policy.rb
71
- - lib/rubocop-action_policy/version.rb
71
+ - lib/rubocop/action_policy/version.rb
72
+ - lib/rubocop/cop/action_policy/application_policy.rb
73
+ - rubocop-action_policy.gemspec
72
74
  - sig/rubocop-action_policy.rbs
73
75
  homepage: https://github.com/Nordplaner/rubocop-action_policy
74
76
  licenses:
@@ -77,7 +79,7 @@ metadata:
77
79
  homepage_uri: https://github.com/Nordplaner/rubocop-action_policy
78
80
  source_code_uri: https://github.com/Nordplaner/rubocop-action_policy
79
81
  changelog_uri: https://github.com/Nordplaner/rubocop-action_policy/blob/master/CHANGELOG.md
80
- post_install_message:
82
+ post_install_message:
81
83
  rdoc_options: []
82
84
  require_paths:
83
85
  - lib
@@ -85,15 +87,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
85
87
  requirements:
86
88
  - - ">="
87
89
  - !ruby/object:Gem::Version
88
- version: 2.6.0
90
+ version: '3.0'
89
91
  required_rubygems_version: !ruby/object:Gem::Requirement
90
92
  requirements:
91
93
  - - ">="
92
94
  - !ruby/object:Gem::Version
93
95
  version: '0'
94
96
  requirements: []
95
- rubygems_version: 3.1.6
96
- signing_key:
97
+ rubygems_version: 3.4.10
98
+ signing_key:
97
99
  specification_version: 4
98
100
  summary: Automatic ActionPolicy code style checking tool.
99
101
  test_files: []
@@ -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
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RubocopActionPolicy
4
- VERSION = "0.1.0"
5
- end