betterlint 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 583f9b1d4c78270257202f26d509a0f262e41da066da447d88b868f1631f73fe
4
- data.tar.gz: 246b11e285e7631a944b358f41603c438bf8677539189a6fa5de7817c464995a
3
+ metadata.gz: 71ba27a1b021ee2c1543aba5603245ae2631a64525c7c7e5338457b1296c66a6
4
+ data.tar.gz: e3c21186976d7d503c890cd4e0c8fed99d5c6f6ae20071a17fa697e9c4928ea7
5
5
  SHA512:
6
- metadata.gz: ad19a059466a165bfe7bd9ec1a6dc8db2e86f9ec2c9f0e32bde0f09a5ce7703d60a60e9c79981cb0c073dac33789b99d636185bbbd5ffaab3065f9d21d161b17
7
- data.tar.gz: '092f3ca327562d77edc0def71aa2ee62d86d3e0175c341e3fa4f38c9af380b888203e4642655b6e66aa5bc0483f35a1152ac5d38b65efcfc19406e20b6823b8c'
6
+ metadata.gz: '048543b98c55befe6f306446a132f6f561598bf19ab9ffc4f74c6eb90b7ea5aa1d78d56594c34a2c8c6da7d79462329b8dadc8868af620fe53084189e7f6d604'
7
+ data.tar.gz: 35388c596e5edc116860dd60796313b9d6569326e77929b5e05b0f48f6f13067534684ec9d37904e140ba4b2dea93f8e243e10ead8196ee1eaba34e6b600d898
data/config/default.yml CHANGED
@@ -292,7 +292,7 @@ Style/Documentation:
292
292
  Enabled: false
293
293
 
294
294
  Style/FrozenStringLiteralComment:
295
- Enabled: false
295
+ Enabled: true
296
296
 
297
297
  Style/GuardClause:
298
298
  Enabled: false
@@ -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 ActiveJobPerformable < Cop
5
- MSG = <<~DOC.freeze
7
+ MSG = <<~DOC
6
8
  Classes that are "performable" should be ActiveJobs
7
9
 
8
10
  class MyJob < ApplicationJob
@@ -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.freeze
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.freeze
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.freeze
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.'.freeze
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'.freeze
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)'.freeze
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.'.freeze
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.'.freeze
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`'.freeze
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.'.freeze
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'.freeze
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.freeze
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.freeze
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,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RuboCop
2
4
  module Cop
3
5
  module Betterment
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RuboCop
2
4
  module Cop
3
5
  module Betterment
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RuboCop
2
4
  module Cop
3
5
  module Betterment
@@ -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.'.freeze
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubocop'
2
4
  require 'rubocop/cop/betterment/utils/parser'
3
5
  require 'rubocop/cop/betterment/utils/method_return_table'
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.5.0
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-09-29 00:00:00.000000000 Z
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.19
132
+ rubygems_version: 3.4.20
133
133
  signing_key:
134
134
  specification_version: 4
135
135
  summary: Betterment rubocop configuration