danger-packwerk 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/lib/danger-packwerk/packwerk_wrapper.rb +2 -2
  3. data/lib/danger-packwerk/version.rb +1 -1
  4. data/sorbet/config +1 -0
  5. data/sorbet/rbi/gems/actionview@7.0.4.rbi +11543 -0
  6. data/sorbet/rbi/gems/activesupport@7.0.4.rbi +12959 -0
  7. data/sorbet/rbi/gems/addressable@2.8.1.rbi +1505 -0
  8. data/sorbet/rbi/gems/ast@2.4.2.rbi +522 -0
  9. data/sorbet/rbi/gems/better_html@2.0.1.rbi +286 -0
  10. data/sorbet/rbi/gems/builder@3.2.4.rbi +8 -0
  11. data/sorbet/rbi/gems/claide-plugins@0.9.2.rbi +791 -0
  12. data/sorbet/rbi/gems/claide@1.1.0.rbi +1132 -0
  13. data/sorbet/rbi/gems/coderay@1.1.3.rbi +2256 -0
  14. data/sorbet/rbi/gems/colored2@3.1.2.rbi +130 -0
  15. data/sorbet/rbi/gems/concurrent-ruby@1.1.10.rbi +8695 -0
  16. data/sorbet/rbi/gems/cork@0.3.0.rbi +248 -0
  17. data/sorbet/rbi/gems/crass@1.0.6.rbi +436 -0
  18. data/sorbet/rbi/gems/danger-plugin-api@1.0.0.rbi +8 -0
  19. data/sorbet/rbi/gems/danger@9.0.0.rbi +4722 -0
  20. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +862 -0
  21. data/sorbet/rbi/gems/erubi@1.11.0.rbi +102 -0
  22. data/sorbet/rbi/gems/faraday-em_http@1.0.0.rbi +266 -0
  23. data/sorbet/rbi/gems/faraday-em_synchrony@1.0.0.rbi +209 -0
  24. data/sorbet/rbi/gems/faraday-excon@1.1.0.rbi +212 -0
  25. data/sorbet/rbi/gems/faraday-http-cache@2.4.1.rbi +805 -0
  26. data/sorbet/rbi/gems/faraday-httpclient@1.0.1.rbi +221 -0
  27. data/sorbet/rbi/gems/faraday-multipart@1.0.4.rbi +266 -0
  28. data/sorbet/rbi/gems/faraday-net_http@1.0.1.rbi +216 -0
  29. data/sorbet/rbi/gems/faraday-net_http_persistent@1.2.0.rbi +206 -0
  30. data/sorbet/rbi/gems/faraday-patron@1.0.0.rbi +212 -0
  31. data/sorbet/rbi/gems/faraday-rack@1.0.0.rbi +225 -0
  32. data/sorbet/rbi/gems/faraday-retry@1.0.3.rbi +222 -0
  33. data/sorbet/rbi/gems/faraday@1.10.2.rbi +1862 -0
  34. data/sorbet/rbi/gems/git@1.12.0.rbi +1936 -0
  35. data/sorbet/rbi/gems/i18n@1.12.0.rbi +1643 -0
  36. data/sorbet/rbi/gems/json@2.6.2.rbi +1418 -0
  37. data/sorbet/rbi/gems/kramdown-parser-gfm@1.1.0.rbi +8 -0
  38. data/sorbet/rbi/gems/kramdown@2.4.0.rbi +2168 -0
  39. data/sorbet/rbi/gems/loofah@2.19.0.rbi +646 -0
  40. data/sorbet/rbi/gems/method_source@1.0.0.rbi +199 -0
  41. data/sorbet/rbi/gems/minitest@5.16.3.rbi +997 -0
  42. data/sorbet/rbi/gems/multipart-post@2.2.3.rbi +165 -0
  43. data/sorbet/rbi/gems/nap@1.1.0.rbi +351 -0
  44. data/sorbet/rbi/gems/no_proxy_fix@0.1.2.rbi +8 -0
  45. data/sorbet/rbi/gems/nokogiri@1.13.8.rbi +4916 -0
  46. data/sorbet/rbi/gems/octokit@5.6.1.rbi +8939 -0
  47. data/sorbet/rbi/gems/open4@1.3.4.rbi +8 -0
  48. data/sorbet/rbi/gems/{packwerk@2.1.1.rbi → packwerk@2.2.1.rbi} +602 -51
  49. data/sorbet/rbi/gems/parallel@1.22.1.rbi +163 -0
  50. data/sorbet/rbi/gems/parser@3.1.2.1.rbi +5988 -0
  51. data/sorbet/rbi/gems/pry@0.14.1.rbi +6969 -0
  52. data/sorbet/rbi/gems/public_suffix@5.0.0.rbi +779 -0
  53. data/sorbet/rbi/gems/racc@1.6.0.rbi +92 -0
  54. data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +8 -0
  55. data/sorbet/rbi/gems/rails-html-sanitizer@1.4.3.rbi +493 -0
  56. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +227 -0
  57. data/sorbet/rbi/gems/rake@13.0.6.rbi +1865 -0
  58. data/sorbet/rbi/gems/rbi@0.0.14.rbi +2337 -0
  59. data/sorbet/rbi/gems/rchardet@1.8.0.rbi +587 -0
  60. data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +1851 -0
  61. data/sorbet/rbi/gems/rexml@3.2.5.rbi +3852 -0
  62. data/sorbet/rbi/gems/rspec-core@3.11.0.rbi +7725 -0
  63. data/sorbet/rbi/gems/rspec-expectations@3.11.0.rbi +6201 -0
  64. data/sorbet/rbi/gems/rspec-mocks@3.11.1.rbi +3625 -0
  65. data/sorbet/rbi/gems/rspec-support@3.11.0.rbi +1176 -0
  66. data/sorbet/rbi/gems/rspec@3.11.0.rbi +40 -0
  67. data/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi +4193 -0
  68. data/sorbet/rbi/gems/rubocop-sorbet@0.6.8.rbi +677 -0
  69. data/sorbet/rbi/gems/rubocop@1.36.0.rbi +37914 -0
  70. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +732 -0
  71. data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +8 -0
  72. data/sorbet/rbi/gems/sawyer@0.9.2.rbi +513 -0
  73. data/sorbet/rbi/gems/smart_properties@1.17.0.rbi +326 -0
  74. data/sorbet/rbi/gems/spoom@1.1.11.rbi +1600 -0
  75. data/sorbet/rbi/gems/tapioca@0.8.0.rbi +1959 -0
  76. data/sorbet/rbi/gems/terminal-table@3.0.2.rbi +438 -0
  77. data/sorbet/rbi/gems/thor@1.2.1.rbi +2921 -0
  78. data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +4879 -0
  79. data/sorbet/rbi/gems/unicode-display_width@2.3.0.rbi +27 -0
  80. data/sorbet/rbi/gems/unparser@0.6.5.rbi +2789 -0
  81. data/sorbet/rbi/gems/webrick@1.7.0.rbi +1802 -0
  82. data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +288 -0
  83. data/sorbet/rbi/gems/yard@0.9.27.rbi +12668 -0
  84. data/sorbet/rbi/todo.rbi +122 -0
  85. metadata +84 -7
  86. data/sorbet/rbi/gems/danger@8.5.0.rbi +0 -122
