immosquare-cleaner 0.1.52 → 0.1.53

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: 66d3816eb05bdddc44b9f698c183dcf179f93c98514a4da899695395d7ca814a
4
- data.tar.gz: a3aafdfa9ce2e399346147641d6eec3d327fdb95cfb8a17a89171c6d4be1c52f
3
+ metadata.gz: 9196f9f8512b09892046a08e62a7d88651c64a303de24c06939f879892e52cf7
4
+ data.tar.gz: ebb02f2943eec1220d90bd122fb8eb74e93924e08e140d03d869dc9a046f2f35
5
5
  SHA512:
6
- metadata.gz: 7ddd04828f677c3f025408b92627330182c40616d6c2fdb51f1f4e0287c2e41f3cc400379f13c7db1c1d3a8f934c379d667b8a08a6c0504289dd3c1c9942c312
7
- data.tar.gz: 49e5bb957d7c5eade116eed5f673284fc603c52fcbc0e826f304acaf009de31cb4cb2c2e1088c27196ea4c885c1e0fc8b572243533a0b86d077456b83418c54c
6
+ metadata.gz: fad7b547a77506b0c92bc672a395e0ccee00ca2f7092fb838d9b621138e059bd57bc74e5317d0fbb4228a65899d1c591704e2f30fa8e0118afa0ce65c133da3a
7
+ data.tar.gz: ea5754c29eaf9d6bcd7f2e7b1531808d8a540a021f28f446d36cbd159ccd400c33cf2a1ed691da9b43ce096bf86408f5b4f625f3ed897d417029daa336b6e1da
@@ -1,3 +1,3 @@
1
1
  module ImmosquareCleaner
2
- VERSION = "0.1.52".freeze
2
+ VERSION = "0.1.53".freeze
3
3
  end
@@ -72,7 +72,7 @@ module ImmosquareCleaner
72
72
  File.write(rubocop_config_with_version_path, rubocop_config.to_yaml)
73
73
  end
74
74
 
75
- cmds = ["bundle exec rubocop -c #{rubocop_config_with_version_path} #{file_path} #{ImmosquareCleaner.configuration.rubocop_options || "--autocorrect-all"}"]
75
+ cmds = ["bundle exec rubocop -c #{rubocop_config_with_version_path} \"#{file_path}\" #{ImmosquareCleaner.configuration.rubocop_options || "--autocorrect-all"}"]
76
76
  launch_cmds(cmds)
77
77
  File.normalize_last_line(file_path)
78
78
  return
@@ -0,0 +1,40 @@
1
+ module RuboCop
2
+ module Cop
3
+ module CustomCops
4
+ module Style
5
+ ##============================================================##
6
+ ## Custom Cop: UseCredentialsInsteadOfEnv
7
+ ## To replace ENV.fetch with Rails.application.credentials
8
+ ##============================================================##
9
+ class UseCredentialsInsteadOfEnv < Base
10
+
11
+ extend AutoCorrector
12
+
13
+ MSG = "Use Rails.application.credentials instead of ENV.fetch".freeze
14
+
15
+ ##============================================================##
16
+ ## Node Matcher
17
+ ##============================================================##
18
+ def_node_matcher :env_fetch?, <<~PATTERN
19
+ (send (const nil? :ENV) :fetch ...)
20
+ PATTERN
21
+
22
+ def on_send(node)
23
+ return if !env_fetch?(node)
24
+
25
+ ##============================================================##
26
+ ## ENV.fetch("hello_world", nil) => Rails.application.credentials.hello_world
27
+ ## ENV.fetch("hello_world_#{user_id}", nil) => Rails.application.credentials["hello_world_#{user_id}"]
28
+ ##============================================================##
29
+ add_offense(node) do |corrector|
30
+ key = node.arguments.first
31
+ value = key.type == :dstr ? "[#{key.source}]" : ".#{key.source.delete('"')}"
32
+ corrector.replace(node, "Rails.application.credentials#{value}")
33
+ end
34
+ end
35
+
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -1,5 +1,7 @@
1
1
  ---
2
- require: rubocop/cop/style/method_call_with_args_parentheses_override
2
+ require:
3
+ - rubocop/cop/style/method_call_with_args_parentheses_override
4
+ - rubocop/cop/custom_cops/style/use_credentials_instead_of_env
3
5
  AllCops:
4
6
  NewCops: enable
5
7
  EnabledByDefault: false
@@ -19,7 +21,7 @@ Naming/VariableNumber:
19
21
  Enabled: false
