sevencop 0.26.0 → 0.26.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rubocop/cop/sevencop/rails_date_and_time_calculation.rb +23 -12
- data/lib/sevencop/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ae1550d29e9e7aeb18b9f63d2e8f167ef5a7d871f2e953551e7be6c86038430
|
4
|
+
data.tar.gz: fba303001375952d8f8f1e3de021a9a5b155adc79440bb526342391c81be2a9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a32371dd923b0922ae7072b11d6917cf876eec46061a3fe0a7229a5bac2713d77b66f75ef7259f15838173d20dbd7f039dcb4af0ce0c456216091906eda7f6c4
|
7
|
+
data.tar.gz: a5cece615fd407987d77a5e7d5db08ef78c816a07c3330da17fdd5d778552dfd4ff1d249d044b95540ce06a04b873623853b42a5e466bbe4d389fb284784f75a
|
data/Gemfile.lock
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'set'
|
4
|
+
|
3
5
|
module RuboCop
|
4
6
|
module Cop
|
5
7
|
module Sevencop
|
@@ -425,10 +427,9 @@ module RuboCop
|
|
425
427
|
)
|
426
428
|
corrector.replace(
|
427
429
|
node,
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
time: find_comparison_subject_to_time_current(node).source
|
430
|
+
format_to_method_call(
|
431
|
+
method: helper_method_name_for_comparison(node),
|
432
|
+
receiver: find_comparison_subject_to_time_current(node)
|
432
433
|
)
|
433
434
|
)
|
434
435
|
end
|
@@ -444,10 +445,9 @@ module RuboCop
|
|
444
445
|
)
|
445
446
|
corrector.replace(
|
446
447
|
node,
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
helper_method_name: helper_method_name
|
448
|
+
format_to_method_call(
|
449
|
+
method: helper_method_name,
|
450
|
+
receiver: node.first_argument
|
451
451
|
)
|
452
452
|
)
|
453
453
|
end
|
@@ -465,10 +465,9 @@ module RuboCop
|
|
465
465
|
)
|
466
466
|
corrector.replace(
|
467
467
|
node,
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
helper_method_name: helper_method_name
|
468
|
+
format_to_method_call(
|
469
|
+
method: helper_method_name,
|
470
|
+
receiver: find_equality_subject_to_date_with(node, date_method_name)
|
472
471
|
)
|
473
472
|
)
|
474
473
|
end
|
@@ -736,6 +735,18 @@ module RuboCop
|
|
736
735
|
end
|
737
736
|
end
|
738
737
|
|
738
|
+
# @param receiver [RuboCop::AST::Node]
|
739
|
+
# @param method [String]
|
740
|
+
# @return [String]
|
741
|
+
def format_to_method_call(
|
742
|
+
method:,
|
743
|
+
receiver:
|
744
|
+
)
|
745
|
+
receiver_source = receiver.source
|
746
|
+
receiver_source = "(#{receiver_source})" if receiver.operator_method?
|
747
|
+
[receiver_source, method].join('.')
|
748
|
+
end
|
749
|
+
|
739
750
|
# @param node [RuboCop::AST::SendNode]
|
740
751
|
# @return [Symbol]
|
741
752
|
def helper_method_name_for_comparison(node)
|
data/lib/sevencop/version.rb
CHANGED