packwerk 2.2.0 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +29 -20
  3. data/.github/workflows/cla.yml +22 -0
  4. data/.rubocop.yml +48 -19
  5. data/Gemfile +7 -2
  6. data/Gemfile.lock +202 -175
  7. data/README.md +1 -1
  8. data/RESOLVING_VIOLATIONS.md +81 -0
  9. data/Rakefile +1 -1
  10. data/USAGE.md +14 -5
  11. data/bin/m +1 -1
  12. data/bin/rake +1 -1
  13. data/bin/rubocop +1 -1
  14. data/bin/srb +1 -1
  15. data/bin/tapioca +1 -1
  16. data/gemfiles/Gemfile-rails-6-0 +1 -1
  17. data/gemfiles/Gemfile-rails-6-1 +22 -0
  18. data/lib/packwerk/application_load_paths.rb +1 -1
  19. data/lib/packwerk/application_validator.rb +7 -6
  20. data/lib/packwerk/association_inspector.rb +17 -15
  21. data/lib/packwerk/cache.rb +36 -29
  22. data/lib/packwerk/cli.rb +24 -20
  23. data/lib/packwerk/const_node_inspector.rb +8 -7
  24. data/lib/packwerk/constant_name_inspector.rb +2 -2
  25. data/lib/packwerk/deprecated_references.rb +40 -20
  26. data/lib/packwerk/file_processor.rb +14 -14
  27. data/lib/packwerk/files_for_processing.rb +27 -31
  28. data/lib/packwerk/formatters/offenses_formatter.rb +3 -3
  29. data/lib/packwerk/formatters/progress_formatter.rb +2 -2
  30. data/lib/packwerk/node.rb +1 -294
  31. data/lib/packwerk/node_helpers.rb +335 -0
  32. data/lib/packwerk/node_processor.rb +6 -5
  33. data/lib/packwerk/node_processor_factory.rb +3 -3
  34. data/lib/packwerk/node_visitor.rb +1 -1
  35. data/lib/packwerk/offense_collection.rb +27 -8
  36. data/lib/packwerk/offenses_formatter.rb +2 -2
  37. data/lib/packwerk/package.rb +3 -0
  38. data/lib/packwerk/package_set.rb +2 -0
  39. data/lib/packwerk/parse_run.rb +29 -20
  40. data/lib/packwerk/parsed_constant_definitions.rb +23 -20
  41. data/lib/packwerk/parsers/erb.rb +3 -3
  42. data/lib/packwerk/reference_checking/checkers/checker.rb +16 -3
  43. data/lib/packwerk/reference_checking/checkers/dependency_checker.rb +16 -0
  44. data/lib/packwerk/reference_checking/checkers/privacy_checker.rb +18 -0
  45. data/lib/packwerk/reference_checking/reference_checker.rb +3 -1
  46. data/lib/packwerk/reference_extractor.rb +51 -48
  47. data/lib/packwerk/reference_offense.rb +3 -27
  48. data/lib/packwerk/run_context.rb +9 -8
  49. data/lib/packwerk/spring_command.rb +1 -1
  50. data/lib/packwerk/version.rb +1 -1
  51. data/lib/packwerk.rb +1 -0
  52. data/packwerk.gemspec +5 -12
  53. data/sorbet/rbi/gems/actioncable@7.0.3.1.rbi +2754 -0
  54. data/sorbet/rbi/gems/actionmailbox@7.0.3.1.rbi +1496 -0
  55. data/sorbet/rbi/gems/actionmailer@7.0.3.1.rbi +2362 -0
  56. data/sorbet/rbi/gems/actionpack@7.0.3.1.rbi +19397 -0
  57. data/sorbet/rbi/gems/actiontext@7.0.3.1.rbi +1569 -0
  58. data/sorbet/rbi/gems/actionview@7.0.3.1.rbi +14907 -0
  59. data/sorbet/rbi/gems/activejob@7.0.3.1.rbi +2553 -0
  60. data/sorbet/rbi/gems/activemodel@7.0.3.1.rbi +5999 -0
  61. data/sorbet/rbi/gems/activerecord@7.0.3.1.rbi +37832 -0
  62. data/sorbet/rbi/gems/activestorage@7.0.3.1.rbi +2321 -0
  63. data/sorbet/rbi/gems/activesupport@7.0.3.1.rbi +18818 -0
  64. data/sorbet/rbi/gems/concurrent-ruby@1.1.10.rbi +11722 -0
  65. data/sorbet/rbi/gems/constant_resolver@0.2.0.rbi +90 -0
  66. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1079 -0
  67. data/sorbet/rbi/gems/digest@3.1.0.rbi +189 -0
  68. data/sorbet/rbi/gems/erubi@1.11.0.rbi +140 -0
  69. data/sorbet/rbi/gems/globalid@1.0.0.rbi +572 -0
  70. data/sorbet/rbi/gems/i18n@1.12.0.rbi +2296 -0
  71. data/sorbet/rbi/gems/json@2.6.2.rbi +1548 -0
  72. data/sorbet/rbi/gems/language_server-protocol@3.16.0.3.rbi +8 -0
  73. data/sorbet/rbi/gems/loofah@2.18.0.rbi +877 -0
  74. data/sorbet/rbi/gems/m@1.6.0.rbi +257 -0
  75. data/sorbet/rbi/gems/marcel@1.0.2.rbi +220 -0
  76. data/sorbet/rbi/gems/mini_mime@1.1.2.rbi +170 -0
  77. data/sorbet/rbi/gems/mini_portile2@2.8.0.rbi +8 -0
  78. data/sorbet/rbi/gems/minitest-focus@1.3.1.rbi +104 -0
  79. data/sorbet/rbi/gems/minitest@5.16.2.rbi +2136 -0
  80. data/sorbet/rbi/gems/mocha@1.14.0.rbi +4177 -0
  81. data/sorbet/rbi/gems/net-imap@0.2.3.rbi +2147 -0
  82. data/sorbet/rbi/gems/net-pop@0.1.1.rbi +926 -0
  83. data/sorbet/rbi/gems/net-protocol@0.1.3.rbi +11 -0
  84. data/sorbet/rbi/gems/net-smtp@0.3.1.rbi +1108 -0
  85. data/sorbet/rbi/gems/netrc@0.11.0.rbi +153 -0
  86. data/sorbet/rbi/gems/nio4r@2.5.8.rbi +292 -0
  87. data/sorbet/rbi/gems/nokogiri@1.13.8.rbi +6478 -0
  88. data/sorbet/rbi/gems/parallel@1.22.1.rbi +277 -0
  89. data/sorbet/rbi/gems/parser@3.1.2.1.rbi +9029 -0
  90. data/sorbet/rbi/gems/prettier_print@0.1.0.rbi +8 -0
  91. data/sorbet/rbi/gems/pry@0.14.1.rbi +8 -0
  92. data/sorbet/rbi/gems/racc@1.6.0.rbi +152 -0
  93. data/sorbet/rbi/gems/rack-test@2.0.2.rbi +953 -0
  94. data/sorbet/rbi/gems/rack@2.2.4.rbi +5636 -0
  95. data/sorbet/rbi/gems/rails-html-sanitizer@1.4.3.rbi +688 -0
  96. data/sorbet/rbi/gems/rails@7.0.3.1.rbi +8 -0
  97. data/sorbet/rbi/gems/railties@7.0.3.1.rbi +3507 -0
  98. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +392 -0
  99. data/sorbet/rbi/gems/rake@13.0.6.rbi +2924 -0
  100. data/sorbet/rbi/gems/rbi@0.0.15.rbi +3007 -0
  101. data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +3383 -0
  102. data/sorbet/rbi/gems/rexml@3.2.5.rbi +4714 -0
  103. data/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi +6961 -0
  104. data/sorbet/rbi/gems/rubocop-performance@1.14.3.rbi +2986 -0
  105. data/sorbet/rbi/gems/{rubocop-shopify@2.0.1.rbi → rubocop-shopify@2.9.0.rbi} +4 -4
  106. data/sorbet/rbi/gems/rubocop-sorbet@0.6.11.rbi +992 -0
  107. data/sorbet/rbi/gems/rubocop@1.34.1.rbi +51820 -0
  108. data/sorbet/rbi/gems/ruby-lsp@0.2.1.rbi +11 -0
  109. data/sorbet/rbi/gems/smart_properties@1.17.0.rbi +474 -0
  110. data/sorbet/rbi/gems/spoom@1.1.11.rbi +2181 -0
  111. data/sorbet/rbi/gems/spring@4.0.0.rbi +411 -0
  112. data/sorbet/rbi/gems/strscan@3.0.4.rbi +8 -0
  113. data/sorbet/rbi/gems/syntax_tree@3.3.0.rbi +8 -0
  114. data/sorbet/rbi/gems/tapioca@0.9.2.rbi +3181 -0
  115. data/sorbet/rbi/gems/thor@1.2.1.rbi +3956 -0
  116. data/sorbet/rbi/gems/timeout@0.3.0.rbi +142 -0
  117. data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +5896 -0
  118. data/sorbet/rbi/gems/unicode-display_width@2.2.0.rbi +48 -0
  119. data/sorbet/rbi/gems/unparser@0.6.5.rbi +4529 -0
  120. data/sorbet/rbi/gems/webrick@1.7.0.rbi +2582 -0
  121. data/sorbet/rbi/gems/websocket-driver@0.7.5.rbi +993 -0
  122. data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +388 -0
  123. data/sorbet/rbi/gems/yard@0.9.28.rbi +18242 -0
  124. data/sorbet/rbi/gems/zeitwerk@2.6.0.rbi +867 -0
  125. data/sorbet/rbi/shims/psych.rbi +5 -0
  126. data/sorbet/tapioca/require.rb +2 -3
  127. metadata +91 -146
  128. data/.github/probots.yml +0 -2
  129. data/library.yml +0 -6
  130. data/service.yml +0 -1
  131. data/sorbet/rbi/gems/actioncable@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -860
  132. data/sorbet/rbi/gems/actionmailbox@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -568
  133. data/sorbet/rbi/gems/actionmailer@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -587
  134. data/sorbet/rbi/gems/actionpack@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -5314
  135. data/sorbet/rbi/gems/actiontext@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -699
  136. data/sorbet/rbi/gems/actionview@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -2515
  137. data/sorbet/rbi/gems/activejob@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -624
  138. data/sorbet/rbi/gems/activemodel@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -1248
  139. data/sorbet/rbi/gems/activerecord@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -8363
  140. data/sorbet/rbi/gems/activestorage@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -876
  141. data/sorbet/rbi/gems/activesupport@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -3987
  142. data/sorbet/rbi/gems/colorize@0.8.1.rbi +0 -40
  143. data/sorbet/rbi/gems/commander@4.5.2.rbi +0 -8
  144. data/sorbet/rbi/gems/concurrent-ruby@1.1.8.rbi +0 -1969
  145. data/sorbet/rbi/gems/constant_resolver@0.1.5.rbi +0 -26
  146. data/sorbet/rbi/gems/erubi@1.10.0.rbi +0 -41
  147. data/sorbet/rbi/gems/globalid@0.4.2.rbi +0 -178
  148. data/sorbet/rbi/gems/highline@2.0.3.rbi +0 -8
  149. data/sorbet/rbi/gems/i18n@1.8.10.rbi +0 -600
  150. data/sorbet/rbi/gems/loofah@2.9.0.rbi +0 -274
  151. data/sorbet/rbi/gems/m@1.5.1.rbi +0 -108
  152. data/sorbet/rbi/gems/marcel@1.0.0.rbi +0 -70
  153. data/sorbet/rbi/gems/mini_mime@1.0.3.rbi +0 -71
  154. data/sorbet/rbi/gems/minitest-focus@1.2.1.rbi +0 -8
  155. data/sorbet/rbi/gems/minitest@5.14.4.rbi +0 -544
  156. data/sorbet/rbi/gems/mocha@1.12.0.rbi +0 -953
  157. data/sorbet/rbi/gems/nio4r@2.5.7.rbi +0 -90
  158. data/sorbet/rbi/gems/nokogiri@1.11.2.rbi +0 -1647
  159. data/sorbet/rbi/gems/parallel@1.20.1.rbi +0 -117
  160. data/sorbet/rbi/gems/parlour@6.0.0.rbi +0 -1272
  161. data/sorbet/rbi/gems/parser@3.0.0.0.rbi +0 -1745
  162. data/sorbet/rbi/gems/pry@0.14.0.rbi +0 -8
  163. data/sorbet/rbi/gems/psych@3.3.2.rbi +0 -24
  164. data/sorbet/rbi/gems/racc@1.5.2.rbi +0 -57
  165. data/sorbet/rbi/gems/rack-test@1.1.0.rbi +0 -335
  166. data/sorbet/rbi/gems/rack@2.2.3.rbi +0 -1718
  167. data/sorbet/rbi/gems/rails-html-sanitizer@1.3.0.rbi +0 -213
  168. data/sorbet/rbi/gems/rails@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -8
  169. data/sorbet/rbi/gems/railties@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -880
  170. data/sorbet/rbi/gems/rainbow@3.0.0.rbi +0 -155
  171. data/sorbet/rbi/gems/rake@13.0.3.rbi +0 -837
  172. data/sorbet/rbi/gems/regexp_parser@2.1.1.rbi +0 -8
  173. data/sorbet/rbi/gems/rexml@3.2.4.rbi +0 -8
  174. data/sorbet/rbi/gems/rubocop-ast@1.4.1.rbi +0 -8
  175. data/sorbet/rbi/gems/rubocop-performance@1.10.2.rbi +0 -8
  176. data/sorbet/rbi/gems/rubocop-sorbet@0.6.1.rbi +0 -8
  177. data/sorbet/rbi/gems/rubocop@1.12.0.rbi +0 -8
  178. data/sorbet/rbi/gems/smart_properties@1.15.0.rbi +0 -168
  179. data/sorbet/rbi/gems/spoom@1.1.0.rbi +0 -1061
  180. data/sorbet/rbi/gems/spring@2.1.1.rbi +0 -160
  181. data/sorbet/rbi/gems/sprockets-rails@3.2.2.rbi +0 -451
  182. data/sorbet/rbi/gems/sprockets@4.0.2.rbi +0 -1133
  183. data/sorbet/rbi/gems/tapioca@0.4.19.rbi +0 -603
  184. data/sorbet/rbi/gems/thor@1.1.0.rbi +0 -893
  185. data/sorbet/rbi/gems/tzinfo@2.0.4.rbi +0 -566
  186. data/sorbet/rbi/gems/unicode-display_width@2.0.0.rbi +0 -8
  187. data/sorbet/rbi/gems/websocket-driver@0.7.3.rbi +0 -438
  188. data/sorbet/rbi/gems/zeitwerk@2.4.2.rbi +0 -177