20
22
  Naming/FileName:
21
23
  Enabled: false
22
- MethodParameterName:
24
+ Naming/MethodParameterName:
23
25
  MinNameLength: 1
24
26
  Layout/LeadingEmptyLines:
25
27
  Enabled: false
@@ -73,8 +75,6 @@ Style/IfUnlessModifierOfIfUnless:
73
75
  Enabled: false
74
76
  Style/NegatedIf:
75
77
  Enabled: false
76
- Style/MethodCallWithArgsParentheses:
77
- Enabled: true
78
78
  Style/FormatStringToken:
79
79
  EnforcedStyle: template
80
80
  Style/NumericPredicate:
@@ -89,5 +89,9 @@ Style/WordArray:
89
89
  EnforcedStyle: brackets
90
90
  Style/SymbolArray:
91
91
  EnforcedStyle: brackets
92
+ Style/MethodCallWithArgsParentheses:
93
+ Enabled: true
94
+ CustomCops/Style/UseCredentialsInsteadOfEnv:
95
+ Enabled: true
92
96
  Gemspec/RequireMFA:
93
97
  Enabled: false
data/linters/rubocop.yml CHANGED
@@ -1,4 +1,6 @@
1
- require: rubocop/cop/style/method_call_with_args_parentheses_override
1
+ require:
2
+ - rubocop/cop/style/method_call_with_args_parentheses_override
3
+ - rubocop/cop/custom_cops/style/use_credentials_instead_of_env
2
4
 
3
5
  # Pour activer toutes les méthodes de Rubocop et activer le cache pour les gros fichiers
4
6
  AllCops:
@@ -25,7 +27,7 @@ Naming/VariableNumber:
25
27
  Enabled: false # On veut pouvour utiliser administrative_area_level_1 avec cette synthase
26
28
  Naming/FileName:
27
29
  Enabled: false # on veut pouvoir faire des nom de fichier avec des - immosquare-cleaner.rb
28
- MethodParameterName:
30
+ Naming/MethodParameterName:
29
31
  MinNameLength: 1 # On veut pouvoir utiliser des noms de paramètres de 1 caractère
30
32
 
31
33
  #################### Layout ###########################
@@ -84,11 +86,8 @@ Style/IfUnlessModifierOfIfUnless:
84
86
  Enabled: false # On veut pourvoir mettre un if à la fin de end
85
87
  Style/NegatedIf:
86
88
  Enabled: false # On veut remplacer les if ! par des unless
87
- Style/MethodCallWithArgsParentheses:
88
- Enabled: true # On veut forcer les parenthèses où elles sont utilises pour rendre le code plus propre
89
89
  Style/FormatStringToken:
90
90
  EnforcedStyle: "template" ## On veut les interpolation avec le format %{my_string} et avec avec %<my_string>s
91
-
92
91
  Style/NumericPredicate:
93
92
  EnforcedStyle: comparison # On ne veut pas des .zero? .negative? .positif?
94
93
  Style/StringLiterals:
@@ -102,6 +101,14 @@ Style/WordArray:
102
101
  Style/SymbolArray:
103
102
  EnforcedStyle: brackets # Pour formater les arrays de la forme [:a, :b, :c] et pas %i[a b c]
104
103
 
104
+ #################### OVERWRITE ###########################
105
+ Style/MethodCallWithArgsParentheses:
106
+ Enabled: true # On veut forcer les parenthèses où elles sont utilises pour rendre le code plus propre
107
+
108
+ #################### CUSTOMS ###########################
109
+ CustomCops/Style/UseCredentialsInsteadOfEnv:
110
+ Enabled: true # On veut forcer l'utilisation de credentials au lieu de ENV pour les secrets
111
+
105
112
  #################### GEM ###########################
106
113
  Gemspec/RequireMFA:
107
114
  Enabled: false # On ne veut pas obliger le MFA pour pusher un gem
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: immosquare-cleaner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.52
4
+ version: 0.1.53
5
5
  platform: ruby
6
+ original_platform: ''
6
7
  authors:
7
8
  - immosquare
8
- autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-27 00:00:00.000000000 Z
11
+ date: 2024-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: erb_lint
@@ -119,9 +119,9 @@ files:
119
119
  - linters/eslint.config.mjs
120
120
  - linters/jscodeshift/arrow-function-transform.js
121
121
  - linters/prettier.yml
122
- - linters/rubocop-3.3.4.yml
123
122
  - linters/rubocop-3.3.6.yml
124
123
  - linters/rubocop.yml
