brakeman 4.4.0 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of brakeman might be problematic. Click here for more details.

Files changed (362) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +17 -0
  3. data/bundle/load.rb +7 -8
  4. data/bundle/ruby/2.5.0/gems/{ruby2ruby-2.4.1 → ruby2ruby-2.4.2}/History.rdoc +8 -0
  5. data/bundle/ruby/2.5.0/gems/{ruby2ruby-2.4.1 → ruby2ruby-2.4.2}/Manifest.txt +0 -0
  6. data/bundle/ruby/2.5.0/gems/{ruby2ruby-2.4.1 → ruby2ruby-2.4.2}/README.rdoc +0 -0
  7. data/bundle/ruby/2.5.0/gems/{ruby2ruby-2.4.1 → ruby2ruby-2.4.2}/lib/ruby2ruby.rb +34 -36
  8. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/History.rdoc +47 -0
  9. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/Manifest.txt +5 -4
  10. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/README.rdoc +0 -0
  11. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/compare/normalize.rb +29 -2
  12. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/debugging.md +18 -0
  13. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/rp_extensions.rb +0 -7
  14. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/rp_stringscanner.rb +0 -0
  15. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby20_parser.rb +6874 -0
  16. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby20_parser.y +284 -201
  17. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby21_parser.rb +6952 -0
  18. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby21_parser.y +281 -197
  19. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby22_parser.rb +6983 -0
  20. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0/lib/ruby_parser.yy → ruby_parser-3.13.0/lib/ruby22_parser.y} +280 -306
  21. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby23_parser.rb +6982 -0
  22. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby23_parser.y +282 -203
  23. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby24_parser.rb +6982 -0
  24. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby24_parser.y +282 -203
  25. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby25_parser.rb +6981 -0
  26. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby25_parser.y +282 -203
  27. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby26_parser.rb +6999 -0
  28. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby26_parser.y +2469 -0
  29. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby_lexer.rb +116 -118
  30. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby_lexer.rex +10 -8
  31. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby_lexer.rex.rb +8 -8
  32. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0 → ruby_parser-3.13.0}/lib/ruby_parser.rb +5 -7
  33. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby_parser.yy +2571 -0
  34. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/lib/ruby_parser_extras.rb +1360 -0
  35. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/tools/munge.rb +216 -0
  36. data/bundle/ruby/2.5.0/gems/ruby_parser-3.13.0/tools/ripper.rb +23 -0
  37. data/bundle/ruby/2.5.0/gems/ruby_parser-legacy-1.0.0/History.rdoc +6 -0
  38. data/bundle/ruby/2.5.0/gems/ruby_parser-legacy-1.0.0/Manifest.txt +19 -0
  39. data/bundle/ruby/2.5.0/gems/ruby_parser-legacy-1.0.0/README.rdoc +54 -0
  40. data/bundle/ruby/2.5.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy.rb +5 -0
  41. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0/lib → ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy}/ruby18_parser.rb +7 -6
  42. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0/lib → ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy}/ruby18_parser.y +5 -4
  43. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0/lib → ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy}/ruby19_parser.rb +7 -6
  44. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0/lib → ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy}/ruby19_parser.y +5 -4
  45. data/bundle/ruby/2.5.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby_lexer.rb +1412 -0
  46. data/bundle/ruby/2.5.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby_lexer.rex +179 -0
  47. data/bundle/ruby/2.5.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby_lexer.rex.rb +323 -0
  48. data/bundle/ruby/2.5.0/gems/ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy/ruby_parser.rb +30 -0
  49. data/bundle/ruby/2.5.0/gems/{ruby_parser-3.12.0/lib → ruby_parser-legacy-1.0.0/lib/ruby_parser/legacy}/ruby_parser_extras.rb +43 -33
  50. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/CHANGES.md +5 -0
  51. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/Gemfile +0 -0
  52. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/LICENSE.txt +0 -0
  53. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/README.md +0 -0
  54. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/bundle_install_all_ruby_versions.sh +0 -0
  55. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml.rb +0 -0
  56. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/deep.rb +0 -0
  57. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/libyaml_checker.rb +0 -0
  58. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/load.rb +0 -0
  59. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/parse/date.rb +2 -0
  60. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/parse/hexadecimal.rb +0 -0
  61. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/parse/sexagesimal.rb +0 -0
  62. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/psych_handler.rb +0 -0
  63. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/psych_resolver.rb +0 -0
  64. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/resolver.rb +0 -0
  65. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/safe_to_ruby_visitor.rb +0 -0
  66. data/bundle/ruby/2.5.0/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb +39 -0
  67. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/syck_hack.rb +0 -0
  68. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/syck_node_monkeypatch.rb +0 -0
  69. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/syck_resolver.rb +0 -0
  70. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/transform.rb +0 -0
  71. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/transform/to_boolean.rb +0 -0
  72. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/transform/to_date.rb +0 -0
  73. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/transform/to_float.rb +0 -0
  74. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/transform/to_integer.rb +0 -0
  75. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/transform/to_nil.rb +0 -0
  76. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/transform/to_symbol.rb +0 -0
  77. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/transform/transformation_map.rb +0 -0
  78. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/lib/safe_yaml/version.rb +1 -1
  79. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/run_specs_all_ruby_versions.sh +0 -0
  80. data/bundle/ruby/2.5.0/gems/{safe_yaml-1.0.4 → safe_yaml-1.0.5}/safe_yaml.gemspec +0 -0
  81. data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/History.rdoc +8 -0
  82. data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/Manifest.txt +0 -0
  83. data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/README.rdoc +0 -0
  84. data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/lib/composite_sexp_processor.rb +0 -0
  85. data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/lib/pt_testcase.rb +2 -2
  86. data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/lib/sexp.rb +4 -4
  87. data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/lib/sexp_processor.rb +1 -1
  88. data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/lib/strict_sexp.rb +3 -3
  89. data/bundle/ruby/2.5.0/gems/{sexp_processor-4.11.0 → sexp_processor-4.12.0}/lib/unique.rb +0 -0
  90. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/CHANGES +6 -0
  91. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/EXPRESSIONS.md +1 -1
  92. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/Gemfile +0 -0
  93. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/LICENSE +0 -0
  94. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/README.md +1 -1
  95. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple.rb +0 -0
  96. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/engine.rb +0 -0
  97. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/erb/engine.rb +0 -0
  98. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/erb/parser.rb +0 -0
  99. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/erb/template.rb +0 -0
  100. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/erb/trimming.rb +0 -0
  101. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/exceptions.rb +0 -0
  102. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filter.rb +0 -0
  103. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/code_merger.rb +0 -0
  104. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/control_flow.rb +0 -0
  105. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/dynamic_inliner.rb +0 -0
  106. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/encoding.rb +0 -0
  107. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/eraser.rb +0 -0
  108. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/escapable.rb +0 -0
  109. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/multi_flattener.rb +0 -0
  110. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/remove_bom.rb +0 -0
  111. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/static_analyzer.rb +0 -0
  112. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/static_merger.rb +0 -0
  113. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/string_splitter.rb +0 -0
  114. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/filters/validator.rb +0 -0
  115. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/generator.rb +0 -0
  116. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/generators/array.rb +0 -0
  117. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/generators/array_buffer.rb +0 -0
  118. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/generators/erb.rb +0 -0
  119. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/generators/rails_output_buffer.rb +0 -0
  120. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/generators/string_buffer.rb +0 -0
  121. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/grammar.rb +0 -0
  122. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/html/attribute_merger.rb +0 -0
  123. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/html/attribute_remover.rb +0 -0
  124. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/html/attribute_sorter.rb +0 -0
  125. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/html/dispatcher.rb +0 -0
  126. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/html/fast.rb +0 -0
  127. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/html/filter.rb +0 -0
  128. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/html/pretty.rb +0 -0
  129. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/html/safe.rb +0 -0
  130. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/map.rb +0 -0
  131. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/mixins/dispatcher.rb +2 -1
  132. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/mixins/engine_dsl.rb +0 -0
  133. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/mixins/grammar_dsl.rb +0 -0
  134. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/mixins/options.rb +0 -0
  135. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/mixins/template.rb +0 -0
  136. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/parser.rb +0 -0
  137. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/static_analyzer.rb +0 -0
  138. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/templates.rb +0 -0
  139. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/templates/rails.rb +2 -2
  140. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/templates/tilt.rb +0 -0
  141. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/lib/temple/utils.rb +0 -0
  142. data/bundle/ruby/2.5.0/gems/temple-0.8.1/lib/temple/version.rb +3 -0
  143. data/bundle/ruby/2.5.0/gems/{temple-0.8.0 → temple-0.8.1}/temple.gemspec +0 -0
  144. data/bundle/ruby/2.5.0/gems/{unicode-display_width-1.4.1 → unicode-display_width-1.5.0}/CHANGELOG.md +4 -0
  145. data/bundle/ruby/2.5.0/gems/{unicode-display_width-1.4.1 → unicode-display_width-1.5.0}/MIT-LICENSE.txt +1 -1
  146. data/bundle/ruby/2.5.0/gems/{unicode-display_width-1.4.1 → unicode-display_width-1.5.0}/README.md +10 -10
  147. data/bundle/ruby/2.5.0/gems/unicode-display_width-1.5.0/data/display_width.marshal.gz +0 -0
  148. data/bundle/ruby/2.5.0/gems/{unicode-display_width-1.4.1 → unicode-display_width-1.5.0}/lib/unicode/display_width.rb +0 -0
  149. data/bundle/ruby/2.5.0/gems/{unicode-display_width-1.4.1 → unicode-display_width-1.5.0}/lib/unicode/display_width/constants.rb +2 -2
  150. data/bundle/ruby/2.5.0/gems/{unicode-display_width-1.4.1 → unicode-display_width-1.5.0}/lib/unicode/display_width/index.rb +0 -0
  151. data/bundle/ruby/2.5.0/gems/{unicode-display_width-1.4.1 → unicode-display_width-1.5.0}/lib/unicode/display_width/no_string_ext.rb +0 -0
  152. data/bundle/ruby/2.5.0/gems/{unicode-display_width-1.4.1 → unicode-display_width-1.5.0}/lib/unicode/display_width/string_ext.rb +0 -0
  153. data/lib/brakeman/checks/base_check.rb +16 -0
  154. data/lib/brakeman/checks/check_content_tag.rb +12 -0
  155. data/lib/brakeman/checks/check_cross_site_scripting.rb +6 -6
  156. data/lib/brakeman/checks/check_evaluation.rb +0 -1
  157. data/lib/brakeman/checks/check_execute.rb +18 -0
  158. data/lib/brakeman/checks/check_send.rb +0 -1
  159. data/lib/brakeman/checks/check_session_manipulation.rb +0 -1
  160. data/lib/brakeman/checks/check_sql.rb +12 -3
  161. data/lib/brakeman/file_parser.rb +8 -4
  162. data/lib/brakeman/parsers/haml_embedded.rb +44 -0
  163. data/lib/brakeman/parsers/slim_embedded.rb +44 -0
  164. data/lib/brakeman/parsers/template_parser.rb +2 -4
  165. data/lib/brakeman/processors/alias_processor.rb +23 -1
  166. data/lib/brakeman/processors/lib/call_conversion_helper.rb +4 -0
  167. data/lib/brakeman/processors/slim_template_processor.rb +16 -0
  168. data/lib/brakeman/processors/template_alias_processor.rb +2 -2
  169. data/lib/brakeman/scanner.rb +11 -10
  170. data/lib/brakeman/tracker.rb +5 -1
  171. data/lib/brakeman/tracker/config.rb +32 -7
  172. data/lib/brakeman/util.rb +17 -0
  173. data/lib/brakeman/version.rb +1 -1
  174. metadata +157 -320
  175. data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby20_parser.rb +0 -6687
  176. data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby21_parser.rb +0 -6767
  177. data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby22_parser.rb +0 -6803
  178. data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby22_parser.y +0 -2376
  179. data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby23_parser.rb +0 -6818
  180. data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby24_parser.rb +0 -6818
  181. data/bundle/ruby/2.5.0/gems/ruby_parser-3.12.0/lib/ruby25_parser.rb +0 -6818
  182. data/bundle/ruby/2.5.0/gems/sass-3.4.25/CODE_OF_CONDUCT.md +0 -10
  183. data/bundle/ruby/2.5.0/gems/sass-3.4.25/CONTRIBUTING.md +0 -148
  184. data/bundle/ruby/2.5.0/gems/sass-3.4.25/MIT-LICENSE +0 -20
  185. data/bundle/ruby/2.5.0/gems/sass-3.4.25/README.md +0 -227
  186. data/bundle/ruby/2.5.0/gems/sass-3.4.25/REVISION +0 -1
  187. data/bundle/ruby/2.5.0/gems/sass-3.4.25/VERSION +0 -1
  188. data/bundle/ruby/2.5.0/gems/sass-3.4.25/VERSION_DATE +0 -1
  189. data/bundle/ruby/2.5.0/gems/sass-3.4.25/VERSION_NAME +0 -1
  190. data/bundle/ruby/2.5.0/gems/sass-3.4.25/extra/sass-spec-ref.sh +0 -32
  191. data/bundle/ruby/2.5.0/gems/sass-3.4.25/extra/update_watch.rb +0 -13
  192. data/bundle/ruby/2.5.0/gems/sass-3.4.25/init.rb +0 -18
  193. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass.rb +0 -109
  194. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores.rb +0 -15
  195. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores/base.rb +0 -88
  196. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores/chain.rb +0 -34
  197. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores/filesystem.rb +0 -60
  198. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores/memory.rb +0 -46
  199. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores/null.rb +0 -25
  200. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/callbacks.rb +0 -67
  201. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/css.rb +0 -408
  202. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/deprecation.rb +0 -55
  203. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/engine.rb +0 -1226
  204. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/environment.rb +0 -215
  205. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/error.rb +0 -198
  206. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/exec.rb +0 -9
  207. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/exec/base.rb +0 -199
  208. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/exec/sass_convert.rb +0 -283
  209. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/exec/sass_scss.rb +0 -440
  210. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/features.rb +0 -47
  211. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/importers.rb +0 -23
  212. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/importers/base.rb +0 -182
  213. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/importers/deprecated_path.rb +0 -51
  214. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/importers/filesystem.rb +0 -219
  215. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/logger.rb +0 -17
  216. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/logger/base.rb +0 -36
  217. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/logger/delayed.rb +0 -50
  218. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/logger/log_level.rb +0 -45
  219. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/media.rb +0 -210
  220. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin.rb +0 -134
  221. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/compiler.rb +0 -582
  222. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/configuration.rb +0 -134
  223. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/generic.rb +0 -15
  224. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/merb.rb +0 -48
  225. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/rack.rb +0 -60
  226. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/rails.rb +0 -47
  227. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/plugin/staleness_checker.rb +0 -199
  228. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/railtie.rb +0 -10
  229. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/repl.rb +0 -57
  230. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/root.rb +0 -7
  231. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script.rb +0 -66
  232. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/css_lexer.rb +0 -33
  233. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/css_parser.rb +0 -33
  234. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/css_variable_warning.rb +0 -52
  235. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/functions.rb +0 -2693
  236. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/lexer.rb +0 -464
  237. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/parser.rb +0 -832
  238. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree.rb +0 -16
  239. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/funcall.rb +0 -313
  240. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/interpolation.rb +0 -223
  241. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/list_literal.rb +0 -104
  242. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/literal.rb +0 -49
  243. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/map_literal.rb +0 -64
  244. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/node.rb +0 -127
  245. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/operation.rb +0 -156
  246. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/selector.rb +0 -26
  247. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/string_interpolation.rb +0 -125
  248. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/unary_operation.rb +0 -69
  249. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/tree/variable.rb +0 -57
  250. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value.rb +0 -11
  251. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/arg_list.rb +0 -36
  252. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/base.rb +0 -241
  253. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/bool.rb +0 -35
  254. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/color.rb +0 -698
  255. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/helpers.rb +0 -272
  256. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/list.rb +0 -113
  257. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/map.rb +0 -70
  258. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/null.rb +0 -44
  259. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/number.rb +0 -563
  260. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/script/value/string.rb +0 -138
  261. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/scss.rb +0 -14
  262. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/scss/css_parser.rb +0 -56
  263. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/scss/parser.rb +0 -1254
  264. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/scss/rx.rb +0 -140
  265. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/scss/static_parser.rb +0 -373
  266. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector.rb +0 -323
  267. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector/abstract_sequence.rb +0 -111
  268. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector/comma_sequence.rb +0 -191
  269. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector/pseudo.rb +0 -266
  270. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector/sequence.rb +0 -636
  271. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector/simple.rb +0 -117
  272. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/selector/simple_sequence.rb +0 -344
  273. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/shared.rb +0 -76
  274. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/source/map.rb +0 -213
  275. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/source/position.rb +0 -39
  276. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/source/range.rb +0 -41
  277. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/stack.rb +0 -120
  278. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/supports.rb +0 -225
  279. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/at_root_node.rb +0 -83
  280. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/charset_node.rb +0 -22
  281. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/comment_node.rb +0 -82
  282. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/content_node.rb +0 -9
  283. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/css_import_node.rb +0 -68
  284. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/debug_node.rb +0 -18
  285. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/directive_node.rb +0 -59
  286. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/each_node.rb +0 -24
  287. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/error_node.rb +0 -18
  288. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/extend_node.rb +0 -43
  289. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/for_node.rb +0 -36
  290. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/function_node.rb +0 -44
  291. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/if_node.rb +0 -52
  292. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/import_node.rb +0 -75
  293. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/keyframe_rule_node.rb +0 -15
  294. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/media_node.rb +0 -48
  295. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/mixin_def_node.rb +0 -38
  296. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/mixin_node.rb +0 -52
  297. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/node.rb +0 -240
  298. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/prop_node.rb +0 -170
  299. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/return_node.rb +0 -19
  300. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/root_node.rb +0 -44
  301. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/rule_node.rb +0 -155
  302. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/supports_node.rb +0 -38
  303. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/trace_node.rb +0 -33
  304. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/variable_node.rb +0 -36
  305. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/base.rb +0 -72
  306. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/check_nesting.rb +0 -173
  307. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/convert.rb +0 -351
  308. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/cssize.rb +0 -373
  309. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/deep_copy.rb +0 -107
  310. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/extend.rb +0 -70
  311. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/perform.rb +0 -564
  312. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/set_options.rb +0 -139
  313. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/visitors/to_css.rb +0 -409
  314. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/warn_node.rb +0 -18
  315. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/tree/while_node.rb +0 -18
  316. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util.rb +0 -1375
  317. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util/cross_platform_random.rb +0 -19
  318. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util/multibyte_string_scanner.rb +0 -155
  319. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util/normalized_map.rb +0 -129
  320. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util/ordered_hash.rb +0 -192
  321. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util/subset_map.rb +0 -109
  322. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/util/test.rb +0 -9
  323. data/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/version.rb +0 -124
  324. data/bundle/ruby/2.5.0/gems/sass-3.4.25/rails/init.rb +0 -1
  325. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/CHANGELOG.md +0 -1
  326. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/CONTRIBUTING.md +0 -38
  327. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/Gemfile +0 -20
  328. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/Guardfile +0 -8
  329. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/LICENSE +0 -20
  330. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/README.md +0 -349
  331. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/Rakefile +0 -5
  332. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/Vagrantfile +0 -96
  333. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen.rb +0 -54
  334. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapter.rb +0 -327
  335. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/bsd.rb +0 -75
  336. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/darwin.rb +0 -48
  337. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/linux.rb +0 -81
  338. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/polling.rb +0 -58
  339. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/adapters/windows.rb +0 -91
  340. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/directory_record.rb +0 -406
  341. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/listener.rb +0 -323
  342. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/turnstile.rb +0 -32
  343. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/lib/listen/version.rb +0 -3
  344. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/listen.gemspec +0 -28
  345. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/adapter_spec.rb +0 -149
  346. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/adapters/bsd_spec.rb +0 -36
  347. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/adapters/darwin_spec.rb +0 -37
  348. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/adapters/linux_spec.rb +0 -47
  349. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/adapters/polling_spec.rb +0 -68
  350. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/adapters/windows_spec.rb +0 -30
  351. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/directory_record_spec.rb +0 -1250
  352. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/listener_spec.rb +0 -258
  353. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen/turnstile_spec.rb +0 -56
  354. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/listen_spec.rb +0 -67
  355. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/spec_helper.rb +0 -25
  356. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/support/adapter_helper.rb +0 -666
  357. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/support/directory_record_helper.rb +0 -57
  358. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/support/fixtures_helper.rb +0 -29
  359. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/support/listeners_helper.rb +0 -179
  360. data/bundle/ruby/2.5.0/gems/sass-3.4.25/vendor/listen/spec/support/platform_helper.rb +0 -15
  361. data/bundle/ruby/2.5.0/gems/temple-0.8.0/lib/temple/version.rb +0 -3
  362. data/bundle/ruby/2.5.0/gems/unicode-display_width-1.4.1/data/display_width.marshal.gz +0 -0