@@ -0,0 +1,688 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `rails-html-sanitizer` gem.
5
+ # Please instead update this file by running `bin/tapioca gem rails-html-sanitizer`.
6
+
7
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:30
8
+ module ActionView
9
+ class << self
10
+ # source://actionview-7.0.3.1/lib/action_view.rb:90
11
+ def eager_load!; end
12
+
13
+ # Returns the currently loaded version of Action View as a <tt>Gem::Version</tt>.
14
+ #
15
+ # source://actionview-7.0.3.1/lib/action_view/gem_version.rb:5
16
+ def gem_version; end
17
+
18
+ # Returns the currently loaded version of Action View as a <tt>Gem::Version</tt>.
19
+ #
20
+ # source://actionview-7.0.3.1/lib/action_view/version.rb:7
21
+ def version; end
22
+ end
23
+ end
24
+
25
+ # source://actionview-7.0.3.1/lib/action_view.rb:33
26
+ ActionView::ENCODING_FLAG = T.let(T.unsafe(nil), String)
27
+
28
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:31
29
+ module ActionView::Helpers
30
+ include ::ActionView::Helpers::SanitizeHelper
31
+ include ::ActionView::Helpers::TextHelper
32
+ include ::ActionView::Helpers::UrlHelper
33
+ include ::ActionView::Helpers::SanitizeHelper
34
+ include ::ActionView::Helpers::TextHelper
35
+ include ::ActionView::Helpers::FormTagHelper
36
+ include ::ActionView::Helpers::FormHelper
37
+ include ::ActionView::Helpers::TranslationHelper
38
+
39
+ mixes_in_class_methods ::ActionView::Helpers::UrlHelper::ClassMethods
40
+ mixes_in_class_methods ::ActionView::Helpers::SanitizeHelper::ClassMethods
41
+
42
+ class << self
43
+ # source://actionview-7.0.3.1/lib/action_view/helpers.rb:34
44
+ def eager_load!; end
45
+ end
46
+ end
47
+
48
+ # The SanitizeHelper module provides a set of methods for scrubbing text of undesired HTML elements.
49
+ # These helper methods extend Action View making them callable within your template files.
50
+ #
51
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:32
52
+ module ActionView::Helpers::SanitizeHelper
53
+ mixes_in_class_methods ::ActionView::Helpers::SanitizeHelper::ClassMethods
54
+
55
+ # Sanitizes HTML input, stripping all but known-safe tags and attributes.
56
+ #
57
+ # It also strips href/src attributes with unsafe protocols like
58
+ # <tt>javascript:</tt>, while also protecting against attempts to use Unicode,
59
+ # ASCII, and hex character references to work around these protocol filters.
60
+ # All special characters will be escaped.
61
+ #
62
+ # The default sanitizer is Rails::Html::SafeListSanitizer. See {Rails HTML
63
+ # Sanitizers}[https://github.com/rails/rails-html-sanitizer] for more information.
64
+ #
65
+ # Custom sanitization rules can also be provided.
66
+ #
67
+ # Please note that sanitizing user-provided text does not guarantee that the
68
+ # resulting markup is valid or even well-formed.
69
+ #
70
+ # ==== Options
71
+ #
72
+ # * <tt>:tags</tt> - An array of allowed tags.
73
+ # * <tt>:attributes</tt> - An array of allowed attributes.
74
+ # * <tt>:scrubber</tt> - A {Rails::Html scrubber}[https://github.com/rails/rails-html-sanitizer]
75
+ # or {Loofah::Scrubber}[https://github.com/flavorjones/loofah] object that
76
+ # defines custom sanitization rules. A custom scrubber takes precedence over
77
+ # custom tags and attributes.
78
+ #
79
+ # ==== Examples
80
+ #
81
+ # Normal use:
82
+ #
83
+ # <%= sanitize @comment.body %>
84
+ #
85
+ # Providing custom lists of permitted tags and attributes:
86
+ #
87
+ # <%= sanitize @comment.body, tags: %w(strong em a), attributes: %w(href) %>
88
+ #
89
+ # Providing a custom Rails::Html scrubber:
90
+ #
91
+ # class CommentScrubber < Rails::Html::PermitScrubber
92
+ # def initialize
93
+ # super
94
+ # self.tags = %w( form script comment blockquote )
95
+ # self.attributes = %w( style )
96
+ # end
97
+ #
98
+ # def skip_node?(node)
99
+ # node.text?
100
+ # end
101
+ # end
102
+ #
103
+ # <%= sanitize @comment.body, scrubber: CommentScrubber.new %>
104
+ #
105
+ # See {Rails HTML Sanitizer}[https://github.com/rails/rails-html-sanitizer] for
106
+ # documentation about Rails::Html scrubbers.
107
+ #
108
+ # Providing a custom Loofah::Scrubber:
109
+ #
110
+ # scrubber = Loofah::Scrubber.new do |node|
111
+ # node.remove if node.name == 'script'
112
+ # end
113
+ #
114
+ # <%= sanitize @comment.body, scrubber: scrubber %>
115
+ #
116
+ # See {Loofah's documentation}[https://github.com/flavorjones/loofah] for more
117
+ # information about defining custom Loofah::Scrubber objects.
118
+ #
119
+ # To set the default allowed tags or attributes across your application:
120
+ #
121
+ # # In config/application.rb
122
+ # config.action_view.sanitized_allowed_tags = ['strong', 'em', 'a']
123
+ # config.action_view.sanitized_allowed_attributes = ['href', 'title']
124
+ #
125
+ # source://actionview-7.0.3.1/lib/action_view/helpers/sanitize_helper.rb:81
126
+ def sanitize(html, options = T.unsafe(nil)); end
127
+
128
+ # Sanitizes a block of CSS code. Used by +sanitize+ when it comes across a style attribute.
129
+ #
130
+ # source://actionview-7.0.3.1/lib/action_view/helpers/sanitize_helper.rb:86
131
+ def sanitize_css(style); end
132
+
133
+ # Strips all link tags from +html+ leaving just the link text.
134
+ #
135
+ # strip_links('<a href="http://www.rubyonrails.org">Ruby on Rails</a>')
136
+ # # => Ruby on Rails
137
+ #
138
+ # strip_links('Please e-mail me at <a href="mailto:me@email.com">me@email.com</a>.')
139
+ # # => Please e-mail me at me@email.com.
140
+ #
141
+ # strip_links('Blog: <a href="http://www.myblog.com/" class="nav" target=\"_blank\">Visit</a>.')
142
+ # # => Blog: Visit.
143
+ #
144
+ # strip_links('<<a href="https://example.org">malformed & link</a>')
145
+ # # => &lt;malformed &amp; link
146
+ #
147
+ # source://actionview-7.0.3.1/lib/action_view/helpers/sanitize_helper.rb:120
148
+ def strip_links(html); end
149
+
150
+ # Strips all HTML tags from +html+, including comments and special characters.
151
+ #
152
+ # strip_tags("Strip <i>these</i> tags!")
153
+ # # => Strip these tags!
154
+ #
155
+ # strip_tags("<b>Bold</b> no more! <a href='more.html'>See more here</a>...")
156
+ # # => Bold no more! See more here...
157
+ #
158
+ # strip_tags("<div id='top-bar'>Welcome to my website!</div>")
159
+ # # => Welcome to my website!
160
+ #
161
+ # strip_tags("> A quote from Smith & Wesson")
162
+ # # => &gt; A quote from Smith &amp; Wesson
163
+ #
164
+ # source://actionview-7.0.3.1/lib/action_view/helpers/sanitize_helper.rb:103
165
+ def strip_tags(html); end
166
+ end
167
+
168
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:33
169
+ module ActionView::Helpers::SanitizeHelper::ClassMethods
170
+ # Gets the Rails::Html::FullSanitizer instance used by +strip_tags+. Replace with
171
+ # any object that responds to +sanitize+.
172
+ #
173
+ # class Application < Rails::Application
174
+ # config.action_view.full_sanitizer = MySpecialSanitizer.new
175
+ # end
176
+ #
177
+ # source://actionview-7.0.3.1/lib/action_view/helpers/sanitize_helper.rb:145
178
+ def full_sanitizer; end
179
+
180
+ # Sets the attribute full_sanitizer
181
+ #
182
+ # @param value the value to set the attribute full_sanitizer to.
183
+ #
184
+ # source://actionview-7.0.3.1/lib/action_view/helpers/sanitize_helper.rb:125
185
+ def full_sanitizer=(_arg0); end
186
+
187
+ # Gets the Rails::Html::LinkSanitizer instance used by +strip_links+.
188
+ # Replace with any object that responds to +sanitize+.
189
+ #
190
+ # class Application < Rails::Application
191
+ # config.action_view.link_sanitizer = MySpecialSanitizer.new
192
+ # end
193
+ #
194
+ # source://actionview-7.0.3.1/lib/action_view/helpers/sanitize_helper.rb:155
195
+ def link_sanitizer; end
196
+
197
+ # Sets the attribute link_sanitizer
198
+ #
199
+ # @param value the value to set the attribute link_sanitizer to.
200
+ #
201
+ # source://actionview-7.0.3.1/lib/action_view/helpers/sanitize_helper.rb:125
202
+ def link_sanitizer=(_arg0); end
203
+
204
+ # Gets the Rails::Html::SafeListSanitizer instance used by sanitize and +sanitize_css+.
205
+ # Replace with any object that responds to +sanitize+.
206
+ #
207
+ # class Application < Rails::Application
208
+ # config.action_view.safe_list_sanitizer = MySpecialSanitizer.new
209
+ # end
210
+ #
211
+ # source://actionview-7.0.3.1/lib/action_view/helpers/sanitize_helper.rb:165
212
+ def safe_list_sanitizer; end
213
+
214
+ # Sets the attribute safe_list_sanitizer
215
+ #
216
+ # @param value the value to set the attribute safe_list_sanitizer to.
217
+ #
218
+ # source://actionview-7.0.3.1/lib/action_view/helpers/sanitize_helper.rb:125
219
+ def safe_list_sanitizer=(_arg0); end
220
+
221
+ # source://actionview-7.0.3.1/lib/action_view/helpers/sanitize_helper.rb:135
222
+ def sanitized_allowed_attributes; end
223
+
224
+ # Replaces the allowed HTML attributes for the +sanitize+ helper.
225
+ #
226
+ # class Application < Rails::Application
227
+ # config.action_view.sanitized_allowed_attributes = ['onclick', 'longdesc']
228
+ # end
229
+ #
230
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:50
231
+ def sanitized_allowed_attributes=(attributes); end
232
+
233
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:63
234
+ def sanitized_allowed_css_keywords; end
235
+
236
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:64
237
+ def sanitized_allowed_css_keywords=(_); end
238
+
239
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:63
240
+ def sanitized_allowed_css_properties; end
241
+
242
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:64
243
+ def sanitized_allowed_css_properties=(_); end
244
+
245
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:63
246
+ def sanitized_allowed_protocols; end
247
+
248
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:64
249
+ def sanitized_allowed_protocols=(_); end
250
+
251
+ # source://actionview-7.0.3.1/lib/action_view/helpers/sanitize_helper.rb:131
252
+ def sanitized_allowed_tags; end
253
+
254
+ # Replaces the allowed tags for the +sanitize+ helper.
255
+ #
256
+ # class Application < Rails::Application
257
+ # config.action_view.sanitized_allowed_tags = 'table', 'tr', 'td'
258
+ # end
259
+ #
260
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:40
261
+ def sanitized_allowed_tags=(tags); end
262
+
263
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:63
264
+ def sanitized_bad_tags; end
265
+
266
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:64
267
+ def sanitized_bad_tags=(_); end
268
+
269
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:63
270
+ def sanitized_protocol_separator; end
271
+
272
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:64
273
+ def sanitized_protocol_separator=(_); end
274
+
275
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:63
276
+ def sanitized_shorthand_css_properties; end
277
+
278
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:64
279
+ def sanitized_shorthand_css_properties=(_); end
280
+
281
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:63
282
+ def sanitized_uri_attributes; end
283
+
284
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:64
285
+ def sanitized_uri_attributes=(_); end
286
+
287
+ # source://actionview-7.0.3.1/lib/action_view/helpers/sanitize_helper.rb:127
288
+ def sanitizer_vendor; end
289
+
290
+ private
291
+
292
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:68
293
+ def deprecate_option(name); end
294
+ end
295
+
296
+ # source://actionview-7.0.3.1/lib/action_view/template/error.rb:230
297
+ ActionView::TemplateError = ActionView::Template::Error
298
+
299
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer/version.rb:1
300
+ module Rails
301
+ class << self
302
+ # source://railties-7.0.3.1/lib/rails.rb:38
303
+ def app_class; end
304
+
305
+ # source://railties-7.0.3.1/lib/rails.rb:38
306
+ def app_class=(_arg0); end
307
+
308
+ # source://railties-7.0.3.1/lib/rails.rb:39
309
+ def application; end
310
+
311
+ # source://railties-7.0.3.1/lib/rails.rb:37
312
+ def application=(_arg0); end
313
+
314
+ # source://railties-7.0.3.1/lib/rails.rb:116
315
+ def autoloaders; end
316
+
317
+ # source://railties-7.0.3.1/lib/rails.rb:50
318
+ def backtrace_cleaner; end
319
+
320
+ # source://railties-7.0.3.1/lib/rails.rb:38
321
+ def cache; end
322
+
323
+ # source://railties-7.0.3.1/lib/rails.rb:38
324
+ def cache=(_arg0); end
325
+
326
+ # source://railties-7.0.3.1/lib/rails.rb:46
327
+ def configuration; end
328
+
329
+ # source://railties-7.0.3.1/lib/rails.rb:72
330
+ def env; end
331
+
332
+ # source://railties-7.0.3.1/lib/rails.rb:79
333
+ def env=(environment); end
334
+
335
+ # source://railties-7.0.3.1/lib/rails.rb:83
336
+ def error; end
337
+
338
+ # source://railties-7.0.3.1/lib/rails/gem_version.rb:5
339
+ def gem_version; end
340
+
341
+ # source://railties-7.0.3.1/lib/rails.rb:96
342
+ def groups(*groups); end
343
+
344
+ # source://railties-7.0.3.1/lib/rails.rb:43
345
+ def initialize!(*_arg0, &_arg1); end
346
+
347
+ # source://railties-7.0.3.1/lib/rails.rb:43
348
+ def initialized?(*_arg0, &_arg1); end
349
+
350
+ # source://railties-7.0.3.1/lib/rails.rb:38
351
+ def logger; end
352
+
353
+ # source://railties-7.0.3.1/lib/rails.rb:38
354
+ def logger=(_arg0); end
355
+
356
+ # source://railties-7.0.3.1/lib/rails.rb:112
357
+ def public_path; end
358
+
359
+ # source://railties-7.0.3.1/lib/rails.rb:63
360
+ def root; end
361
+
362
+ # source://railties-7.0.3.1/lib/rails/version.rb:7
363
+ def version; end
364
+ end
365
+ end
366
+
367
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer/version.rb:2
368
+ module Rails::Html; end
369
+
370
+ # === Rails::Html::FullSanitizer
371
+ # Removes all tags but strips out scripts, forms and comments.
372
+ #
373
+ # full_sanitizer = Rails::Html::FullSanitizer.new
374
+ # full_sanitizer.sanitize("<b>Bold</b> no more! <a href='more.html'>See more here</a>...")
375
+ # # => Bold no more! See more here...
376
+ #
377
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer.rb:28
378
+ class Rails::Html::FullSanitizer < ::Rails::Html::Sanitizer
379
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer.rb:29
380
+ def sanitize(html, options = T.unsafe(nil)); end
381
+ end
382
+
383
+ # === Rails::Html::LinkSanitizer
384
+ # Removes +a+ tags and +href+ attributes leaving only the link text.
385
+ #
386
+ # link_sanitizer = Rails::Html::LinkSanitizer.new
387
+ # link_sanitizer.sanitize('<a href="example.com">Only the link text will be kept.</a>')
388
+ #
389
+ # => 'Only the link text will be kept.'
390
+ #
391
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer.rb:49
392
+ class Rails::Html::LinkSanitizer < ::Rails::Html::Sanitizer
393
+ # @return [LinkSanitizer] a new instance of LinkSanitizer
394
+ #
395
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer.rb:50
396
+ def initialize; end
397
+
398
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer.rb:56
399
+ def sanitize(html, options = T.unsafe(nil)); end
400
+ end
401
+
402
+ # === Rails::Html::PermitScrubber
403
+ #
404
+ # +Rails::Html::PermitScrubber+ allows you to permit only your own tags and/or attributes.
405
+ #
406
+ # +Rails::Html::PermitScrubber+ can be subclassed to determine:
407
+ # - When a node should be skipped via +skip_node?+.
408
+ # - When a node is allowed via +allowed_node?+.
409
+ # - When an attribute should be scrubbed via +scrub_attribute?+.
410
+ #
411
+ # Subclasses don't need to worry if tags or attributes are set or not.
412
+ # If tags or attributes are not set, Loofah's behavior will be used.
413
+ # If you override +allowed_node?+ and no tags are set, it will not be called.
414
+ # Instead Loofahs behavior will be used.
415
+ # Likewise for +scrub_attribute?+ and attributes respectively.
416
+ #
417
+ # Text and CDATA nodes are skipped by default.
418
+ # Unallowed elements will be stripped, i.e. element is removed but its subtree kept.
419
+ # Supplied tags and attributes should be Enumerables.
420
+ #
421
+ # +tags=+
422
+ # If set, elements excluded will be stripped.
423
+ # If not, elements are stripped based on Loofahs +HTML5::Scrub.allowed_element?+.
424
+ #
425
+ # +attributes=+
426
+ # If set, attributes excluded will be removed.
427
+ # If not, attributes are removed based on Loofahs +HTML5::Scrub.scrub_attributes+.
428
+ #
429
+ # class CommentScrubber < Html::PermitScrubber
430
+ # def initialize
431
+ # super
432
+ # self.tags = %w(form script comment blockquote)
433
+ # end
434
+ #
435
+ # def skip_node?(node)
436
+ # node.text?
437
+ # end
438
+ #
439
+ # def scrub_attribute?(name)
440
+ # name == "style"
441
+ # end
442
+ # end
443
+ #
444
+ # See the documentation for +Nokogiri::XML::Node+ to understand what's possible
445
+ # with nodes: https://nokogiri.org/rdoc/Nokogiri/XML/Node.html
446
+ #
447
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/scrubbers.rb:47
448
+ class Rails::Html::PermitScrubber < ::Loofah::Scrubber
449
+ # @return [PermitScrubber] a new instance of PermitScrubber
450
+ #
451
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/scrubbers.rb:50
452
+ def initialize; end
453
+
454
+ # Returns the value of attribute attributes.
455
+ #
456
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/scrubbers.rb:48
457
+ def attributes; end
458
+
459
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/scrubbers.rb:59
460
+ def attributes=(attributes); end
461
+
462
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/scrubbers.rb:63
463
+ def scrub(node); end
464
+
465
+ # Returns the value of attribute tags.
466
+ #
467
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/scrubbers.rb:48
468
+ def tags; end
469
+
470
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/scrubbers.rb:55
471
+ def tags=(tags); end
472
+
473
+ protected
474
+
475
+ # @return [Boolean]
476
+ #
477
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/scrubbers.rb:80
478
+ def allowed_node?(node); end
479
+
480
+ # @return [Boolean]
481
+ #
482
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/scrubbers.rb:92
483
+ def keep_node?(node); end
484
+
485
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/scrubbers.rb:134
486
+ def scrub_attribute(node, attr_node); end
487
+
488
+ # @return [Boolean]
489
+ #
490
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/scrubbers.rb:88
491
+ def scrub_attribute?(name); end
492
+
493
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/scrubbers.rb:105
494
+ def scrub_attributes(node); end
495
+
496
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/scrubbers.rb:118
497
+ def scrub_css_attribute(node); end
498
+
499
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/scrubbers.rb:100
500
+ def scrub_node(node); end
501
+
502
+ # @return [Boolean]
503
+ #
504
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/scrubbers.rb:84
505
+ def skip_node?(node); end
506
+
507
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/scrubbers.rb:127
508
+ def validate!(var, name); end
509
+ end
510
+
511
+ # === Rails::Html::SafeListSanitizer
512
+ # Sanitizes html and css from an extensive safe list (see link further down).
513
+ #
514
+ # === Whitespace
515
+ # We can't make any guarantees about whitespace being kept or stripped.
516
+ # Loofah uses Nokogiri, which wraps either a C or Java parser for the
517
+ # respective Ruby implementation.
518
+ # Those two parsers determine how whitespace is ultimately handled.
519
+ #
520
+ # When the stripped markup will be rendered the users browser won't take
521
+ # whitespace into account anyway. It might be better to suggest your users
522
+ # wrap their whitespace sensitive content in pre tags or that you do
523
+ # so automatically.
524
+ #
525
+ # === Options
526
+ # Sanitizes both html and css via the safe lists found here:
527
+ # https://github.com/flavorjones/loofah/blob/master/lib/loofah/html5/safelist.rb
528
+ #
529
+ # SafeListSanitizer also accepts options to configure
530
+ # the safe list used when sanitizing html.
531
+ # There's a class level option:
532
+ # Rails::Html::SafeListSanitizer.allowed_tags = %w(table tr td)
533
+ # Rails::Html::SafeListSanitizer.allowed_attributes = %w(id class style)
534
+ #
535
+ # Tags and attributes can also be passed to +sanitize+.
536
+ # Passed options take precedence over the class level options.
537
+ #
538
+ # === Examples
539
+ # safe_list_sanitizer = Rails::Html::SafeListSanitizer.new
540
+ #
541
+ # Sanitize css doesn't take options
542
+ # safe_list_sanitizer.sanitize_css('background-color: #000;')
543
+ #
544
+ # Default: sanitize via a extensive safe list of allowed elements
545
+ # safe_list_sanitizer.sanitize(@article.body)
546
+ #
547
+ # Safe list via the supplied tags and attributes
548
+ # safe_list_sanitizer.sanitize(@article.body, tags: %w(table tr td),
549
+ # attributes: %w(id class style))
550
+ #
551
+ # Safe list via a custom scrubber
552
+ # safe_list_sanitizer.sanitize(@article.body, scrubber: ArticleScrubber.new)
553
+ #
554
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer.rb:103
555
+ class Rails::Html::SafeListSanitizer < ::Rails::Html::Sanitizer
556
+ # @return [SafeListSanitizer] a new instance of SafeListSanitizer
557
+ #
558
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer.rb:113
559
+ def initialize; end
560
+
561
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer.rb:117
562
+ def sanitize(html, options = T.unsafe(nil)); end
563
+
564
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer.rb:138
565
+ def sanitize_css(style_string); end
566
+
567
+ private
568
+
569
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer.rb:165
570
+ def allowed_attributes(options); end
571
+
572
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer.rb:157
573
+ def allowed_tags(options); end
574
+
575
+ # @return [Boolean]
576
+ #
577
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer.rb:144
578
+ def loofah_using_html5?; end
579
+
580
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer.rb:149
581
+ def remove_safelist_tag_combinations(tags); end
582
+
583
+ class << self
584
+ # Returns the value of attribute allowed_attributes.
585
+ #
586
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer.rb:106
587
+ def allowed_attributes; end
588
+
589
+ # Sets the attribute allowed_attributes
590
+ #
591
+ # @param value the value to set the attribute allowed_attributes to.
592
+ #
593
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer.rb:106
594
+ def allowed_attributes=(_arg0); end
595
+
596
+ # Returns the value of attribute allowed_tags.
597
+ #
598
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer.rb:105
599
+ def allowed_tags; end
600
+
601
+ # Sets the attribute allowed_tags
602
+ #
603
+ # @param value the value to set the attribute allowed_tags to.
604
+ #
605
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer.rb:105
606
+ def allowed_tags=(_arg0); end
607
+ end
608
+ end
609
+
610
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer/version.rb:3
611
+ class Rails::Html::Sanitizer
612
+ # @raise [NotImplementedError]
613
+ #
614
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer.rb:6
615
+ def sanitize(html, options = T.unsafe(nil)); end
616
+
617
+ private
618
+
619
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer.rb:17
620
+ def properly_encode(fragment, options); end
621
+
622
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer.rb:12
623
+ def remove_xpaths(node, xpaths); end
624
+
625
+ class << self
626
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:10
627
+ def full_sanitizer; end
628
+
629
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:14
630
+ def link_sanitizer; end
631
+
632
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:18
633
+ def safe_list_sanitizer; end
634
+
635
+ # source://rails-html-sanitizer-1.4.3/lib/rails-html-sanitizer.rb:22
636
+ def white_list_sanitizer; end
637
+ end
638
+ end
639
+
640
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer/version.rb:4
641
+ Rails::Html::Sanitizer::VERSION = T.let(T.unsafe(nil), String)
642
+
643
+ # === Rails::Html::TargetScrubber
644
+ #
645
+ # Where +Rails::Html::PermitScrubber+ picks out tags and attributes to permit in
646
+ # sanitization, +Rails::Html::TargetScrubber+ targets them for removal.
647
+ #
648
+ # +tags=+
649
+ # If set, elements included will be stripped.
650
+ #
651
+ # +attributes=+
652
+ # If set, attributes included will be removed.
653
+ #
654
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/scrubbers.rb:171
655
+ class Rails::Html::TargetScrubber < ::Rails::Html::PermitScrubber
656
+ # @return [Boolean]
657
+ #
658
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/scrubbers.rb:172
659
+ def allowed_node?(node); end
660
+
661
+ # @return [Boolean]
662
+ #
663
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/scrubbers.rb:176
664
+ def scrub_attribute?(name); end
665
+ end
666
+
667
+ # === Rails::Html::TextOnlyScrubber
668
+ #
669
+ # +Rails::Html::TextOnlyScrubber+ allows you to permit text nodes.
670
+ #
671
+ # Unallowed elements will be stripped, i.e. element is removed but its subtree kept.
672
+ #
673
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/scrubbers.rb:186
674
+ class Rails::Html::TextOnlyScrubber < ::Loofah::Scrubber
675
+ # @return [TextOnlyScrubber] a new instance of TextOnlyScrubber
676
+ #
677
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/scrubbers.rb:187
678
+ def initialize; end
679
+
680
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/scrubbers.rb:191
681
+ def scrub(node); end
682
+ end
683
+
684
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer.rb:170
685
+ Rails::Html::WhiteListSanitizer = Rails::Html::SafeListSanitizer
686
+
687
+ # source://rails-html-sanitizer-1.4.3/lib/rails/html/sanitizer.rb:3
688
+ Rails::Html::XPATHS_TO_REMOVE = T.let(T.unsafe(nil), Array)
@@ -0,0 +1,8 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `rails` gem.
5
+ # Please instead update this file by running `bin/tapioca gem rails`.
6
+
7
+ # THIS IS AN EMPTY RBI FILE.
8
+ # see https://github.com/Shopify/tapioca/wiki/Manual-Gem-Requires