124
+ - linters/rubocop/cop/custom_cops/style/use_credentials_instead_of_env.rb
125
125
  - linters/rubocop/cop/style/method_call_with_args_parentheses_override.rb
126
126
  - node_modules/.bin/acorn
127
127
  - node_modules/.bin/babylon
@@ -34463,7 +34463,6 @@ homepage: https://github.com/immosquare/Immosquare-cleaner
34463
34463
  licenses:
34464
34464
  - MIT
34465
34465
  metadata: {}
34466
- post_install_message:
34467
34466
  rdoc_options: []
34468
34467
  require_paths:
34469
34468
  - lib
@@ -34479,8 +34478,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
34479
34478
  - !ruby/object:Gem::Version
34480
34479
  version: '0'
34481
34480
  requirements: []
34482
- rubygems_version: 3.5.22
34483
- signing_key:
34481
+ rubygems_version: 3.6.1
34484
34482
  specification_version: 4
34485
34483
  summary: A gem to lint and organize files in a Rails application.
34486
34484
  test_files: []
@@ -1,93 +0,0 @@
1
- ---
2
- require: rubocop/cop/style/method_call_with_args_parentheses_override
3
- AllCops:
4
- NewCops: enable
5
- EnabledByDefault: false
6
- UseCache: true
7
- SuggestExtensions: false
8
- ActiveSupportExtensionsEnabled: true
9
- TargetRubyVersion: 3.3.4
10
- Metrics:
11
- Enabled: false
12
- Lint/UselessAssignment:
13
- Enabled: false
14
- Lint/RescueException:
15
- Enabled: false
16
- Lint/UnusedMethodArgument:
17
- Enabled: false
18
- Naming/VariableNumber:
19
- Enabled: false
20
- Naming/FileName:
21
- Enabled: false
22
- MethodParameterName:
23
- MinNameLength: 1
24
- Layout/LeadingEmptyLines:
25
- Enabled: false
26
- Layout/InitialIndentation:
27
- Enabled: false
28
- Layout/TrailingEmptyLines:
29
- Enabled: false
30
- Layout/ExtraSpacing:
31
- Enabled: false
32
- Layout/LineLength:
33
- Enabled: false
34
- Layout/TrailingWhitespace:
35
- Enabled: true
36
- Layout/EmptyLines:
37
- Enabled: false
38
- Layout/SpaceInsideBlockBraces:
39
- SpaceBeforeBlockParameters: false
40
- Layout/EmptyLinesAroundClassBody:
41
- EnforcedStyle: empty_lines
42
- Layout/FirstHashElementIndentation:
43
- EnforcedStyle: consistent
44
- Layout/ArgumentAlignment:
45
- EnforcedStyle: with_fixed_indentation
46
- Layout/HashAlignment:
47
- EnforcedHashRocketStyle: table
48
- Layout/MultilineAssignmentLayout:
49
- EnforcedStyle: same_line
50
- Layout/SpaceInsideHashLiteralBraces:
51
- EnforcedStyle: no_space
52
- Layout/MultilineMethodCallIndentation:
53
- EnforcedStyle: indented
54
- Style/CombinableLoops:
55
- Enabled: false
56
- Style/SingleArgumentDig:
57
- Enabled: false
58
- Style/RedundantBegin:
59
- Enabled: false
60
- Style/MultilineTernaryOperator:
61
- Enabled: false
62
- Style/NestedTernaryOperator:
63
- Enabled: false
64
- Style/MultilineIfModifier:
65
- Enabled: false
66
- Style/FrozenStringLiteralComment:
67
- Enabled: false
68
- Style/Next:
69
- Enabled: false
70
- Style/Documentation:
71
- Enabled: false
72
- Style/IfUnlessModifierOfIfUnless:
73
- Enabled: false
74
- Style/NegatedIf:
75
- Enabled: false
76
- Style/MethodCallWithArgsParentheses:
77
- Enabled: true
78
- Style/FormatStringToken:
79
- EnforcedStyle: template
80
- Style/NumericPredicate:
81
- EnforcedStyle: comparison
82
- Style/StringLiterals:
83
- EnforcedStyle: double_quotes
84
- Style/StringLiteralsInInterpolation:
85
- EnforcedStyle: double_quotes
86
- Style/HashSyntax:
87
- EnforcedStyle: hash_rockets
88
- Style/WordArray:
89
- EnforcedStyle: brackets
90
- Style/SymbolArray:
91
- EnforcedStyle: brackets
92
- Gemspec/RequireMFA:
93
- Enabled: false