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,877 @@
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
+ #
15
+ # source://loofah-2.18.0/lib/loofah/version.rb:2
16
+ module Loofah
17
+ class << self
18
+ # Shortcut for Loofah::HTML::Document.parse
19
+ # This method accepts the same parameters as Nokogiri::HTML::Document.parse
20
+ #
21
+ # source://loofah-2.18.0/lib/loofah.rb:35
22
+ def document(*args, &block); end
23
+
24
+ # Shortcut for Loofah::HTML::DocumentFragment.parse
25
+ # This method accepts the same parameters as Nokogiri::HTML::DocumentFragment.parse
26
+ #
27
+ # source://loofah-2.18.0/lib/loofah.rb:41
28
+ def fragment(*args, &block); end
29
+
30
+ # A helper to remove extraneous whitespace from text-ified HTML
31
+ #
32
+ # source://loofah-2.18.0/lib/loofah.rb:78
33
+ def remove_extraneous_whitespace(string); end
34
+
35
+ # Shortcut for Loofah.document(string_or_io).scrub!(method)
36
+ #
37
+ # source://loofah-2.18.0/lib/loofah.rb:51
38
+ def scrub_document(string_or_io, method); end
39
+
40
+ # Shortcut for Loofah.fragment(string_or_io).scrub!(method)
41
+ #
42
+ # source://loofah-2.18.0/lib/loofah.rb:46
43
+ def scrub_fragment(string_or_io, method); end
44
+
45
+ # Shortcut for Loofah.xml_document(string_or_io).scrub!(method)
46
+ #
47
+ # source://loofah-2.18.0/lib/loofah.rb:73
48
+ def scrub_xml_document(string_or_io, method); end
49
+
50
+ # Shortcut for Loofah.xml_fragment(string_or_io).scrub!(method)
51
+ #
52
+ # source://loofah-2.18.0/lib/loofah.rb:68
53
+ def scrub_xml_fragment(string_or_io, method); end
54
+
55
+ # Shortcut for Loofah::XML::Document.parse
56
+ # This method accepts the same parameters as Nokogiri::XML::Document.parse
57
+ #
58
+ # source://loofah-2.18.0/lib/loofah.rb:57
59
+ def xml_document(*args, &block); end
60
+
61
+ # Shortcut for Loofah::XML::DocumentFragment.parse
62
+ # This method accepts the same parameters as Nokogiri::XML::DocumentFragment.parse
63
+ #
64
+ # source://loofah-2.18.0/lib/loofah.rb:63
65
+ def xml_fragment(*args, &block); end
66
+
67
+ private
68
+
69
+ # remove comments that exist outside of the HTML element.
70
+ #
71
+ # these comments are allowed by the HTML spec:
72
+ #
73
+ # https://www.w3.org/TR/html401/struct/global.html#h-7.1
74
+ #
75
+ # but are not scrubbed by Loofah because these nodes don't meet
76
+ # the contract that scrubbers expect of a node (e.g., it can be
77
+ # replaced, sibling and children nodes can be created).
78
+ #
79
+ # source://loofah-2.18.0/lib/loofah.rb:93
80
+ def remove_comments_before_html_element(doc); end
81
+ end
82
+ end
83
+
84
+ # source://loofah-2.18.0/lib/loofah/instance_methods.rb:126
85
+ module Loofah::DocumentDecorator
86
+ # source://loofah-2.18.0/lib/loofah/instance_methods.rb:127
87
+ def initialize(*args, &block); end
88
+ end
89
+
90
+ # source://loofah-2.18.0/lib/loofah/elements.rb:5
91
+ module Loofah::Elements; end
92
+
93
+ # source://loofah-2.18.0/lib/loofah/elements.rb:91
94
+ Loofah::Elements::BLOCK_LEVEL = T.let(T.unsafe(nil), Set)
95
+
96
+ # Elements that aren't block but should generate a newline in #to_text
97
+ #
98
+ # source://loofah-2.18.0/lib/loofah/elements.rb:88
99
+ Loofah::Elements::INLINE_LINE_BREAK = T.let(T.unsafe(nil), Set)
100
+
101
+ # source://loofah-2.18.0/lib/loofah/elements.rb:92
102
+ Loofah::Elements::LINEBREAKERS = T.let(T.unsafe(nil), Set)
103
+
104
+ # The following elements may also be considered block-level
105
+ # elements since they may contain block-level elements
106
+ #
107
+ # source://loofah-2.18.0/lib/loofah/elements.rb:75
108
+ Loofah::Elements::LOOSE_BLOCK_LEVEL = T.let(T.unsafe(nil), Set)
109
+
110
+ # source://loofah-2.18.0/lib/loofah/elements.rb:90
111
+ Loofah::Elements::STRICT_BLOCK_LEVEL = T.let(T.unsafe(nil), Set)
112
+
113
+ # source://loofah-2.18.0/lib/loofah/elements.rb:6
114
+ Loofah::Elements::STRICT_BLOCK_LEVEL_HTML4 = T.let(T.unsafe(nil), Set)
115
+
116
+ # https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements
117
+ #
118
+ # source://loofah-2.18.0/lib/loofah/elements.rb:34
119
+ Loofah::Elements::STRICT_BLOCK_LEVEL_HTML5 = T.let(T.unsafe(nil), Set)
120
+
121
+ # source://loofah-2.18.0/lib/loofah/html/document.rb:3
122
+ module Loofah::HTML; end
123
+
124
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:5
125
+ module Loofah::HTML5; end
126
+
127
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:48
128
+ module Loofah::HTML5::SafeList; end
129
+
130
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:226
131
+ Loofah::HTML5::SafeList::ACCEPTABLE_ATTRIBUTES = T.let(T.unsafe(nil), Set)
132
+
133
+ # see https://www.quackit.com/css/functions/
134
+ # omit `url` and `image` from that list
135
+ #
136
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:742
137
+ Loofah::HTML5::SafeList::ACCEPTABLE_CSS_FUNCTIONS = T.let(T.unsafe(nil), Set)
138
+
139
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:685
140
+ Loofah::HTML5::SafeList::ACCEPTABLE_CSS_KEYWORDS = T.let(T.unsafe(nil), Set)
141
+
142
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:615
143
+ Loofah::HTML5::SafeList::ACCEPTABLE_CSS_PROPERTIES = T.let(T.unsafe(nil), Set)
144
+
145
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:49
146
+ Loofah::HTML5::SafeList::ACCEPTABLE_ELEMENTS = T.let(T.unsafe(nil), Set)
147
+
148
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:815
149
+ Loofah::HTML5::SafeList::ACCEPTABLE_PROTOCOLS = T.let(T.unsafe(nil), Set)
150
+
151
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:802
152
+ Loofah::HTML5::SafeList::ACCEPTABLE_SVG_PROPERTIES = T.let(T.unsafe(nil), Set)
153
+
154
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:844
155
+ Loofah::HTML5::SafeList::ACCEPTABLE_URI_DATA_MEDIATYPES = T.let(T.unsafe(nil), Set)
156
+
157
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:855
158
+ Loofah::HTML5::SafeList::ALLOWED_ATTRIBUTES = T.let(T.unsafe(nil), Set)
159
+
160
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:858
161
+ Loofah::HTML5::SafeList::ALLOWED_CSS_FUNCTIONS = T.let(T.unsafe(nil), Set)
162
+
163
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:857
164
+ Loofah::HTML5::SafeList::ALLOWED_CSS_KEYWORDS = T.let(T.unsafe(nil), Set)
165
+
166
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:856
167
+ Loofah::HTML5::SafeList::ALLOWED_CSS_PROPERTIES = T.let(T.unsafe(nil), Set)
168
+
169
+ # subclasses may define their own versions of these constants
170
+ #
171
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:854
172
+ Loofah::HTML5::SafeList::ALLOWED_ELEMENTS = T.let(T.unsafe(nil), Set)
173
+
174
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:879
175
+ Loofah::HTML5::SafeList::ALLOWED_ELEMENTS_WITH_LIBXML2 = T.let(T.unsafe(nil), Set)
176
+
177
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:860
178
+ Loofah::HTML5::SafeList::ALLOWED_PROTOCOLS = T.let(T.unsafe(nil), Set)
179
+
180
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:859
181
+ Loofah::HTML5::SafeList::ALLOWED_SVG_PROPERTIES = T.let(T.unsafe(nil), Set)
182
+
183
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:861
184
+ Loofah::HTML5::SafeList::ALLOWED_URI_DATA_MEDIATYPES = T.let(T.unsafe(nil), Set)
185
+
186
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:515
187
+ Loofah::HTML5::SafeList::ARIA_ATTRIBUTES = T.let(T.unsafe(nil), Set)
188
+
189
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:571
190
+ Loofah::HTML5::SafeList::ATTR_VAL_IS_URI = T.let(T.unsafe(nil), Set)
191
+
192
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:309
193
+ Loofah::HTML5::SafeList::MATHML_ATTRIBUTES = T.let(T.unsafe(nil), Set)
194
+
195
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:146
196
+ Loofah::HTML5::SafeList::MATHML_ELEMENTS = T.let(T.unsafe(nil), Set)
197
+
198
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:813
199
+ Loofah::HTML5::SafeList::PROTOCOL_SEPARATOR = T.let(T.unsafe(nil), Regexp)
200
+
201
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:795
202
+ Loofah::HTML5::SafeList::SHORTHAND_CSS_PROPERTIES = T.let(T.unsafe(nil), Set)
203
+
204
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:597
205
+ Loofah::HTML5::SafeList::SVG_ALLOW_LOCAL_HREF = T.let(T.unsafe(nil), Set)
206
+
207
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:361
208
+ Loofah::HTML5::SafeList::SVG_ATTRIBUTES = T.let(T.unsafe(nil), Set)
209
+
210
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:583
211
+ Loofah::HTML5::SafeList::SVG_ATTR_VAL_ALLOWS_REF = T.let(T.unsafe(nil), Set)
212
+
213
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:182
214
+ Loofah::HTML5::SafeList::SVG_ELEMENTS = T.let(T.unsafe(nil), Set)
215
+
216
+ # additional tags we should consider safe since we have libxml2 fixing up our documents.
217
+ #
218
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:874
219
+ Loofah::HTML5::SafeList::TAGS_SAFE_WITH_LIBXML2 = T.let(T.unsafe(nil), Set)
220
+
221
+ # TODO: remove VOID_ELEMENTS in a future major release
222
+ # and put it in the tests (it is used only for testing, not for functional behavior)
223
+ #
224
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:865
225
+ Loofah::HTML5::SafeList::VOID_ELEMENTS = T.let(T.unsafe(nil), Set)
226
+
227
+ # source://loofah-2.18.0/lib/loofah/html5/scrub.rb:7
228
+ module Loofah::HTML5::Scrub
229
+ class << self
230
+ # @return [Boolean]
231
+ #
232
+ # source://loofah-2.18.0/lib/loofah/html5/scrub.rb:16
233
+ def allowed_element?(element_name); end
234
+
235
+ # libxml2 >= 2.9.2 fails to escape comments within some attributes.
236
+ #
237
+ # see comments about CVE-2018-8048 within the tests for more information
238
+ #
239
+ # source://loofah-2.18.0/lib/loofah/html5/scrub.rb:135
240
+ def force_correct_attribute_escaping!(node); end
241
+
242
+ # alternative implementation of the html5lib attribute scrubbing algorithm
243
+ #
244
+ # source://loofah-2.18.0/lib/loofah/html5/scrub.rb:21
245
+ def scrub_attributes(node); end
246
+
247
+ # source://loofah-2.18.0/lib/loofah/html5/scrub.rb:79
248
+ def scrub_css(style); end
249
+
250
+ # source://loofah-2.18.0/lib/loofah/html5/scrub.rb:74
251
+ def scrub_css_attribute(node); end
252
+ end
253
+ end
254
+
255
+ # source://loofah-2.18.0/lib/loofah/html5/scrub.rb:8
256
+ Loofah::HTML5::Scrub::CONTROL_CHARACTERS = T.let(T.unsafe(nil), Regexp)
257
+
258
+ # source://loofah-2.18.0/lib/loofah/html5/scrub.rb:10
259
+ Loofah::HTML5::Scrub::CRASS_SEMICOLON = T.let(T.unsafe(nil), Hash)
260
+
261
+ # source://loofah-2.18.0/lib/loofah/html5/scrub.rb:11
262
+ Loofah::HTML5::Scrub::CSS_IMPORTANT = T.let(T.unsafe(nil), String)
263
+
264
+ # source://loofah-2.18.0/lib/loofah/html5/scrub.rb:9
265
+ Loofah::HTML5::Scrub::CSS_KEYWORDISH = T.let(T.unsafe(nil), Regexp)
266
+
267
+ # source://loofah-2.18.0/lib/loofah/html5/scrub.rb:12
268
+ Loofah::HTML5::Scrub::CSS_PROPERTY_STRING_WITHOUT_EMBEDDED_QUOTES = T.let(T.unsafe(nil), Regexp)
269
+
270
+ # source://loofah-2.18.0/lib/loofah/html5/scrub.rb:13
271
+ Loofah::HTML5::Scrub::DATA_ATTRIBUTE_NAME = T.let(T.unsafe(nil), Regexp)
272
+
273
+ # source://loofah-2.18.0/lib/loofah/html5/safelist.rb:882
274
+ Loofah::HTML5::WhiteList = Loofah::HTML5::SafeList
275
+
276
+ # Subclass of Nokogiri::HTML::Document.
277
+ #
278
+ # See Loofah::ScrubBehavior and Loofah::TextBehavior for additional methods.
279
+ #
280
+ # source://loofah-2.18.0/lib/loofah/html/document.rb:9
281
+ class Loofah::HTML::Document < ::Nokogiri::HTML4::Document
282
+ include ::Loofah::ScrubBehavior::Node
283
+ include ::Loofah::DocumentDecorator
284
+ include ::Loofah::TextBehavior
285
+
286
+ # source://loofah-2.18.0/lib/loofah/html/document.rb:14
287
+ def serialize_root; end
288
+ end
289
+
290
+ # Subclass of Nokogiri::HTML::DocumentFragment.
291
+ #
292
+ # See Loofah::ScrubBehavior and Loofah::TextBehavior for additional methods.
293
+ #
294
+ # source://loofah-2.18.0/lib/loofah/html/document_fragment.rb:9
295
+ class Loofah::HTML::DocumentFragment < ::Nokogiri::HTML4::DocumentFragment
296
+ include ::Loofah::TextBehavior
297
+
298
+ # Returns the HTML markup contained by the fragment
299
+ #
300
+ # source://loofah-2.18.0/lib/loofah/html/document_fragment.rb:31
301
+ def serialize; end
302
+
303
+ # source://loofah-2.18.0/lib/loofah/html/document_fragment.rb:37
304
+ def serialize_root; end
305
+
306
+ # Returns the HTML markup contained by the fragment
307
+ #
308
+ # source://loofah-2.18.0/lib/loofah/html/document_fragment.rb:31
309
+ def to_s; end
310
+
311
+ class << self
312
+ # Overridden Nokogiri::HTML::DocumentFragment
313
+ # constructor. Applications should use Loofah.fragment to
314
+ # parse a fragment.
315
+ #
316
+ # source://loofah-2.18.0/lib/loofah/html/document_fragment.rb:18
317
+ def parse(tags, encoding = T.unsafe(nil)); end
318
+ end
319
+ end
320
+
321
+ # constants related to working around unhelpful libxml2 behavior
322
+ #
323
+ # ಠ_ಠ
324
+ #
325
+ # source://loofah-2.18.0/lib/loofah/html5/libxml2_workarounds.rb:11
326
+ module Loofah::LibxmlWorkarounds; end
327
+
328
+ # these attributes and qualifying parent tags are determined by the code at:
329
+ #
330
+ # https://git.gnome.org/browse/libxml2/tree/HTMLtree.c?h=v2.9.2#n714
331
+ #
332
+ # see comments about CVE-2018-8048 within the tests for more information
333
+ #
334
+ # source://loofah-2.18.0/lib/loofah/html5/libxml2_workarounds.rb:19
335
+ Loofah::LibxmlWorkarounds::BROKEN_ESCAPING_ATTRIBUTES = T.let(T.unsafe(nil), Set)
336
+
337
+ # source://loofah-2.18.0/lib/loofah/html5/libxml2_workarounds.rb:25
338
+ Loofah::LibxmlWorkarounds::BROKEN_ESCAPING_ATTRIBUTES_QUALIFYING_TAG = T.let(T.unsafe(nil), Hash)
339
+
340
+ # source://loofah-2.18.0/lib/loofah/metahelpers.rb:3
341
+ module Loofah::MetaHelpers
342
+ class << self
343
+ # source://loofah-2.18.0/lib/loofah/metahelpers.rb:4
344
+ def add_downcased_set_members_to_all_set_constants(mojule); end
345
+ end
346
+ end
347
+
348
+ # Mixes +scrub!+ into Document, DocumentFragment, Node and NodeSet.
349
+ #
350
+ # Traverse the document or fragment, invoking the +scrubber+ on
351
+ # each node.
352
+ #
353
+ # +scrubber+ must either be one of the symbols representing the
354
+ # built-in scrubbers (see Scrubbers), or a Scrubber instance.
355
+ #
356
+ # span2div = Loofah::Scrubber.new do |node|
357
+ # node.name = "div" if node.name == "span"
358
+ # end
359
+ # Loofah.fragment("<span>foo</span><p>bar</p>").scrub!(span2div).to_s
360
+ # # => "<div>foo</div><p>bar</p>"
361
+ #
362
+ # or
363
+ #
364
+ # unsafe_html = "ohai! <div>div is safe</div> <script>but script is not</script>"
365
+ # Loofah.fragment(unsafe_html).scrub!(:strip).to_s
366
+ # # => "ohai! <div>div is safe</div> "
367
+ #
368
+ # Note that this method is called implicitly from
369
+ # Loofah.scrub_fragment and Loofah.scrub_document.
370
+ #
371
+ # Please see Scrubber for more information on implementation and traversal, and
372
+ # README.rdoc for more example usage.
373
+ #
374
+ # source://loofah-2.18.0/lib/loofah/instance_methods.rb:30
375
+ module Loofah::ScrubBehavior
376
+ class << self
377
+ # source://loofah-2.18.0/lib/loofah/instance_methods.rb:60
378
+ def resolve_scrubber(scrubber); end
379
+ end
380
+ end
381
+
382
+ # source://loofah-2.18.0/lib/loofah/instance_methods.rb:31
383
+ module Loofah::ScrubBehavior::Node
384
+ # source://loofah-2.18.0/lib/loofah/instance_methods.rb:32
385
+ def scrub!(scrubber); end
386
+ end
387
+
388
+ # source://loofah-2.18.0/lib/loofah/instance_methods.rb:53
389
+ module Loofah::ScrubBehavior::NodeSet
390
+ # source://loofah-2.18.0/lib/loofah/instance_methods.rb:54
391
+ def scrub!(scrubber); end
392
+ end
393
+
394
+ # A Scrubber wraps up a block (or method) that is run on an HTML node (element):
395
+ #
396
+ # # change all <span> tags to <div> tags
397
+ # span2div = Loofah::Scrubber.new do |node|
398
+ # node.name = "div" if node.name == "span"
399
+ # end
400
+ #
401
+ # Alternatively, this scrubber could have been implemented as:
402
+ #
403
+ # class Span2Div < Loofah::Scrubber
404
+ # def scrub(node)
405
+ # node.name = "div" if node.name == "span"
406
+ # end
407
+ # end
408
+ # span2div = Span2Div.new
409
+ #
410
+ # This can then be run on a document:
411
+ #
412
+ # Loofah.fragment("<span>foo</span><p>bar</p>").scrub!(span2div).to_s
413
+ # # => "<div>foo</div><p>bar</p>"
414
+ #
415
+ # Scrubbers can be run on a document in either a top-down traversal (the
416
+ # default) or bottom-up. Top-down scrubbers can optionally return
417
+ # Scrubber::STOP to terminate the traversal of a subtree.
418
+ #
419
+ # source://loofah-2.18.0/lib/loofah/scrubber.rb:34
420
+ class Loofah::Scrubber
421
+ # Options may include
422
+ # :direction => :top_down (the default)
423
+ # or
424
+ # :direction => :bottom_up
425
+ #
426
+ # For top_down traversals, if the block returns
427
+ # Loofah::Scrubber::STOP, then the traversal will be terminated
428
+ # for the current node's subtree.
429
+ #
430
+ # Alternatively, a Scrubber may inherit from Loofah::Scrubber,
431
+ # and implement +scrub+, which is slightly faster than using a
432
+ # block.
433
+ #
434
+ # @return [Scrubber] a new instance of Scrubber
435
+ #
436
+ # source://loofah-2.18.0/lib/loofah/scrubber.rb:65
437
+ def initialize(options = T.unsafe(nil), &block); end
438
+
439
+ # If the attribute is not set, add it
440
+ # If the attribute is set, don't overwrite the existing value
441
+ #
442
+ # source://loofah-2.18.0/lib/loofah/scrubber.rb:94
443
+ def append_attribute(node, attribute, value); end
444
+
445
+ # When a scrubber is initialized, the optional block is saved as
446
+ # :block. Note that, if no block is passed, then the +scrub+
447
+ # method is assumed to have been implemented.
448
+ #
449
+ # source://loofah-2.18.0/lib/loofah/scrubber.rb:49
450
+ def block; end
451
+
452
+ # When a scrubber is initialized, the :direction may be specified
453
+ # as :top_down (the default) or :bottom_up.
454
+ #
455
+ # source://loofah-2.18.0/lib/loofah/scrubber.rb:44
456
+ def direction; end
457
+
458
+ # When +new+ is not passed a block, the class may implement
459
+ # +scrub+, which will be called for each document node.
460
+ #
461
+ # @raise [ScrubberNotFound]
462
+ #
463
+ # source://loofah-2.18.0/lib/loofah/scrubber.rb:86
464
+ def scrub(node); end
465
+
466
+ # Calling +traverse+ will cause the document to be traversed by
467
+ # either the lambda passed to the initializer or the +scrub+
468
+ # method, in the direction specified at +new+ time.
469
+ #
470
+ # source://loofah-2.18.0/lib/loofah/scrubber.rb:78
471
+ def traverse(node); end
472
+
473
+ private
474
+
475
+ # source://loofah-2.18.0/lib/loofah/scrubber.rb:103
476
+ def html5lib_sanitize(node); end
477
+
478
+ # source://loofah-2.18.0/lib/loofah/scrubber.rb:125
479
+ def traverse_conditionally_bottom_up(node); end
480
+
481
+ # source://loofah-2.18.0/lib/loofah/scrubber.rb:116
482
+ def traverse_conditionally_top_down(node); end
483
+ end
484
+
485
+ # Top-down Scrubbers may return CONTINUE to indicate that the subtree should be traversed.
486
+ #
487
+ # source://loofah-2.18.0/lib/loofah/scrubber.rb:37
488
+ Loofah::Scrubber::CONTINUE = T.let(T.unsafe(nil), Object)
489
+
490
+ # Top-down Scrubbers may return STOP to indicate that the subtree should not be traversed.
491
+ #
492
+ # source://loofah-2.18.0/lib/loofah/scrubber.rb:40
493
+ Loofah::Scrubber::STOP = T.let(T.unsafe(nil), Object)
494
+
495
+ # A RuntimeError raised when Loofah could not find an appropriate scrubber.
496
+ #
497
+ # source://loofah-2.18.0/lib/loofah/scrubber.rb:6
498
+ class Loofah::ScrubberNotFound < ::RuntimeError; end
499
+
500
+ # Loofah provides some built-in scrubbers for sanitizing with
501
+ # HTML5lib's safelist and for accomplishing some common
502
+ # transformation tasks.
503
+ #
504
+ #
505
+ # === Loofah::Scrubbers::Strip / scrub!(:strip)
506
+ #
507
+ # +:strip+ removes unknown/unsafe tags, but leaves behind the pristine contents:
508
+ #
509
+ # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
510
+ # Loofah.fragment(unsafe_html).scrub!(:strip)
511
+ # => "ohai! <div>div is safe</div> but foo is <b>not</b>"
512
+ #
513
+ #
514
+ # === Loofah::Scrubbers::Prune / scrub!(:prune)
515
+ #
516
+ # +:prune+ removes unknown/unsafe tags and their contents (including their subtrees):
517
+ #
518
+ # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
519
+ # Loofah.fragment(unsafe_html).scrub!(:prune)
520
+ # => "ohai! <div>div is safe</div> "
521
+ #
522
+ #
523
+ # === Loofah::Scrubbers::Escape / scrub!(:escape)
524
+ #
525
+ # +:escape+ performs HTML entity escaping on the unknown/unsafe tags:
526
+ #
527
+ # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
528
+ # Loofah.fragment(unsafe_html).scrub!(:escape)
529
+ # => "ohai! <div>div is safe</div> &lt;foo&gt;but foo is &lt;b&gt;not&lt;/b&gt;&lt;/foo&gt;"
530
+ #
531
+ #
532
+ # === Loofah::Scrubbers::Whitewash / scrub!(:whitewash)
533
+ #
534
+ # +:whitewash+ removes all comments, styling and attributes in
535
+ # addition to doing markup-fixer-uppery and pruning unsafe tags. I
536
+ # like to call this "whitewashing", since it's like putting a new
537
+ # layer of paint on top of the HTML input to make it look nice.
538
+ #
539
+ # messy_markup = "ohai! <div id='foo' class='bar' style='margin: 10px'>div with attributes</div>"
540
+ # Loofah.fragment(messy_markup).scrub!(:whitewash)
541
+ # => "ohai! <div>div with attributes</div>"
542
+ #
543
+ # One use case for this scrubber is to clean up HTML that was
544
+ # cut-and-pasted from Microsoft Word into a WYSIWYG editor or a
545
+ # rich text editor. Microsoft's software is famous for injecting
546
+ # all kinds of cruft into its HTML output. Who needs that crap?
547
+ # Certainly not me.
548
+ #
549
+ #
550
+ # === Loofah::Scrubbers::NoFollow / scrub!(:nofollow)
551
+ #
552
+ # +:nofollow+ adds a rel="nofollow" attribute to all links
553
+ #
554
+ # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
555
+ # Loofah.fragment(link_farmers_markup).scrub!(:nofollow)
556
+ # => "ohai! <a href='http://www.myswarmysite.com/' rel="nofollow">I like your blog post</a>"
557
+ #
558
+ #
559
+ # === Loofah::Scrubbers::NoOpener / scrub!(:noopener)
560
+ #
561
+ # +:noopener+ adds a rel="noopener" attribute to all links
562
+ #
563
+ # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
564
+ # Loofah.fragment(link_farmers_markup).scrub!(:noopener)
565
+ # => "ohai! <a href='http://www.myswarmysite.com/' rel="noopener">I like your blog post</a>"
566
+ #
567
+ #
568
+ # === Loofah::Scrubbers::Unprintable / scrub!(:unprintable)
569
+ #
570
+ # +:unprintable+ removes unprintable Unicode characters.
571
+ #
572
+ # markup = "<p>Some text with an unprintable character at the end\u2028</p>"
573
+ # Loofah.fragment(markup).scrub!(:unprintable)
574
+ # => "<p>Some text with an unprintable character at the end</p>"
575
+ #
576
+ # You may not be able to see the unprintable character in the above example, but there is a
577
+ # U+2028 character right before the closing </p> tag. These characters can cause issues if
578
+ # the content is ever parsed by JavaScript - more information here:
579
+ #
580
+ # http://timelessrepo.com/json-isnt-a-javascript-subset
581
+ #
582
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:86
583
+ module Loofah::Scrubbers
584
+ class << self
585
+ # Returns an array of symbols representing the built-in scrubbers
586
+ #
587
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:299
588
+ def scrubber_symbols; end
589
+ end
590
+ end
591
+
592
+ # === scrub!(:escape)
593
+ #
594
+ # +:escape+ performs HTML entity escaping on the unknown/unsafe tags:
595
+ #
596
+ # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
597
+ # Loofah.fragment(unsafe_html).scrub!(:escape)
598
+ # => "ohai! <div>div is safe</div> &lt;foo&gt;but foo is &lt;b&gt;not&lt;/b&gt;&lt;/foo&gt;"
599
+ #
600
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:143
601
+ class Loofah::Scrubbers::Escape < ::Loofah::Scrubber
602
+ # @return [Escape] a new instance of Escape
603
+ #
604
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:144
605
+ def initialize; end
606
+
607
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:148
608
+ def scrub(node); end
609
+ end
610
+
611
+ # A hash that maps a symbol (like +:prune+) to the appropriate Scrubber (Loofah::Scrubbers::Prune).
612
+ #
613
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:285
614
+ Loofah::Scrubbers::MAP = T.let(T.unsafe(nil), Hash)
615
+
616
+ # This class probably isn't useful publicly, but is used for #to_text's current implemention
617
+ #
618
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:237
619
+ class Loofah::Scrubbers::NewlineBlockElements < ::Loofah::Scrubber
620
+ # @return [NewlineBlockElements] a new instance of NewlineBlockElements
621
+ #
622
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:238
623
+ def initialize; end
624
+
625
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:242
626
+ def scrub(node); end
627
+ end
628
+
629
+ # === scrub!(:nofollow)
630
+ #
631
+ # +:nofollow+ adds a rel="nofollow" attribute to all links
632
+ #
633
+ # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
634
+ # Loofah.fragment(link_farmers_markup).scrub!(:nofollow)
635
+ # => "ohai! <a href='http://www.myswarmysite.com/' rel="nofollow">I like your blog post</a>"
636
+ #
637
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:203
638
+ class Loofah::Scrubbers::NoFollow < ::Loofah::Scrubber
639
+ # @return [NoFollow] a new instance of NoFollow
640
+ #
641
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:204
642
+ def initialize; end
643
+
644
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:208
645
+ def scrub(node); end
646
+ end
647
+
648
+ # === scrub!(:noopener)
649
+ #
650
+ # +:noopener+ adds a rel="noopener" attribute to all links
651
+ #
652
+ # link_farmers_markup = "ohai! <a href='http://www.myswarmysite.com/'>I like your blog post</a>"
653
+ # Loofah.fragment(link_farmers_markup).scrub!(:noopener)
654
+ # => "ohai! <a href='http://www.myswarmysite.com/' rel="noopener">I like your blog post</a>"
655
+ #
656
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:224
657
+ class Loofah::Scrubbers::NoOpener < ::Loofah::Scrubber
658
+ # @return [NoOpener] a new instance of NoOpener
659
+ #
660
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:225
661
+ def initialize; end
662
+
663
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:229
664
+ def scrub(node); end
665
+ end
666
+
667
+ # === scrub!(:prune)
668
+ #
669
+ # +:prune+ removes unknown/unsafe tags and their contents (including their subtrees):
670
+ #
671
+ # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
672
+ # Loofah.fragment(unsafe_html).scrub!(:prune)
673
+ # => "ohai! <div>div is safe</div> "
674
+ #
675
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:122
676
+ class Loofah::Scrubbers::Prune < ::Loofah::Scrubber
677
+ # @return [Prune] a new instance of Prune
678
+ #
679
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:123
680
+ def initialize; end
681
+
682
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:127
683
+ def scrub(node); end
684
+ end
685
+
686
+ # === scrub!(:strip)
687
+ #
688
+ # +:strip+ removes unknown/unsafe tags, but leaves behind the pristine contents:
689
+ #
690
+ # unsafe_html = "ohai! <div>div is safe</div> <foo>but foo is <b>not</b></foo>"
691
+ # Loofah.fragment(unsafe_html).scrub!(:strip)
692
+ # => "ohai! <div>div is safe</div> but foo is <b>not</b>"
693
+ #
694
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:96
695
+ class Loofah::Scrubbers::Strip < ::Loofah::Scrubber
696
+ # @return [Strip] a new instance of Strip
697
+ #
698
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:97
699
+ def initialize; end
700
+
701
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:101
702
+ def scrub(node); end
703
+ end
704
+
705
+ # === scrub!(:unprintable)
706
+ #
707
+ # +:unprintable+ removes unprintable Unicode characters.
708
+ #
709
+ # markup = "<p>Some text with an unprintable character at the end\u2028</p>"
710
+ # Loofah.fragment(markup).scrub!(:unprintable)
711
+ # => "<p>Some text with an unprintable character at the end</p>"
712
+ #
713
+ # You may not be able to see the unprintable character in the above example, but there is a
714
+ # U+2028 character right before the closing </p> tag. These characters can cause issues if
715
+ # the content is ever parsed by JavaScript - more information here:
716
+ #
717
+ # http://timelessrepo.com/json-isnt-a-javascript-subset
718
+ #
719
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:269
720
+ class Loofah::Scrubbers::Unprintable < ::Loofah::Scrubber
721
+ # @return [Unprintable] a new instance of Unprintable
722
+ #
723
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:270
724
+ def initialize; end
725
+
726
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:274
727
+ def scrub(node); end
728
+ end
729
+
730
+ # === scrub!(:whitewash)
731
+ #
732
+ # +:whitewash+ removes all comments, styling and attributes in
733
+ # addition to doing markup-fixer-uppery and pruning unsafe tags. I
734
+ # like to call this "whitewashing", since it's like putting a new
735
+ # layer of paint on top of the HTML input to make it look nice.
736
+ #
737
+ # messy_markup = "ohai! <div id='foo' class='bar' style='margin: 10px'>div with attributes</div>"
738
+ # Loofah.fragment(messy_markup).scrub!(:whitewash)
739
+ # => "ohai! <div>div with attributes</div>"
740
+ #
741
+ # One use case for this scrubber is to clean up HTML that was
742
+ # cut-and-pasted from Microsoft Word into a WYSIWYG editor or a
743
+ # rich text editor. Microsoft's software is famous for injecting
744
+ # all kinds of cruft into its HTML output. Who needs that crap?
745
+ # Certainly not me.
746
+ #
747
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:174
748
+ class Loofah::Scrubbers::Whitewash < ::Loofah::Scrubber
749
+ # @return [Whitewash] a new instance of Whitewash
750
+ #
751
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:175
752
+ def initialize; end
753
+
754
+ # source://loofah-2.18.0/lib/loofah/scrubbers.rb:179
755
+ def scrub(node); end
756
+ end
757
+
758
+ # Overrides +text+ in HTML::Document and HTML::DocumentFragment,
759
+ # and mixes in +to_text+.
760
+ #
761
+ # source://loofah-2.18.0/lib/loofah/instance_methods.rb:73
762
+ module Loofah::TextBehavior
763
+ # Returns a plain-text version of the markup contained by the document,
764
+ # with HTML entities encoded.
765
+ #
766
+ # This method is significantly faster than #to_text, but isn't
767
+ # clever about whitespace around block elements.
768
+ #
769
+ # Loofah.document("<h1>Title</h1><div>Content</div>").text
770
+ # # => "TitleContent"
771
+ #
772
+ # By default, the returned text will have HTML entities
773
+ # escaped. If you want unescaped entities, and you understand
774
+ # that the result is unsafe to render in a browser, then you
775
+ # can pass an argument as shown:
776
+ #
777
+ # frag = Loofah.fragment("&lt;script&gt;alert('EVIL');&lt;/script&gt;")
778
+ # # ok for browser:
779
+ # frag.text # => "&lt;script&gt;alert('EVIL');&lt;/script&gt;"
780
+ # # decidedly not ok for browser:
781
+ # frag.text(:encode_special_chars => false) # => "<script>alert('EVIL');</script>"
782
+ #
783
+ # source://loofah-2.18.0/lib/loofah/instance_methods.rb:95
784
+ def inner_text(options = T.unsafe(nil)); end
785
+
786
+ # Returns a plain-text version of the markup contained by the document,
787
+ # with HTML entities encoded.
788
+ #
789
+ # This method is significantly faster than #to_text, but isn't
790
+ # clever about whitespace around block elements.
791
+ #
792
+ # Loofah.document("<h1>Title</h1><div>Content</div>").text
793
+ # # => "TitleContent"
794
+ #
795
+ # By default, the returned text will have HTML entities
796
+ # escaped. If you want unescaped entities, and you understand
797
+ # that the result is unsafe to render in a browser, then you
798
+ # can pass an argument as shown:
799
+ #
800
+ # frag = Loofah.fragment("&lt;script&gt;alert('EVIL');&lt;/script&gt;")
801
+ # # ok for browser:
802
+ # frag.text # => "&lt;script&gt;alert('EVIL');&lt;/script&gt;"
803
+ # # decidedly not ok for browser:
804
+ # frag.text(:encode_special_chars => false) # => "<script>alert('EVIL');</script>"
805
+ #
806
+ # source://loofah-2.18.0/lib/loofah/instance_methods.rb:95
807
+ def text(options = T.unsafe(nil)); end
808
+
809
+ # Returns a plain-text version of the markup contained by the document,
810
+ # with HTML entities encoded.
811
+ #
812
+ # This method is significantly faster than #to_text, but isn't
813
+ # clever about whitespace around block elements.
814
+ #
815
+ # Loofah.document("<h1>Title</h1><div>Content</div>").text
816
+ # # => "TitleContent"
817
+ #
818
+ # By default, the returned text will have HTML entities
819
+ # escaped. If you want unescaped entities, and you understand
820
+ # that the result is unsafe to render in a browser, then you
821
+ # can pass an argument as shown:
822
+ #
823
+ # frag = Loofah.fragment("&lt;script&gt;alert('EVIL');&lt;/script&gt;")
824
+ # # ok for browser:
825
+ # frag.text # => "&lt;script&gt;alert('EVIL');&lt;/script&gt;"
826
+ # # decidedly not ok for browser:
827
+ # frag.text(:encode_special_chars => false) # => "<script>alert('EVIL');</script>"
828
+ #
829
+ # source://loofah-2.18.0/lib/loofah/instance_methods.rb:95
830
+ def to_str(options = T.unsafe(nil)); end
831
+
832
+ # Returns a plain-text version of the markup contained by the
833
+ # fragment, with HTML entities encoded.
834
+ #
835
+ # This method is slower than #text, but is clever about
836
+ # whitespace around block elements and line break elements.
837
+ #
838
+ # Loofah.document("<h1>Title</h1><div>Content<br>Next line</div>").to_text
839
+ # # => "\nTitle\n\nContent\nNext line\n"
840
+ #
841
+ # source://loofah-2.18.0/lib/loofah/instance_methods.rb:121
842
+ def to_text(options = T.unsafe(nil)); end
843
+ end
844
+
845
+ # The version of Loofah you are using
846
+ #
847
+ # source://loofah-2.18.0/lib/loofah/version.rb:4
848
+ Loofah::VERSION = T.let(T.unsafe(nil), String)
849
+
850
+ # source://loofah-2.18.0/lib/loofah/xml/document.rb:3
851
+ module Loofah::XML; end
852
+
853
+ # Subclass of Nokogiri::XML::Document.
854
+ #
855
+ # See Loofah::ScrubBehavior and Loofah::DocumentDecorator for additional methods.
856
+ #
857
+ # source://loofah-2.18.0/lib/loofah/xml/document.rb:9
858
+ class Loofah::XML::Document < ::Nokogiri::XML::Document
859
+ include ::Loofah::ScrubBehavior::Node
860
+ include ::Loofah::DocumentDecorator
861
+ end
862
+
863
+ # Subclass of Nokogiri::XML::DocumentFragment.
864
+ #
865
+ # See Loofah::ScrubBehavior for additional methods.
866
+ #
867
+ # source://loofah-2.18.0/lib/loofah/xml/document_fragment.rb:9
868
+ class Loofah::XML::DocumentFragment < ::Nokogiri::XML::DocumentFragment
869
+ class << self
870
+ # Overridden Nokogiri::XML::DocumentFragment
871
+ # constructor. Applications should use Loofah.fragment to
872
+ # parse a fragment.
873
+ #
874
+ # source://loofah-2.18.0/lib/loofah/xml/document_fragment.rb:16
875
+ def parse(tags); end
876
+ end
877
+ end