@@ -0,0 +1,646 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `loofah` gem.
5
+ # Please instead update this file by running `bin/tapioca gem loofah`.
6
+
7
+ # == Strings and IO Objects as Input
8
+ #
9
+ # Loofah.document and Loofah.fragment accept any IO object in addition
10
+ # to accepting a string. That IO object could be a file, or a socket,
11
+ # or a StringIO, or anything that responds to +read+ and
12
+ # +close+. Which makes it particularly easy to sanitize mass
13
+ # quantities of docs.
14
+ module Loofah
15
+ class << self
16
+ # Shortcut for Loofah::HTML::Document.parse
17
+ # This method accepts the same parameters as Nokogiri::HTML::Document.parse
18
+ def document(*args, &block); end
19
+
20
+ # Shortcut for Loofah::HTML::DocumentFragment.parse
21
+ # This method accepts the same parameters as Nokogiri::HTML::DocumentFragment.parse
22
+ def fragment(*args, &block); end
23
+
24
+ # A helper to remove extraneous whitespace from text-ified HTML
25
+ def remove_extraneous_whitespace(string); end
26
+
27
+ # Shortcut for Loofah.document(string_or_io).scrub!(method)
28
+ def scrub_document(string_or_io, method); end
29
+
30
+ # Shortcut for Loofah.fragment(string_or_io).scrub!(method)
31
+ def scrub_fragment(string_or_io, method); end
32
+
33
+ # Shortcut for Loofah.xml_document(string_or_io).scrub!(method)
34
+ def scrub_xml_document(string_or_io, method); end
35
+
36
+ # Shortcut for Loofah.xml_fragment(string_or_io).scrub!(method)
37
+ def scrub_xml_fragment(string_or_io, method); end
38
+
39
+ # Shortcut for Loofah::XML::Document.parse
40
+ # This method accepts the same parameters as Nokogiri::XML::Document.parse
41
+ def xml_document(*args, &block); end
42
+
43
+ # Shortcut for Loofah::XML::DocumentFragment.parse
44
+ # This method accepts the same parameters as Nokogiri::XML::DocumentFragment.parse
45
+ def xml_fragment(*args, &block); end
46
+
47
+ private
48
+
49
+ # remove comments that exist outside of the HTML element.
50
+ #
51
+ # these comments are allowed by the HTML spec:
52
+ #
53
+ # https://www.w3.org/TR/html401/struct/global.html#h-7.1
54
+ #
55
+ # but are not scrubbed by Loofah because these nodes don't meet
56
+ # the contract that scrubbers expect of a node (e.g., it can be
57
+ # replaced, sibling and children nodes can be created).
58
+ def remove_comments_before_html_element(doc); end
59
+ end
60
+ end
61
+
62
+ module Loofah::DocumentDecorator
63
+ def initialize(*args, &block); end
64
+ end
65
+
66
+ module Loofah::Elements; end
67
+ Loofah::Elements::BLOCK_LEVEL = T.let(T.unsafe(nil), Set)
68
+
69
+ # Elements that aren't block but should generate a newline in #to_text
70
+ Loofah::Elements::INLINE_LINE_BREAK = T.let(T.unsafe(nil), Set)
71
+
72
+ Loofah::Elements::LINEBREAKERS = T.let(T.unsafe(nil), Set)
73
+
74
+ # The following elements may also be considered block-level
75
+ # elements since they may contain block-level elements
76
+ Loofah::Elements::LOOSE_BLOCK_LEVEL = T.let(T.unsafe(nil), Set)
77
+
78
+ Loofah::Elements::STRICT_BLOCK_LEVEL = T.let(T.unsafe(nil), Set)
79
+ Loofah::Elements::STRICT_BLOCK_LEVEL_HTML4 = T.let(T.unsafe(nil), Set)
80
+
81
+ # https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements
82
+ Loofah::Elements::STRICT_BLOCK_LEVEL_HTML5 = T.let(T.unsafe(nil), Set)
83
+
84
+ module Loofah::HTML; end
85
+ module Loofah::HTML5; end
86
+ module Loofah::HTML5::SafeList; end
87
+ Loofah::HTML5::SafeList::ACCEPTABLE_ATTRIBUTES = T.let(T.unsafe(nil), Set)
88
+
89
+ # https://www.w3.org/TR/css-color-3/#html4
90
+ Loofah::HTML5::SafeList::ACCEPTABLE_CSS_COLORS = T.let(T.unsafe(nil), Set)
91
+
92
+ # https://www.w3.org/TR/css-color-3/#svg-color
93
+ Loofah::HTML5::SafeList::ACCEPTABLE_CSS_EXTENDED_COLORS = T.let(T.unsafe(nil), Set)
94
+
95
+ # see https://www.quackit.com/css/functions/
96
+ # omit `url` and `image` from that list
97
+ Loofah::HTML5::SafeList::ACCEPTABLE_CSS_FUNCTIONS = T.let(T.unsafe(nil), Set)
98
+
99
+ Loofah::HTML5::SafeList::ACCEPTABLE_CSS_KEYWORDS = T.let(T.unsafe(nil), Set)
100
+ Loofah::HTML5::SafeList::ACCEPTABLE_CSS_PROPERTIES = T.let(T.unsafe(nil), Set)
101
+ Loofah::HTML5::SafeList::ACCEPTABLE_ELEMENTS = T.let(T.unsafe(nil), Set)
102
+ Loofah::HTML5::SafeList::ACCEPTABLE_PROTOCOLS = T.let(T.unsafe(nil), Set)
103
+ Loofah::HTML5::SafeList::ACCEPTABLE_SVG_PROPERTIES = T.let(T.unsafe(nil), Set)
104
+ Loofah::HTML5::SafeList::ACCEPTABLE_URI_DATA_MEDIATYPES = T.let(T.unsafe(nil), Set)
105
+ Loofah::HTML5::SafeList::ALLOWED_ATTRIBUTES = T.let(T.unsafe(nil), Set)
106
+ Loofah::HTML5::SafeList::ALLOWED_CSS_FUNCTIONS = T.let(T.unsafe(nil), Set)
107
+ Loofah::HTML5::SafeList::ALLOWED_CSS_KEYWORDS = T.let(T.unsafe(nil), Set)
108
+ Loofah::HTML5::SafeList::ALLOWED_CSS_PROPERTIES = T.let(T.unsafe(nil), Set)
109
+
110
+ # subclasses may define their own versions of these constants
111
+ Loofah::HTML5::SafeList::ALLOWED_ELEMENTS = T.let(T.unsafe(nil), Set)
112
+
113
+ Loofah::HTML5::SafeList::ALLOWED_ELEMENTS_WITH_LIBXML2 = T.let(T.unsafe(nil), Set)
114
+ Loofah::HTML5::SafeList::ALLOWED_PROTOCOLS = T.let(T.unsafe(nil), Set)
115
+ Loofah::HTML5::SafeList::ALLOWED_SVG_PROPERTIES = T.let(T.unsafe(nil), Set)
116
+ Loofah::HTML5::SafeList::ALLOWED_URI_DATA_MEDIATYPES = T.let(T.unsafe(nil), Set)
117
+ Loofah::HTML5::SafeList::ARIA_ATTRIBUTES = T.let(T.unsafe(nil), Set)
118
+ Loofah::HTML5::SafeList::ATTR_VAL_IS_URI = T.let(T.unsafe(nil), Set)
119
+ Loofah::HTML5::SafeList::MATHML_ATTRIBUTES = T.let(T.unsafe(nil), Set)
120
+ Loofah::HTML5::SafeList::MATHML_ELEMENTS = T.let(T.unsafe(nil), Set)
121
+ Loofah::HTML5::SafeList::PROTOCOL_SEPARATOR = T.let(T.unsafe(nil), Regexp)
122
+ Loofah::HTML5::SafeList::SHORTHAND_CSS_PROPERTIES = T.let(T.unsafe(nil), Set)
123
+ Loofah::HTML5::SafeList::SVG_ALLOW_LOCAL_HREF = T.let(T.unsafe(nil), Set)
124
+ Loofah::HTML5::SafeList::SVG_ATTRIBUTES = T.let(T.unsafe(nil), Set)
125
+ Loofah::HTML5::SafeList::SVG_ATTR_VAL_ALLOWS_REF = T.let(T.unsafe(nil), Set)
126
+ Loofah::HTML5::SafeList::SVG_ELEMENTS = T.let(T.unsafe(nil), Set)
127
+
128
+ # additional tags we should consider safe since we have libxml2 fixing up our documents.
129
+ Loofah::HTML5::SafeList::TAGS_SAFE_WITH_LIBXML2 = T.let(T.unsafe(nil), Set)
130
+
131
+ # TODO: remove VOID_ELEMENTS in a future major release
132
+ # and put it in the tests (it is used only for testing, not for functional behavior)
133
+ Loofah::HTML5::SafeList::VOID_ELEMENTS = T.let(T.unsafe(nil), Set)
134
+
135
+ module Loofah::HTML5::Scrub
136
+ class << self
137
+ # @return [Boolean]
138
+ def allowed_element?(element_name); end
139
+
140
+ # libxml2 >= 2.9.2 fails to escape comments within some attributes.
141
+ #
142
+ # see comments about CVE-2018-8048 within the tests for more information
143
+ def force_correct_attribute_escaping!(node); end
144
+
145
+ # alternative implementation of the html5lib attribute scrubbing algorithm
146
+ def scrub_attributes(node); end
147
+
148
+ def scrub_css(style); end
149
+ def scrub_css_attribute(node); end
150
+ end
151
+ end
152
+
153
+ Loofah::HTML5::Scrub::CONTROL_CHARACTERS = T.let(T.unsafe(nil), Regexp)
154
+ Loofah::HTML5::Scrub::CRASS_SEMICOLON = T.let(T.unsafe(nil), Hash)
155
+ Loofah::HTML5::Scrub::CSS_IMPORTANT = T.let(T.unsafe(nil), String)
156
+ Loofah::HTML5::Scrub::CSS_KEYWORDISH = T.let(T.unsafe(nil), Regexp)
157
+ Loofah::HTML5::Scrub::CSS_PROPERTY_STRING_WITHOUT_EMBEDDED_QUOTES = T.let(T.unsafe(nil), Regexp)
158
+ Loofah::HTML5::Scrub::DATA_ATTRIBUTE_NAME = T.let(T.unsafe(nil), Regexp)
159
+ Loofah::HTML5::WhiteList = Loofah::HTML5::SafeList
160
+
161
+ # Subclass of Nokogiri::HTML::Document.
162
+ #
163
+ # See Loofah::ScrubBehavior and Loofah::TextBehavior for additional methods.
164
+ class Loofah::HTML::Document < ::Nokogiri::HTML4::Document
165
+ include ::Loofah::ScrubBehavior::Node
166
+ include ::Loofah::DocumentDecorator
167
+ include ::Loofah::TextBehavior
168
+
169
+ def serialize_root; end
170
+ end
171
+
172
+ # Subclass of Nokogiri::HTML::DocumentFragment.
173
+ #
174
+ # See Loofah::ScrubBehavior and Loofah::TextBehavior for additional methods.
175
+ class Loofah::HTML::DocumentFragment < ::Nokogiri::HTML4::DocumentFragment
176
+ include ::Loofah::TextBehavior
177
+
178
+ # Returns the HTML markup contained by the fragment
179
+ def serialize; end
180
+
181
+ def serialize_root; end
182
+
183
+ # Returns the HTML markup contained by the fragment
184
+ def to_s; end
185
+
186
+ class << self
187
+ # Overridden Nokogiri::HTML::DocumentFragment
188
+ # constructor. Applications should use Loofah.fragment to
189
+ # parse a fragment.
190
+ def parse(tags, encoding = T.unsafe(nil)); end
191
+ end
192
+ end
193
+
194
+ # constants related to working around unhelpful libxml2 behavior
195
+ #
196
+ # ಠ_ಠ
197
+ module Loofah::LibxmlWorkarounds; end
198
+
199
+ # these attributes and qualifying parent tags are determined by the code at:
200
+ #
201
+ # https://git.gnome.org/browse/libxml2/tree/HTMLtree.c?h=v2.9.2#n714
202
+ #
203
+ # see comments about CVE-2018-8048 within the tests for more information
204
+ Loofah::LibxmlWorkarounds::BROKEN_ESCAPING_ATTRIBUTES = T.let(T.unsafe(nil), Set)
205
+
206
+ Loofah::LibxmlWorkarounds::BROKEN_ESCAPING_ATTRIBUTES_QUALIFYING_TAG = T.let(T.unsafe(nil), Hash)
207
+
208
+ module Loofah::MetaHelpers
209
+ class << self
210
+ def add_downcased_set_members_to_all_set_constants(mojule); end
211
+ end
212
+ end
213
+
214
+ # Mixes +scrub!+ into Document, DocumentFragment, Node and NodeSet.
215
+ #
216
+ # Traverse the document or fragment, invoking the +scrubber+ on
217
+ # each node.
218
+ #
219
+ # +scrubber+ must either be one of the symbols representing the
220
+ # built-in scrubbers (see Scrubbers), or a Scrubber instance.
221
+ #
222
+ # span2div = Loofah::Scrubber.new do |node|
223
+ # node.name = "div" if node.name == "span"
224
+ # end
225
+ # Loofah.fragment("<span>foo</span><p>bar</p>").scrub!(span2div).to_s
226
+ # # => "<div>foo</div><p>bar</p>"
227
+ #
228
+ # or
229
+ #
230
+ # unsafe_html = "ohai! <div>div is safe</div> <script>but script is not</script>"
231
+ # Loofah.fragment(unsafe_html).scrub!(:strip).to_s
232
+ # # => "ohai! <div>div is safe</div> "
233
+ #
234
+ # Note that this method is called implicitly from
235
+ # Loofah.scrub_fragment and Loofah.scrub_document.
236
+ #
237
+ # Please see Scrubber for more information on implementation and traversal, and
238
+ # README.rdoc for more example usage.
239
+ module Loofah::ScrubBehavior
240
+ class << self
241
+ def resolve_scrubber(scrubber); end
242
+ end
243
+ end
244
+
245
+ module Loofah::ScrubBehavior::Node
246
+ def scrub!(scrubber); end
247
+ end
248
+
249
+ module Loofah::ScrubBehavior::NodeSet
250
+ def scrub!(scrubber); end
251
+ end
252
+
253
+ # A Scrubber wraps up a block (or method) that is run on an HTML node (element):
254
+ #
255
+ # # change all <span> tags to <div> tags
256
+ # span2div = Loofah::Scrubber.new do |node|
257
+ # node.name = "div" if node.name == "span"
258
+ # end
259
+ #
260
+ # Alternatively, this scrubber could have been implemented as:
261
+ #
262
+ # class Span2Div < Loofah::Scrubber
263
+ # def scrub(node)
264
+ # node.name = "div" if node.name == "span"
265
+ # end
266
+ # end
267
+ # span2div = Span2Div.new
268
+ #
269
+ # This can then be run on a document:
270
+ #
271
+ # Loofah.fragment("<span>foo</span><p>bar</p>").scrub!(span2div).to_s
272
+ # # => "<div>foo</div><p>bar</p>"
273
+ #
274
+ # Scrubbers can be run on a document in either a top-down traversal (the
275
+ # default) or bottom-up. Top-down scrubbers can optionally return
276
+ # Scrubber::STOP to terminate the traversal of a subtree.
277
+ class Loofah::Scrubber
278
+ # Options may include
279
+ # :direction => :top_down (the default)
280
+ # or
281
+ # :direction => :bottom_up
282
+ #
283
+ # For top_down traversals, if the block returns
284
+ # Loofah::Scrubber::STOP, then the traversal will be terminated
285
+ # for the current node's subtree.
286
+ #
287
+ # Alternatively, a Scrubber may inherit from Loofah::Scrubber,
288
+ # and implement +scrub+, which is slightly faster than using a
289
+ # block.
290
+ #
291
+ # @return [Scrubber] a new instance of Scrubber
292
+ def initialize(options = T.unsafe(nil), &block); end
293
+
294
+ # If the attribute is not set, add it
295
+ # If the attribute is set, don't overwrite the existing value
296
+ def append_attribute(node, attribute, value); end
297
+
298
+ # When a scrubber is initialized, the optional block is saved as
299
+ # :block. Note that, if no block is passed, then the +scrub+
300
+ # method is assumed to have been implemented.
301
+ def block; end
302
+
303
+ # When a scrubber is initialized, the :direction may be specified
304
+ # as :top_down (the default) or :bottom_up.
305
+ def direction; end
306
+
307
+ # When +new+ is not passed a block, the class may implement
308
+ # +scrub+, which will be called for each document node.
309
+ #
310
+ # @raise [ScrubberNotFound]
311
+ def scrub(node); end
312
+
313
+ # Calling +traverse+ will cause the document to be traversed by
314
+ # either the lambda passed to the initializer or the +scrub+
315
+ # method, in the direction specified at +new+ time.
316
+ def traverse(node); end
317
+
318
+ private
319
+
320
+ def html5lib_sanitize(node); end
321
+ def traverse_conditionally_bottom_up(node); end
322
+ def traverse_conditionally_top_down(node); end
323
+ end
324
+
325
+ # Top-down Scrubbers may return CONTINUE to indicate that the subtree should be traversed.
326
+ Loofah::Scrubber::CONTINUE = T.let(T.unsafe(nil), Object)
327
+
328
+ # Top-down Scrubbers may return STOP to indicate that the subtree should not be traversed.
329
+ Loofah::Scrubber::STOP = T.let(T.unsafe(nil), Object)
330
+
331
+ # A RuntimeError raised when Loofah could not find an appropriate scrubber.
332
+ class Loofah::ScrubberNotFound < ::RuntimeError; end
333
+
334
+ # Loofah provides some built-in scrubbers for sanitizing with
335
+ # HTML5lib's safelist and for accomplishing some common
336
+ # transformation tasks.
337
+ #
338
+ #
339
+ # === Loofah::Scrubbers::Strip / scrub!(:strip)
340
+ #
341
+ # +:strip+ removes unknown/unsafe tags, but leaves behind the pristine contents:
342
+ #
343
+ # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
344
+ # Loofah.fragment(unsafe_html).scrub!(:strip)
345
+ # => "ohai! <div>div is safe</div> but foo is <b>not</b>"
346
+ #
347
+ #
348
+ # === Loofah::Scrubbers::Prune / scrub!(:prune)
349
+ #
350
+ # +:prune+ removes unknown/unsafe tags and their contents (including their subtrees):
351
+ #
352
+ # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
353
+ # Loofah.fragment(unsafe_html).scrub!(:prune)
354
+ # => "ohai! <div>div is safe</div> "
355
+ #
356
+ #
357
+ # === Loofah::Scrubbers::Escape / scrub!(:escape)
358
+ #
359
+ # +:escape+ performs HTML entity escaping on the unknown/unsafe tags:
360
+ #
361
+ # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
362
+ # Loofah.fragment(unsafe_html).scrub!(:escape)
363
+ # => "ohai! <div>div is safe</div> &lt;foo&gt;but foo is &lt;b&gt;not&lt;/b&gt;&lt;/foo&gt;"
364
+ #
365
+ #
366
+ # === Loofah::Scrubbers::Whitewash / scrub!(:whitewash)
367
+ #
368
+ # +:whitewash+ removes all comments, styling and attributes in
369
+ # addition to doing markup-fixer-uppery and pruning unsafe tags. I
370
+ # like to call this "whitewashing", since it's like putting a new
371
+ # layer of paint on top of the HTML input to make it look nice.
372
+ #
373
+ # messy_markup = "ohai! <div id='foo' class='bar' style='margin: 10px'>div with attributes</div>"
374
+ # Loofah.fragment(messy_markup).scrub!(:whitewash)
375
+ # => "ohai! <div>div with attributes</div>"
376
+ #
377
+ # One use case for this scrubber is to clean up HTML that was
378
+ # cut-and-pasted from Microsoft Word into a WYSIWYG editor or a
379
+ # rich text editor. Microsoft's software is famous for injecting
380
+ # all kinds of cruft into its HTML output. Who needs that crap?
381
+ # Certainly not me.
382
+ #
383
+ #
384
+ # === Loofah::Scrubbers::NoFollow / scrub!(:nofollow)
385
+ #
386
+ # +:nofollow+ adds a rel="nofollow" attribute to all links
387
+ #
388
+ # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
389
+ # Loofah.fragment(link_farmers_markup).scrub!(:nofollow)
390
+ # => "ohai! <a href='http://www.myswarmysite.com/' rel="nofollow">I like your blog post</a>"
391
+ #
392
+ #
393
+ # === Loofah::Scrubbers::NoOpener / scrub!(:noopener)
394
+ #
395
+ # +:noopener+ adds a rel="noopener" attribute to all links
396
+ #
397
+ # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
398
+ # Loofah.fragment(link_farmers_markup).scrub!(:noopener)
399
+ # => "ohai! <a href='http://www.myswarmysite.com/' rel="noopener">I like your blog post</a>"
400
+ #
401
+ #
402
+ # === Loofah::Scrubbers::Unprintable / scrub!(:unprintable)
403
+ #
404
+ # +:unprintable+ removes unprintable Unicode characters.
405
+ #
406
+ # markup = "<p>Some text with an unprintable character at the end\u2028</p>"
407
+ # Loofah.fragment(markup).scrub!(:unprintable)
408
+ # => "<p>Some text with an unprintable character at the end</p>"
409
+ #
410
+ # You may not be able to see the unprintable character in the above example, but there is a
411
+ # U+2028 character right before the closing </p> tag. These characters can cause issues if
412
+ # the content is ever parsed by JavaScript - more information here:
413
+ #
414
+ # http://timelessrepo.com/json-isnt-a-javascript-subset
415
+ module Loofah::Scrubbers
416
+ class << self
417
+ # Returns an array of symbols representing the built-in scrubbers
418
+ def scrubber_symbols; end
419
+ end
420
+ end
421
+
422
+ # === scrub!(:escape)
423
+ #
424
+ # +:escape+ performs HTML entity escaping on the unknown/unsafe tags:
425
+ #
426
+ # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
427
+ # Loofah.fragment(unsafe_html).scrub!(:escape)
428
+ # => "ohai! <div>div is safe</div> &lt;foo&gt;but foo is &lt;b&gt;not&lt;/b&gt;&lt;/foo&gt;"
429
+ class Loofah::Scrubbers::Escape < ::Loofah::Scrubber
430
+ # @return [Escape] a new instance of Escape
431
+ def initialize; end
432
+
433
+ def scrub(node); end
434
+ end
435
+
436
+ # A hash that maps a symbol (like +:prune+) to the appropriate Scrubber (Loofah::Scrubbers::Prune).
437
+ Loofah::Scrubbers::MAP = T.let(T.unsafe(nil), Hash)
438
+
439
+ # This class probably isn't useful publicly, but is used for #to_text's current implemention
440
+ class Loofah::Scrubbers::NewlineBlockElements < ::Loofah::Scrubber
441
+ # @return [NewlineBlockElements] a new instance of NewlineBlockElements
442
+ def initialize; end
443
+
444
+ def scrub(node); end
445
+ end
446
+
447
+ # === scrub!(:nofollow)
448
+ #
449
+ # +:nofollow+ adds a rel="nofollow" attribute to all links
450
+ #
451
+ # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
452
+ # Loofah.fragment(link_farmers_markup).scrub!(:nofollow)
453
+ # => "ohai! <a href='http://www.myswarmysite.com/' rel="nofollow">I like your blog post</a>"
454
+ class Loofah::Scrubbers::NoFollow < ::Loofah::Scrubber
455
+ # @return [NoFollow] a new instance of NoFollow
456
+ def initialize; end
457
+
458
+ def scrub(node); end
459
+ end
460
+
461
+ # === scrub!(:noopener)
462
+ #
463
+ # +:noopener+ adds a rel="noopener" attribute to all links
464
+ #
465
+ # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
466
+ # Loofah.fragment(link_farmers_markup).scrub!(:noopener)
467
+ # => "ohai! <a href='http://www.myswarmysite.com/' rel="noopener">I like your blog post</a>"
468
+ class Loofah::Scrubbers::NoOpener < ::Loofah::Scrubber
469
+ # @return [NoOpener] a new instance of NoOpener
470
+ def initialize; end
471
+
472
+ def scrub(node); end
473
+ end
474
+
475
+ # === scrub!(:prune)
476
+ #
477
+ # +:prune+ removes unknown/unsafe tags and their contents (including their subtrees):
478
+ #
479
+ # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
480
+ # Loofah.fragment(unsafe_html).scrub!(:prune)
481
+ # => "ohai! <div>div is safe</div> "
482
+ class Loofah::Scrubbers::Prune < ::Loofah::Scrubber
483
+ # @return [Prune] a new instance of Prune
484
+ def initialize; end
485
+
486
+ def scrub(node); end
487
+ end
488
+
489
+ # === scrub!(:strip)
490
+ #
491
+ # +:strip+ removes unknown/unsafe tags, but leaves behind the pristine contents:
492
+ #
493
+ # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
494
+ # Loofah.fragment(unsafe_html).scrub!(:strip)
495
+ # => "ohai! <div>div is safe</div> but foo is <b>not</b>"
496
+ class Loofah::Scrubbers::Strip < ::Loofah::Scrubber
497
+ # @return [Strip] a new instance of Strip
498
+ def initialize; end
499
+
500
+ def scrub(node); end
501
+ end
502
+
503
+ # === scrub!(:unprintable)
504
+ #
505
+ # +:unprintable+ removes unprintable Unicode characters.
506
+ #
507
+ # markup = "<p>Some text with an unprintable character at the end\u2028</p>"
508
+ # Loofah.fragment(markup).scrub!(:unprintable)
509
+ # => "<p>Some text with an unprintable character at the end</p>"
510
+ #
511
+ # You may not be able to see the unprintable character in the above example, but there is a
512
+ # U+2028 character right before the closing </p> tag. These characters can cause issues if
513
+ # the content is ever parsed by JavaScript - more information here:
514
+ #
515
+ # http://timelessrepo.com/json-isnt-a-javascript-subset
516
+ class Loofah::Scrubbers::Unprintable < ::Loofah::Scrubber
517
+ # @return [Unprintable] a new instance of Unprintable
518
+ def initialize; end
519
+
520
+ def scrub(node); end
521
+ end
522
+
523
+ # === scrub!(:whitewash)
524
+ #
525
+ # +:whitewash+ removes all comments, styling and attributes in
526
+ # addition to doing markup-fixer-uppery and pruning unsafe tags. I
527
+ # like to call this "whitewashing", since it's like putting a new
528
+ # layer of paint on top of the HTML input to make it look nice.
529
+ #
530
+ # messy_markup = "ohai! <div id='foo' class='bar' style='margin: 10px'>div with attributes</div>"
531
+ # Loofah.fragment(messy_markup).scrub!(:whitewash)
532
+ # => "ohai! <div>div with attributes</div>"
533
+ #
534
+ # One use case for this scrubber is to clean up HTML that was
535
+ # cut-and-pasted from Microsoft Word into a WYSIWYG editor or a
536
+ # rich text editor. Microsoft's software is famous for injecting
537
+ # all kinds of cruft into its HTML output. Who needs that crap?
538
+ # Certainly not me.
539
+ class Loofah::Scrubbers::Whitewash < ::Loofah::Scrubber
540
+ # @return [Whitewash] a new instance of Whitewash
541
+ def initialize; end
542
+
543
+ def scrub(node); end
544
+ end
545
+
546
+ # Overrides +text+ in HTML::Document and HTML::DocumentFragment,
547
+ # and mixes in +to_text+.
548
+ module Loofah::TextBehavior
549
+ # Returns a plain-text version of the markup contained by the document,
550
+ # with HTML entities encoded.
551
+ #
552
+ # This method is significantly faster than #to_text, but isn't
553
+ # clever about whitespace around block elements.
554
+ #
555
+ # Loofah.document("<h1>Title</h1><div>Content</div>").text
556
+ # # => "TitleContent"
557
+ #
558
+ # By default, the returned text will have HTML entities
559
+ # escaped. If you want unescaped entities, and you understand
560
+ # that the result is unsafe to render in a browser, then you
561
+ # can pass an argument as shown:
562
+ #
563
+ # frag = Loofah.fragment("&lt;script&gt;alert('EVIL');&lt;/script&gt;")
564
+ # # ok for browser:
565
+ # frag.text # => "&lt;script&gt;alert('EVIL');&lt;/script&gt;"
566
+ # # decidedly not ok for browser:
567
+ # frag.text(:encode_special_chars => false) # => "<script>alert('EVIL');</script>"
568
+ def inner_text(options = T.unsafe(nil)); end
569
+
570
+ # Returns a plain-text version of the markup contained by the document,
571
+ # with HTML entities encoded.
572
+ #
573
+ # This method is significantly faster than #to_text, but isn't
574
+ # clever about whitespace around block elements.
575
+ #
576
+ # Loofah.document("<h1>Title</h1><div>Content</div>").text
577
+ # # => "TitleContent"
578
+ #
579
+ # By default, the returned text will have HTML entities
580
+ # escaped. If you want unescaped entities, and you understand
581
+ # that the result is unsafe to render in a browser, then you
582
+ # can pass an argument as shown:
583
+ #
584
+ # frag = Loofah.fragment("&lt;script&gt;alert('EVIL');&lt;/script&gt;")
585
+ # # ok for browser:
586
+ # frag.text # => "&lt;script&gt;alert('EVIL');&lt;/script&gt;"
587
+ # # decidedly not ok for browser:
588
+ # frag.text(:encode_special_chars => false) # => "<script>alert('EVIL');</script>"
589
+ def text(options = T.unsafe(nil)); end
590
+
591
+ # Returns a plain-text version of the markup contained by the document,
592
+ # with HTML entities encoded.
593
+ #
594
+ # This method is significantly faster than #to_text, but isn't
595
+ # clever about whitespace around block elements.
596
+ #
597
+ # Loofah.document("<h1>Title</h1><div>Content</div>").text
598
+ # # => "TitleContent"
599
+ #
600
+ # By default, the returned text will have HTML entities
601
+ # escaped. If you want unescaped entities, and you understand
602
+ # that the result is unsafe to render in a browser, then you
603
+ # can pass an argument as shown:
604
+ #
605
+ # frag = Loofah.fragment("&lt;script&gt;alert('EVIL');&lt;/script&gt;")
606
+ # # ok for browser:
607
+ # frag.text # => "&lt;script&gt;alert('EVIL');&lt;/script&gt;"
608
+ # # decidedly not ok for browser:
609
+ # frag.text(:encode_special_chars => false) # => "<script>alert('EVIL');</script>"
610
+ def to_str(options = T.unsafe(nil)); end
611
+
612
+ # Returns a plain-text version of the markup contained by the
613
+ # fragment, with HTML entities encoded.
614
+ #
615
+ # This method is slower than #text, but is clever about
616
+ # whitespace around block elements and line break elements.
617
+ #
618
+ # Loofah.document("<h1>Title</h1><div>Content<br>Next line</div>").to_text
619
+ # # => "\nTitle\n\nContent\nNext line\n"
620
+ def to_text(options = T.unsafe(nil)); end
621
+ end
622
+
623
+ # The version of Loofah you are using
624
+ Loofah::VERSION = T.let(T.unsafe(nil), String)
625
+
626
+ module Loofah::XML; end
627
+
628
+ # Subclass of Nokogiri::XML::Document.
629
+ #
630
+ # See Loofah::ScrubBehavior and Loofah::DocumentDecorator for additional methods.
631
+ class Loofah::XML::Document < ::Nokogiri::XML::Document
632
+ include ::Loofah::ScrubBehavior::Node
633
+ include ::Loofah::DocumentDecorator
634
+ end
635
+
636
+ # Subclass of Nokogiri::XML::DocumentFragment.
637
+ #
638
+ # See Loofah::ScrubBehavior for additional methods.
639
+ class Loofah::XML::DocumentFragment < ::Nokogiri::XML::DocumentFragment
640
+ class << self
641
+ # Overridden Nokogiri::XML::DocumentFragment
642
+ # constructor. Applications should use Loofah.fragment to
643
+ # parse a fragment.
644
+ def parse(tags); end
645
+ end
646
+ end