betterlint 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/default.yml +1 -1
- data/lib/rubocop/cop/betterment/active_job_performable.rb +3 -1
- data/lib/rubocop/cop/betterment/allowlist_blocklist.rb +3 -1
- data/lib/rubocop/cop/betterment/authorization_in_controller.rb +3 -1
- data/lib/rubocop/cop/betterment/dynamic_params.rb +3 -1
- data/lib/rubocop/cop/betterment/hardcoded_id.rb +3 -1
- data/lib/rubocop/cop/betterment/implicit_redirect_type.rb +4 -2
- data/lib/rubocop/cop/betterment/memoization_with_arguments.rb +3 -1
- data/lib/rubocop/cop/betterment/non_standard_actions.rb +3 -1
- data/lib/rubocop/cop/betterment/site_prism_loaded.rb +3 -1
- data/lib/rubocop/cop/betterment/spec_helper_required_outside_spec_dir.rb +3 -1
- data/lib/rubocop/cop/betterment/timeout.rb +3 -1
- data/lib/rubocop/cop/betterment/unsafe_job.rb +3 -1
- data/lib/rubocop/cop/betterment/unscoped_find.rb +3 -1
- data/lib/rubocop/cop/betterment/utils/hardcoded_attribute.rb +2 -0
- data/lib/rubocop/cop/betterment/utils/method_return_table.rb +2 -0
- data/lib/rubocop/cop/betterment/utils/parser.rb +2 -0
- data/lib/rubocop/cop/betterment/vague_serialize.rb +3 -1
- data/lib/rubocop/cop/betterment.rb +2 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71ba27a1b021ee2c1543aba5603245ae2631a64525c7c7e5338457b1296c66a6
|
4
|
+
data.tar.gz: e3c21186976d7d503c890cd4e0c8fed99d5c6f6ae20071a17fa697e9c4928ea7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '048543b98c55befe6f306446a132f6f561598bf19ab9ffc4f74c6eb90b7ea5aa1d78d56594c34a2c8c6da7d79462329b8dadc8868af620fe53084189e7f6d604'
|
7
|
+
data.tar.gz: 35388c596e5edc116860dd60796313b9d6569326e77929b5e05b0f48f6f13067534684ec9d37904e140ba4b2dea93f8e243e10ead8196ee1eaba34e6b600d898
|
data/config/default.yml
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# rubocop:disable Betterment/AllowlistBlocklist
|
2
4
|
module RuboCop
|
3
5
|
module Cop
|
4
6
|
module Betterment
|
5
7
|
class AllowlistBlocklist < Cop
|
6
|
-
MSG = <<-DOC
|
8
|
+
MSG = <<-DOC
|
7
9
|
Avoid usages of whitelist & blacklist, in favor of more inclusive and descriptive language.
|
8
10
|
For consistency, favor 'allowlist' and 'blocklist' where possible, but other terms (such as
|
9
11
|
denylist, ignorelist, warnlist, safelist, etc) may be appropriate, depending on the use case.
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RuboCop
|
2
4
|
module Cop
|
3
5
|
module Betterment
|
@@ -5,7 +7,7 @@ module RuboCop
|
|
5
7
|
attr_accessor :unsafe_parameters, :unsafe_regex
|
6
8
|
|
7
9
|
# MSG_UNSAFE_CREATE = 'Model created/updated using unsafe parameters'.freeze
|
8
|
-
MSG_UNSAFE_CREATE = <<~MSG
|
10
|
+
MSG_UNSAFE_CREATE = <<~MSG
|
9
11
|
Model created/updated using unsafe parameters.
|
10
12
|
Please query for the associated record in a way that enforces authorization (e.g. "trust-root chaining"),
|
11
13
|
and then pass the resulting object into your model instead of the unsafe parameter.
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RuboCop
|
2
4
|
module Cop
|
3
5
|
module Betterment
|
4
6
|
class DynamicParams < Cop
|
5
|
-
MSG_DYNAMIC_PARAMS = <<~MSG
|
7
|
+
MSG_DYNAMIC_PARAMS = <<~MSG
|
6
8
|
Parameter names accessed dynamically, cannot determine safeness. Please inline the keys explicitly when calling `permit` or when accessing `params` like a hash.
|
7
9
|
|
8
10
|
See here for more information on this error:
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RuboCop
|
2
4
|
module Cop
|
3
5
|
module Betterment
|
@@ -5,7 +7,7 @@ module RuboCop
|
|
5
7
|
include RangeHelp
|
6
8
|
extend AutoCorrector
|
7
9
|
|
8
|
-
MSG = 'Hardcoded IDs cause flaky tests. Use a sequence instead.'
|
10
|
+
MSG = 'Hardcoded IDs cause flaky tests. Use a sequence instead.'
|
9
11
|
|
10
12
|
# @!method key(node)
|
11
13
|
def_node_matcher :key, '/^id$|_id$/'
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RuboCop
|
2
4
|
module Cop
|
3
5
|
module Betterment
|
@@ -13,10 +15,10 @@ module RuboCop
|
|
13
15
|
# get '/', redirect('/dashboard', status: 301)
|
14
16
|
# get(status: 302) { |params, request| '/dashboard' }
|
15
17
|
class ImplicitRedirectType < Cop
|
16
|
-
ROUTES_FILE_NAME = 'routes.rb'
|
18
|
+
ROUTES_FILE_NAME = 'routes.rb'
|
17
19
|
MSG =
|
18
20
|
'Rails will create a permanent (301) redirect, which is dangerous. ' \
|
19
|
-
'Please specify your desired status, e.g. redirect(..., status: 302)'
|
21
|
+
'Please specify your desired status, e.g. redirect(..., status: 302)'
|
20
22
|
|
21
23
|
# redirect('/')
|
22
24
|
def_node_matcher :arg_form_without_options?, <<-PATTERN
|
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RuboCop
|
2
4
|
module Cop
|
3
5
|
module Betterment
|
4
6
|
class MemoizationWithArguments < Cop
|
5
7
|
MSG = 'Memoized method `%<method>s` accepts arguments, ' \
|
6
8
|
'which may cause it to return a stale result. ' \
|
7
|
-
'Remove memoization or refactor to remove arguments.'
|
9
|
+
'Remove memoization or refactor to remove arguments.'
|
8
10
|
|
9
11
|
def self.node_pattern
|
10
12
|
memo_assign = '(or_asgn $(ivasgn _) _)'
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RuboCop
|
2
4
|
module Cop
|
3
5
|
module Betterment
|
4
6
|
class NonStandardActions < Cop
|
5
|
-
MSG_GENERAL = 'Use a new controller instead of custom actions.'
|
7
|
+
MSG_GENERAL = 'Use a new controller instead of custom actions.'
|
6
8
|
MSG_RESOURCE_ONLY = "Resource route refers to a non-standard action in it's 'only:' param. #{MSG_GENERAL}".freeze
|
7
9
|
MSG_ROUTE_TO = "Route goes to a non-standard controller action. #{MSG_GENERAL}".freeze
|
8
10
|
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RuboCop
|
2
4
|
module Cop
|
3
5
|
module Betterment
|
4
6
|
class SitePrismLoaded < Cop
|
5
|
-
MSG = 'Use `be_loaded` instead of `be_displayed`'
|
7
|
+
MSG = 'Use `be_loaded` instead of `be_displayed`'
|
6
8
|
|
7
9
|
def_node_matcher :be_displayed_call?, <<-PATTERN
|
8
10
|
(send (send nil? :expect _) _ (send nil? :be_displayed))
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RuboCop
|
2
4
|
module Cop
|
3
5
|
module Betterment
|
@@ -13,7 +15,7 @@ module RuboCop
|
|
13
15
|
# spec/models/my_class_spec.rb
|
14
16
|
# require 'rails_helper'
|
15
17
|
class SpecHelperRequiredOutsideSpecDir < Cop
|
16
|
-
MSG = 'Spec helper required outside of a spec/ directory.'
|
18
|
+
MSG = 'Spec helper required outside of a spec/ directory.'
|
17
19
|
|
18
20
|
def_node_matcher :requires_spec_helper?, <<-PATTERN
|
19
21
|
(send nil? :require
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RuboCop
|
2
4
|
module Cop
|
3
5
|
module Betterment
|
4
6
|
class Timeout < Cop
|
5
|
-
MSG = 'Using Timeout.timeout without a custom exception can prevent rescue blocks from executing'
|
7
|
+
MSG = 'Using Timeout.timeout without a custom exception can prevent rescue blocks from executing'
|
6
8
|
|
7
9
|
def_node_matcher :timeout_call?, <<-PATTERN
|
8
10
|
(send (const nil? :Timeout) :timeout _)
|
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RuboCop
|
2
4
|
module Cop
|
3
5
|
module Betterment
|
4
6
|
class UnsafeJob < Cop
|
5
7
|
attr_accessor :sensitive_params, :class_regex
|
6
8
|
|
7
|
-
MSG = <<~MSG
|
9
|
+
MSG = <<~MSG
|
8
10
|
This job takes a parameter that will end up serialized in plaintext. Do not pass sensitive data as bare arguments into jobs.
|
9
11
|
|
10
12
|
See here for more information on this error:
|
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RuboCop
|
2
4
|
module Cop
|
3
5
|
module Betterment
|
4
6
|
class UnscopedFind < Cop
|
5
7
|
attr_accessor :unauthenticated_models
|
6
8
|
|
7
|
-
MSG = <<~MSG
|
9
|
+
MSG = <<~MSG
|
8
10
|
Records are being retrieved directly using user input.
|
9
11
|
Please query for the associated record in a way that enforces authorization (e.g. "trust-root chaining").
|
10
12
|
|
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RuboCop
|
2
4
|
module Cop
|
3
5
|
module Betterment
|
4
6
|
class VagueSerialize < Base
|
5
7
|
MSG = 'Active Record models with serialized columns should specify which ' \
|
6
|
-
'deserializer to use instead of falling back to the default.'
|
8
|
+
'deserializer to use instead of falling back to the default.'
|
7
9
|
|
8
10
|
# @!method serialize?(node)
|
9
11
|
def_node_matcher :serialize?, <<-PATTERN
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: betterlint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Development
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0'
|
131
131
|
requirements: []
|
132
|
-
rubygems_version: 3.4.
|
132
|
+
rubygems_version: 3.4.20
|
133
133
|
signing_key:
|
134
134
|
specification_version: 4
|
135
135
|
summary: Betterment rubocop configuration
|