do_not_use 0.1.0 → 0.2.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 +4 -4
- data/README.md +1 -1
- data/lib/do_not_use/instruction.rb +4 -4
- data/lib/do_not_use/location.rb +3 -1
- data/lib/do_not_use/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: b93787f765735c96304881e364255c8c0fe8a664b43bc737a2b43a4ad0e6cbda
|
|
4
|
+
data.tar.gz: 3004281bae0b9d14dcd6a255990db6ba301d0798b8f42c09b94efffa1709eebf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 690b17642309d4bb33d17b24641df0ab00321db20c6b223765d51ced50a8007e61a12992f51666f0a36f61f3f3f99fface0b2bd8d7735cdb2243bd3ab827b163
|
|
7
|
+
data.tar.gz: 6bcd554bc83be5bc8ab01e4e4f95add790b16a0a5609b5377f8b972135fd62a3aef1b5a822541ae7bf6ea893519a63f8aceff77ab0572d9ff8aa91fa9a265ff6
|
data/README.md
CHANGED
|
@@ -112,7 +112,7 @@ DoNotUse.configure do |config|
|
|
|
112
112
|
config.ignored_paths << Rails.root.join("spec") # The paths which you don't want to track.
|
|
113
113
|
config.exceptions_yaml_path = Rails.root.join("exceptions.yaml") # The YAML file path where you specify existing usages of the deprecated APIs.
|
|
114
114
|
config.signature_generators = {
|
|
115
|
-
Rails.root.join("spec", "models") => Proc.new { |instruction| ... }
|
|
115
|
+
Proc.new { |location| location.starts_with?(Rails.root.join("spec", "models").to_s) } => Proc.new { |instruction| ... }
|
|
116
116
|
} # Helps you configure how the instruction signatures are generated for the ignored paths.
|
|
117
117
|
end
|
|
118
118
|
```
|
|
@@ -34,6 +34,10 @@ module DoNotUse
|
|
|
34
34
|
!location.track? && inherited_method?
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
+
def location
|
|
38
|
+
@location ||= Location.new(source_path)
|
|
39
|
+
end
|
|
40
|
+
|
|
37
41
|
delegate :frame_type, to: :binding
|
|
38
42
|
delegate :signature_generator, to: :location
|
|
39
43
|
|
|
@@ -52,10 +56,6 @@ module DoNotUse
|
|
|
52
56
|
Location.new(receiver_source_path.first)
|
|
53
57
|
end
|
|
54
58
|
|
|
55
|
-
def location
|
|
56
|
-
@location ||= Location.new(source_path)
|
|
57
|
-
end
|
|
58
|
-
|
|
59
59
|
def inherited_method?
|
|
60
60
|
receiver != method_owner
|
|
61
61
|
end
|
data/lib/do_not_use/location.rb
CHANGED
|
@@ -15,9 +15,11 @@ module DoNotUse
|
|
|
15
15
|
#
|
|
16
16
|
# This allows users to define signatures for those instructions as they see fit.
|
|
17
17
|
def signature_generator
|
|
18
|
-
signature_generators.find { |
|
|
18
|
+
signature_generators.find { |proc, _| proc.call(self) }&.second
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
+
delegate :starts_with?, to: :source_path
|
|
22
|
+
|
|
21
23
|
private
|
|
22
24
|
|
|
23
25
|
attr_reader :source_path
|
data/lib/do_not_use/version.rb
CHANGED