@@ -1,351 +0,0 @@
1
- # A visitor for converting a Sass tree into a source string.
2
- class Sass::Tree::Visitors::Convert < Sass::Tree::Visitors::Base
3
- # Runs the visitor on a tree.
4
- #
5
- # @param root [Tree::Node] The root node of the Sass tree.
6
- # @param options [{Symbol => Object}] An options hash (see {Sass::CSS#initialize}).
7
- # @param format [Symbol] `:sass` or `:scss`.
8
- # @return [String] The Sass or SCSS source for the tree.
9
- def self.visit(root, options, format)
10
- new(options, format).send(:visit, root)
11
- end
12
-
13
- protected
14
-
15
- def initialize(options, format)
16
- @options = options
17
- @format = format
18
- @tabs = 0
19
- # 2 spaces by default
20
- @tab_chars = @options[:indent] || " "
21
- @is_else = false
22
- end
23
-
24
- def visit_children(parent)
25
- @tabs += 1
26
- return @format == :sass ? "\n" : " {}\n" if parent.children.empty?
27
-
28
- res = visit_rule_level(parent.children)
29
-
30
- if @format == :sass
31
- "\n" + res.rstrip + "\n"
32
- else
33
- " {\n" + res.rstrip + "\n#{@tab_chars * (@tabs - 1)}}\n"
34
- end
35
- ensure
36
- @tabs -= 1
37
- end
38
-
39
- # Ensures proper spacing between top-level nodes.
40
- def visit_root(node)
41
- visit_rule_level(node.children)
42
- end
43
-
44
- def visit_charset(node)
45
- "#{tab_str}@charset \"#{node.name}\"#{semi}\n"
46
- end
47
-
48
- def visit_comment(node)
49
- value = interp_to_src(node.value)
50
- if @format == :sass
51
- content = value.gsub(%r{\*/$}, '').rstrip
52
- if content =~ /\A[ \t]/
53
- # Re-indent SCSS comments like this:
54
- # /* foo
55
- # bar
56
- # baz */
57
- content.gsub!(/^/, ' ')
58
- content.sub!(%r{\A([ \t]*)/\*}, '/*\1')
59
- end
60
-
61
- if content.include?("\n")
62
- content.gsub!(/\n \*/, "\n ")
63
- spaces = content.scan(/\n( *)/).map {|s| s.first.size}.min
64
- sep = node.type == :silent ? "\n//" : "\n *"
65
- if spaces >= 2
66
- content.gsub!(/\n /, sep)
67
- else
68
- content.gsub!(/\n#{' ' * spaces}/, sep)
69
- end
70
- end
71
-
72
- content.gsub!(%r{\A/\*}, '//') if node.type == :silent
73
- content.gsub!(/^/, tab_str)
74
- content = content.rstrip + "\n"
75
- else
76
- spaces = (@tab_chars * [@tabs - value[/^ */].size, 0].max)
77
- content = if node.type == :silent
78
- value.gsub(%r{^[/ ]\*}, '//').gsub(%r{ *\*/$}, '')
79
- else
80
- value
81
- end.gsub(/^/, spaces) + "\n"
82
- end
83
- content
84
- end
85
-
86
- def visit_debug(node)
87
- "#{tab_str}@debug #{node.expr.to_sass(@options)}#{semi}\n"
88
- end
89
-
90
- def visit_error(node)
91
- "#{tab_str}@error #{node.expr.to_sass(@options)}#{semi}\n"
92
- end
93
-
94
- def visit_directive(node)
95
- res = "#{tab_str}#{interp_to_src(node.value)}"
96
- res.gsub!(/^@import \#\{(.*)\}([^}]*)$/, '@import \1\2')
97
- return res + "#{semi}\n" unless node.has_children
98
- res + yield
99
- end
100
-
101
- def visit_each(node)
102
- vars = node.vars.map {|var| "$#{dasherize(var)}"}.join(", ")
103
- "#{tab_str}@each #{vars} in #{node.list.to_sass(@options)}#{yield}"
104
- end
105
-
106
- def visit_extend(node)
107
- "#{tab_str}@extend #{selector_to_src(node.selector).lstrip}" +
108
- "#{' !optional' if node.optional?}#{semi}\n"
109
- end
110
-
111
- def visit_for(node)
112
- "#{tab_str}@for $#{dasherize(node.var)} from #{node.from.to_sass(@options)} " +
113
- "#{node.exclusive ? 'to' : 'through'} #{node.to.to_sass(@options)}#{yield}"
114
- end
115
-
116
- def visit_function(node)
117
- args = node.args.map do |v, d|
118
- d ? "#{v.to_sass(@options)}: #{d.to_sass(@options)}" : v.to_sass(@options)
119
- end.join(", ")
120
- if node.splat
121
- args << ", " unless node.args.empty?
122
- args << node.splat.to_sass(@options) << "..."
123
- end
124
-
125
- "#{tab_str}@function #{dasherize(node.name)}(#{args})#{yield}"
126
- end
127
-
128
- def visit_if(node)
129
- name =
130
- if !@is_else
131
- "if"
132
- elsif node.expr
133
- "else if"
134
- else
135
- "else"
136
- end
137
- @is_else = false
138
- str = "#{tab_str}@#{name}"
139
- str << " #{node.expr.to_sass(@options)}" if node.expr
140
- str << yield
141
- @is_else = true
142
- str << visit(node.else) if node.else
143
- str
144
- ensure
145
- @is_else = false
146
- end
147
-
148
- def visit_import(node)
149
- quote = @format == :scss ? '"' : ''
150
- "#{tab_str}@import #{quote}#{node.imported_filename}#{quote}#{semi}\n"
151
- end
152
-
153
- def visit_media(node)
154
- "#{tab_str}@media #{query_interp_to_src(node.query)}#{yield}"
155
- end
156
-
157
- def visit_supports(node)
158
- "#{tab_str}@#{node.name} #{node.condition.to_src(@options)}#{yield}"
159
- end
160
-
161
- def visit_cssimport(node)
162
- if node.uri.is_a?(Sass::Script::Tree::Node)
163
- str = "#{tab_str}@import #{node.uri.to_sass(@options)}"
164
- else
165
- str = "#{tab_str}@import #{node.uri}"
166
- end
167
- str << " supports(#{node.supports_condition.to_src(@options)})" if node.supports_condition
168
- str << " #{interp_to_src(node.query)}" unless node.query.empty?
169
- "#{str}#{semi}\n"
170
- end
171
-
172
- def visit_mixindef(node)
173
- args =
174
- if node.args.empty? && node.splat.nil?
175
- ""
176
- else
177
- str = '('
178
- str << node.args.map do |v, d|
179
- if d
180
- "#{v.to_sass(@options)}: #{d.to_sass(@options)}"
181
- else
182
- v.to_sass(@options)
183
- end
184
- end.join(", ")
185
-
186
- if node.splat
187
- str << ", " unless node.args.empty?
188
- str << node.splat.to_sass(@options) << '...'
189
- end
190
-
191
- str << ')'
192
- end
193
-
194
- "#{tab_str}#{@format == :sass ? '=' : '@mixin '}#{dasherize(node.name)}#{args}#{yield}"
195
- end
196
-
197
- def visit_mixin(node)
198
- arg_to_sass = lambda do |arg|
199
- sass = arg.to_sass(@options)
200
- sass = "(#{sass})" if arg.is_a?(Sass::Script::Tree::ListLiteral) && arg.separator == :comma
201
- sass
202
- end
203
-
204
- unless node.args.empty? && node.keywords.empty? && node.splat.nil?
205
- args = node.args.map(&arg_to_sass)
206
- keywords = Sass::Util.hash_to_a(node.keywords.as_stored).
207
- map {|k, v| "$#{dasherize(k)}: #{arg_to_sass[v]}"}
208
-
209
- if node.splat
210
- splat = "#{arg_to_sass[node.splat]}..."
211
- kwarg_splat = "#{arg_to_sass[node.kwarg_splat]}..." if node.kwarg_splat
212
- end
213
-
214
- arglist = "(#{[args, splat, keywords, kwarg_splat].flatten.compact.join(', ')})"
215
- end
216
- "#{tab_str}#{@format == :sass ? '+' : '@include '}" +
217
- "#{dasherize(node.name)}#{arglist}#{node.has_children ? yield : semi}\n"
218
- end
219
-
220
- def visit_content(node)
221
- "#{tab_str}@content#{semi}\n"
222
- end
223
-
224
- def visit_prop(node)
225
- res = tab_str + node.declaration(@options, @format)
226
- return res + semi + "\n" if node.children.empty?
227
- res + yield.rstrip + semi + "\n"
228
- end
229
-
230
- def visit_return(node)
231
- "#{tab_str}@return #{node.expr.to_sass(@options)}#{semi}\n"
232
- end
233
-
234
- def visit_rule(node)
235
- rule = node.parsed_rules ? [node.parsed_rules.to_s] : node.rule
236
- if @format == :sass
237
- name = selector_to_sass(rule)
238
- name = "\\" + name if name[0] == ?:
239
- name.gsub(/^/, tab_str) + yield
240
- elsif @format == :scss
241
- name = selector_to_scss(rule)
242
- res = name + yield
243
- if node.children.last.is_a?(Sass::Tree::CommentNode) && node.children.last.type == :silent
244
- res.slice!(-3..-1)
245
- res << "\n" << tab_str << "}\n"
246
- end
247
- res
248
- end
249
- end
250
-
251
- def visit_variable(node)
252
- "#{tab_str}$#{dasherize(node.name)}: #{node.expr.to_sass(@options)}" +
253
- "#{' !global' if node.global}#{' !default' if node.guarded}#{semi}\n"
254
- end
255
-
256
- def visit_warn(node)
257
- "#{tab_str}@warn #{node.expr.to_sass(@options)}#{semi}\n"
258
- end
259
-
260
- def visit_while(node)
261
- "#{tab_str}@while #{node.expr.to_sass(@options)}#{yield}"
262
- end
263
-
264
- def visit_atroot(node)
265
- if node.query
266
- "#{tab_str}@at-root #{query_interp_to_src(node.query)}#{yield}"
267
- elsif node.children.length == 1 && node.children.first.is_a?(Sass::Tree::RuleNode)
268
- rule = node.children.first
269
- "#{tab_str}@at-root #{selector_to_src(rule.rule).lstrip}#{visit_children(rule)}"
270
- else
271
- "#{tab_str}@at-root#{yield}"
272
- end
273
- end
274
-
275
- def visit_keyframerule(node)
276
- "#{tab_str}#{node.resolved_value}#{yield}"
277
- end
278
-
279
- private
280
-
281
- # Visit rule-level nodes and return their conversion with appropriate
282
- # whitespace added.
283
- def visit_rule_level(nodes)
284
- Sass::Util.enum_cons(nodes + [nil], 2).map do |child, nxt|
285
- visit(child) +
286
- if nxt &&
287
- (child.is_a?(Sass::Tree::CommentNode) && child.line + child.lines + 1 == nxt.line) ||
288
- (child.is_a?(Sass::Tree::ImportNode) && nxt.is_a?(Sass::Tree::ImportNode) &&
289
- child.line + 1 == nxt.line) ||
290
- (child.is_a?(Sass::Tree::VariableNode) && nxt.is_a?(Sass::Tree::VariableNode) &&
291
- child.line + 1 == nxt.line) ||
292
- (child.is_a?(Sass::Tree::PropNode) && nxt.is_a?(Sass::Tree::PropNode)) ||
293
- (child.is_a?(Sass::Tree::MixinNode) && nxt.is_a?(Sass::Tree::MixinNode) &&
294
- child.line + 1 == nxt.line)
295
- ""
296
- else
297
- "\n"
298
- end
299
- end.join.rstrip + "\n"
300
- end
301
-
302
- def interp_to_src(interp)
303
- interp.map {|r| r.is_a?(String) ? r : r.to_sass(@options)}.join
304
- end
305
-
306
- # Like interp_to_src, but removes the unnecessary `#{}` around the keys and
307
- # values in query expressions.
308
- def query_interp_to_src(interp)
309
- interp = interp.map do |e|
310
- next e unless e.is_a?(Sass::Script::Tree::Literal)
311
- next e unless e.value.is_a?(Sass::Script::Value::String)
312
- e.value.value
313
- end
314
-
315
- interp_to_src(interp)
316
- end
317
-
318
- def selector_to_src(sel)
319
- @format == :sass ? selector_to_sass(sel) : selector_to_scss(sel)
320
- end
321
-
322
- def selector_to_sass(sel)
323
- sel.map do |r|
324
- if r.is_a?(String)
325
- r.gsub(/(,)?([ \t]*)\n\s*/) {$1 ? "#{$1}#{$2}\n" : " "}
326
- else
327
- r.to_sass(@options)
328
- end
329
- end.join
330
- end
331
-
332
- def selector_to_scss(sel)
333
- interp_to_src(sel).gsub(/^[ \t]*/, tab_str).gsub(/[ \t]*$/, '')
334
- end
335
-
336
- def semi
337
- @format == :sass ? "" : ";"
338
- end
339
-
340
- def tab_str
341
- @tab_chars * @tabs
342
- end
343
-
344
- def dasherize(s)
345
- if @options[:dasherize]
346
- s.tr('_', '-')
347
- else
348
- s
349
- end
350
- end
351
- end
@@ -1,373 +0,0 @@
1
- # A visitor for converting a static Sass tree into a static CSS tree.
2
- class Sass::Tree::Visitors::Cssize < Sass::Tree::Visitors::Base
3
- # @param root [Tree::Node] The root node of the tree to visit.
4
- # @return [(Tree::Node, Sass::Util::SubsetMap)] The resulting tree of static nodes
5
- # *and* the extensions defined for this tree
6
- def self.visit(root); super; end
7
-
8
- protected
9
-
10
- # Returns the immediate parent of the current node.
11
- # @return [Tree::Node]
12
- def parent
13
- @parents.last
14
- end
15
-
16
- def initialize
17
- @parents = []
18
- @extends = Sass::Util::SubsetMap.new
19
- end
20
-
21
- # If an exception is raised, this adds proper metadata to the backtrace.
22
- def visit(node)
23
- super(node)
24
- rescue Sass::SyntaxError => e
25
- e.modify_backtrace(:filename => node.filename, :line => node.line)
26
- raise e
27
- end
28
-
29
- # Keeps track of the current parent node.
30
- def visit_children(parent)
31
- with_parent parent do
32
- parent.children = visit_children_without_parent(parent)
33
- parent
34
- end
35
- end
36
-
37
- # Like {#visit\_children}, but doesn't set {#parent}.
38
- #
39
- # @param node [Sass::Tree::Node]
40
- # @return [Array<Sass::Tree::Node>] the flattened results of
41
- # visiting all the children of `node`
42
- def visit_children_without_parent(node)
43
- node.children.map {|c| visit(c)}.flatten
44
- end
45
-
46
- # Runs a block of code with the current parent node
47
- # replaced with the given node.
48
- #
49
- # @param parent [Tree::Node] The new parent for the duration of the block.
50
- # @yield A block in which the parent is set to `parent`.
51
- # @return [Object] The return value of the block.
52
- def with_parent(parent)
53
- @parents.push parent
54
- yield
55
- ensure
56
- @parents.pop
57
- end
58
-
59
- # In Ruby 1.8, ensures that there's only one `@charset` directive
60
- # and that it's at the top of the document.
61
- #
62
- # @return [(Tree::Node, Sass::Util::SubsetMap)] The resulting tree of static nodes
63
- # *and* the extensions defined for this tree
64
- def visit_root(node)
65
- yield
66
-
67
- if parent.nil?
68
- # In Ruby 1.9 we can make all @charset nodes invisible
69
- # and infer the final @charset from the encoding of the final string.
70
- if Sass::Util.ruby1_8?
71
- charset = node.children.find {|c| c.is_a?(Sass::Tree::CharsetNode)}
72
- node.children.reject! {|c| c.is_a?(Sass::Tree::CharsetNode)}
73
- node.children.unshift charset if charset
74
- end
75
-
76
- imports_to_move = []
77
- import_limit = nil
78
- i = -1
79
- node.children.reject! do |n|
80
- i += 1
81
- if import_limit
82
- next false unless n.is_a?(Sass::Tree::CssImportNode)
83
- imports_to_move << n
84
- next true
85
- end
86
-
87
- if !n.is_a?(Sass::Tree::CommentNode) &&
88
- !n.is_a?(Sass::Tree::CharsetNode) &&
89
- !n.is_a?(Sass::Tree::CssImportNode)
90
- import_limit = i
91
- end
92
-
93
- false
94
- end
95
-
96
- if import_limit
97
- node.children = node.children[0...import_limit] + imports_to_move +
98
- node.children[import_limit..-1]
99
- end
100
- end
101
-
102
- return node, @extends
103
- rescue Sass::SyntaxError => e
104
- e.sass_template ||= node.template
105
- raise e
106
- end
107
-
108
- # A simple struct wrapping up information about a single `@extend` instance. A
109
- # single {ExtendNode} can have multiple Extends if either the parent node or
110
- # the extended selector is a comma sequence.
111
- #
112
- # @attr extender [Sass::Selector::Sequence]
113
- # The selector of the CSS rule containing the `@extend`.
114
- # @attr target [Array<Sass::Selector::Simple>] The selector being `@extend`ed.
115
- # @attr node [Sass::Tree::ExtendNode] The node that produced this extend.
116
- # @attr directives [Array<Sass::Tree::DirectiveNode>]
117
- # The directives containing the `@extend`.
118
- # @attr result [Symbol]
119
- # The result of this extend. One of `:not_found` (the target doesn't exist
120
- # in the document), `:failed_to_unify` (the target exists but cannot be
121
- # unified with the extender), or `:succeeded`.
122
- Extend = Struct.new(:extender, :target, :node, :directives, :result)
123
-
124
- # Registers an extension in the `@extends` subset map.
125
- def visit_extend(node)
126
- parent.resolved_rules.populate_extends(@extends, node.resolved_selector, node,
127
- @parents.select {|p| p.is_a?(Sass::Tree::DirectiveNode)})
128
- []
129
- end
130
-
131
- # Modifies exception backtraces to include the imported file.
132
- def visit_import(node)
133
- visit_children_without_parent(node)
134
- rescue Sass::SyntaxError => e
135
- e.modify_backtrace(:filename => node.children.first.filename)
136
- e.add_backtrace(:filename => node.filename, :line => node.line)
137
- raise e
138
- end
139
-
140
- # Asserts that all the traced children are valid in their new location.
141
- def visit_trace(node)
142
- visit_children_without_parent(node)
143
- rescue Sass::SyntaxError => e
144
- e.modify_backtrace(:mixin => node.name, :filename => node.filename, :line => node.line)
145
- e.add_backtrace(:filename => node.filename, :line => node.line)
146
- raise e
147
- end
148
-
149
- # Converts nested properties into flat properties
150
- # and updates the indentation of the prop node based on the nesting level.
151
- def visit_prop(node)
152
- if parent.is_a?(Sass::Tree::PropNode)
153
- node.resolved_name = "#{parent.resolved_name}-#{node.resolved_name}"
154
- node.tabs = parent.tabs + (parent.resolved_value.empty? ? 0 : 1) if node.style == :nested
155
- end
156
-
157
- yield
158
-
159
- result = node.children.dup
160
- if !node.resolved_value.empty? || node.children.empty?
161
- node.send(:check!)
162
- result.unshift(node)
163
- end
164
-
165
- result
166
- end
167
-
168
- def visit_atroot(node)
169
- # If there aren't any more directives or rules that this @at-root needs to
170
- # exclude, we can get rid of it and just evaluate the children.
171
- if @parents.none? {|n| node.exclude_node?(n)}
172
- results = visit_children_without_parent(node)
173
- results.each {|c| c.tabs += node.tabs if bubblable?(c)}
174
- if !results.empty? && bubblable?(results.last)
175
- results.last.group_end = node.group_end
176
- end
177
- return results
178
- end
179
-
180
- # If this @at-root excludes the immediate parent, return it as-is so that it
181
- # can be bubbled up by the parent node.
182
- return Bubble.new(node) if node.exclude_node?(parent)
183
-
184
- # Otherwise, duplicate the current parent and move it into the @at-root
185
- # node. As above, returning an @at-root node signals to the parent directive
186
- # that it should be bubbled upwards.
187
- bubble(node)
188
- end
189
-
190
- # The following directives are visible and have children. This means they need
191
- # to be able to handle bubbling up nodes such as @at-root and @media.
192
-
193
- # Updates the indentation of the rule node based on the nesting
194
- # level. The selectors were resolved in {Perform}.
195
- def visit_rule(node)
196
- yield
197
-
198
- rules = node.children.select {|c| bubblable?(c)}
199
- props = node.children.reject {|c| bubblable?(c) || c.invisible?}
200
-
201
- unless props.empty?
202
- node.children = props
203
- rules.each {|r| r.tabs += 1} if node.style == :nested
204
- rules.unshift(node)
205
- end
206
-
207
- rules = debubble(rules)
208
- unless parent.is_a?(Sass::Tree::RuleNode) || rules.empty? || !bubblable?(rules.last)
209
- rules.last.group_end = true
210
- end
211
- rules
212
- end
213
-
214
- def visit_keyframerule(node)
215
- return node unless node.has_children
216
-
217
- yield
218
-
219
- debubble(node.children, node)
220
- end
221
-
222
- # Bubbles a directive up through RuleNodes.
223
- def visit_directive(node)
224
- return node unless node.has_children
225
- if parent.is_a?(Sass::Tree::RuleNode)
226
- # @keyframes shouldn't include the rule nodes, so we manually create a
227
- # bubble that doesn't have the parent's contents for them.
228
- return node.normalized_name == '@keyframes' ? Bubble.new(node) : bubble(node)
229
- end
230
-
231
- yield
232
-
233
- # Since we don't know if the mere presence of an unknown directive may be
234
- # important, we should keep an empty version around even if all the contents
235
- # are removed via @at-root. However, if the contents are just bubbled out,
236
- # we don't need to do so.
237
- directive_exists = node.children.any? do |child|
238
- next true unless child.is_a?(Bubble)
239
- next false unless child.node.is_a?(Sass::Tree::DirectiveNode)
240
- child.node.resolved_value == node.resolved_value
241
- end
242
-
243
- # We know empty @keyframes directives do nothing.
244
- if directive_exists || node.name == '@keyframes'
245
- []
246
- else
247
- empty_node = node.dup
248
- empty_node.children = []
249
- [empty_node]
250
- end + debubble(node.children, node)
251
- end
252
-
253
- # Bubbles the `@media` directive up through RuleNodes
254
- # and merges it with other `@media` directives.
255
- def visit_media(node)
256
- return bubble(node) if parent.is_a?(Sass::Tree::RuleNode)
257
- return Bubble.new(node) if parent.is_a?(Sass::Tree::MediaNode)
258
-
259
- yield
260
-
261
- debubble(node.children, node) do |child|
262
- next child unless child.is_a?(Sass::Tree::MediaNode)
263
- # Copies of `node` can be bubbled, and we don't want to merge it with its
264
- # own query.
265
- next child if child.resolved_query == node.resolved_query
266
- next child if child.resolved_query = child.resolved_query.merge(node.resolved_query)
267
- end
268
- end
269
-
270
- # Bubbles the `@supports` directive up through RuleNodes.
271
- def visit_supports(node)
272
- return node unless node.has_children
273
- return bubble(node) if parent.is_a?(Sass::Tree::RuleNode)
274
-
275
- yield
276
-
277
- debubble(node.children, node)
278
- end
279
-
280
- private
281
-
282
- # "Bubbles" `node` one level by copying the parent and wrapping `node`'s
283
- # children with it.
284
- #
285
- # @param node [Sass::Tree::Node].
286
- # @return [Bubble]
287
- def bubble(node)
288
- new_rule = parent.dup
289
- new_rule.children = node.children
290
- node.children = [new_rule]
291
- Bubble.new(node)
292
- end
293
-
294
- # Pops all bubbles in `children` and intersperses the results with the other
295
- # values.
296
- #
297
- # If `parent` is passed, it's copied and used as the parent node for the
298
- # nested portions of `children`.
299
- #
300
- # @param children [List<Sass::Tree::Node, Bubble>]
301
- # @param parent [Sass::Tree::Node]
302
- # @yield [node] An optional block for processing bubbled nodes. Each bubbled
303
- # node will be passed to this block.
304
- # @yieldparam node [Sass::Tree::Node] A bubbled node.
305
- # @yieldreturn [Sass::Tree::Node?] A node to use in place of the bubbled node.
306
- # This can be the node itself, or `nil` to indicate that the node should be
307
- # omitted.
308
- # @return [List<Sass::Tree::Node, Bubble>]
309
- def debubble(children, parent = nil)
310
- # Keep track of the previous parent so that we don't divide `parent`
311
- # unnecessarily if the `@at-root` doesn't produce any new nodes (e.g.
312
- # `@at-root {@extend %foo}`).
313
- previous_parent = nil
314
-
315
- Sass::Util.slice_by(children) {|c| c.is_a?(Bubble)}.map do |(is_bubble, slice)|
316
- unless is_bubble
317
- next slice unless parent
318
- if previous_parent
319
- previous_parent.children.push(*slice)
320
- next []
321
- else
322
- previous_parent = new_parent = parent.dup
323
- new_parent.children = slice
324
- next new_parent
325
- end
326
- end
327
-
328
- slice.map do |bubble|
329
- next unless (node = block_given? ? yield(bubble.node) : bubble.node)
330
- node.tabs += bubble.tabs
331
- node.group_end = bubble.group_end
332
- results = [visit(node)].flatten
333
- previous_parent = nil unless results.empty?
334
- results
335
- end.compact
336
- end.flatten
337
- end
338
-
339
- # Returns whether or not a node can be bubbled up through the syntax tree.
340
- #
341
- # @param node [Sass::Tree::Node]
342
- # @return [Boolean]
343
- def bubblable?(node)
344
- node.is_a?(Sass::Tree::RuleNode) || node.bubbles?
345
- end
346
-
347
- # A wrapper class for a node that indicates to the parent that it should
348
- # treat the wrapped node as a sibling rather than a child.
349
- #
350
- # Nodes should be wrapped before they're passed to \{Cssize.visit}. They will
351
- # be automatically visited upon calling \{#pop}.
352
- #
353
- # This duck types as a [Sass::Tree::Node] for the purposes of
354
- # tree-manipulation operations.
355
- class Bubble
356
- attr_accessor :node
357
- attr_accessor :tabs
358
- attr_accessor :group_end
359
-
360
- def initialize(node)
361
- @node = node
362
- @tabs = 0
363
- end
364
-
365
- def bubbles?
366
- true
367
- end
368
-
369
- def inspect
370
- "(Bubble #{node.inspect})"
371
- end
372
- end
373
- end