stimulus-audit 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stimulus_audit/auditor.rb +5 -3
- data/lib/stimulus_audit/configuration.rb +4 -4
- data/lib/stimulus_audit/railtie.rb +4 -0
- data/lib/stimulus_audit/version.rb +1 -1
- data/lib/stimulus_audit.rb +3 -3
- 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: 44aec4de9edc55269fa1f50a6c6320d53a5f4f829c842664f34abe0deca73f9a
|
4
|
+
data.tar.gz: f1a8807907157c4d7fe597868d89d784747f7c3ee17f1e9ee7d8163137aa6518
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a23584890601a2c8cef266804f0e1e78d49433a98acb9af9ea6d60a8ae08fb0649c4d2c15462cc54e06abff550ffc488cf216be46d996baec6dde7a7f5fe2f7
|
7
|
+
data.tar.gz: ce44e110b93cc136fc0827e11c759be1f30df8da008136956273a840664129528bd3bd9c3ef9ab7fca57027303b49024a6018336489df58bd51d6fcf0da2bb62
|
@@ -34,8 +34,8 @@ module StimulusAudit
|
|
34
34
|
controller_path = full_path.each_filename.to_a[(controllers_dir + 1)..]
|
35
35
|
# Remove _controller.js from the last component
|
36
36
|
controller_path[-1] = controller_path[-1].sub(/_controller\.(js|ts)$/, "")
|
37
|
-
# Join with -- for namespacing
|
38
|
-
name = controller_path.join("--")
|
37
|
+
# Join with -- for namespacing and convert underscores to hyphens
|
38
|
+
name = controller_path.join("--").gsub("_", "-")
|
39
39
|
controllers << name
|
40
40
|
end
|
41
41
|
end
|
@@ -54,8 +54,10 @@ module StimulusAudit
|
|
54
54
|
content = File.read(file)
|
55
55
|
patterns.each do |pattern|
|
56
56
|
content.scan(pattern) do |match|
|
57
|
-
# Split in case of multiple controllers
|
57
|
+
# Split in case of multiple controllers
|
58
58
|
match[0].split(/\s+/).each do |controller|
|
59
|
+
# Store controller names exactly as they appear in the view
|
60
|
+
# (they should already have hyphens as per Stimulus conventions)
|
59
61
|
controllers << controller
|
60
62
|
end
|
61
63
|
end
|
@@ -12,13 +12,13 @@ module StimulusAudit
|
|
12
12
|
base_path = StimulusAudit.root
|
13
13
|
|
14
14
|
@view_paths = [
|
15
|
-
base_path.join(
|
16
|
-
base_path.join(
|
17
|
-
base_path.join(
|
15
|
+
base_path.join("app/views/**/*.{html,erb,haml}").to_s,
|
16
|
+
base_path.join("app/javascript/**/*.{js,jsx}").to_s,
|
17
|
+
base_path.join("app/components/**/*.{html,erb,haml,rb}").to_s
|
18
18
|
]
|
19
19
|
|
20
20
|
@controller_paths = [
|
21
|
-
base_path.join(
|
21
|
+
base_path.join("app/javascript/controllers/**/*.{js,ts}").to_s
|
22
22
|
]
|
23
23
|
end
|
24
24
|
end
|
data/lib/stimulus_audit.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "set"
|
4
|
+
require "pathname"
|
5
5
|
require "stimulus_audit/version"
|
6
6
|
require "stimulus_audit/configuration"
|
7
7
|
require "stimulus_audit/auditor"
|
@@ -9,7 +9,7 @@ require "stimulus_audit/scanner"
|
|
9
9
|
|
10
10
|
if defined?(Rails)
|
11
11
|
require "rails"
|
12
|
-
require "stimulus_audit/railtie"
|
12
|
+
require "stimulus_audit/railtie"
|
13
13
|
end
|
14
14
|
|
15
15
|
module StimulusAudit
|