brakeman 5.1.1 → 5.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +22 -1
- data/README.md +1 -1
- data/bundle/load.rb +5 -5
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/CHANGELOG.md +8 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/FAQ.md +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/Gemfile +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/MIT-LICENSE +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/README.md +19 -13
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/REFERENCE.md +10 -3
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/TODO +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/haml.gemspec +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/attribute_builder.rb +55 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/attribute_compiler.rb +4 -2
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/attribute_parser.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/buffer.rb +0 -56
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/compiler.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/engine.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/error.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/escapable.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/exec.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/filters.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/generator.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/helpers/action_view_extensions.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/helpers/action_view_mods.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/helpers/action_view_xss_mods.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/helpers/safe_erubi_template.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/helpers/safe_erubis_template.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/helpers/xss_mods.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/helpers.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/options.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/parser.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/plugin.rb +18 -1
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/railtie.rb +5 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/sass_rails_filter.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/template/options.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/template.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/temple_engine.rb +2 -1
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/temple_line_counter.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/util.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/version.rb +1 -1
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/yard/default/fulldoc/html/css/common.sass +0 -0
- data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/yard/default/layout/html/footer.erb +0 -0
- data/bundle/ruby/2.7.0/gems/{parallel-1.20.1 → parallel-1.21.0}/MIT-LICENSE.txt +0 -0
- data/bundle/ruby/2.7.0/gems/parallel-1.21.0/lib/parallel/processor_count.rb +45 -0
- data/bundle/ruby/2.7.0/gems/parallel-1.21.0/lib/parallel/version.rb +4 -0
- data/bundle/ruby/2.7.0/gems/{parallel-1.20.1 → parallel-1.21.0}/lib/parallel.rb +52 -43
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/History.rdoc +88 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/Manifest.txt +3 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/README.rdoc +1 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/compare/normalize.rb +6 -1
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/debugging.md +0 -0
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/gauntlet.md +106 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/lib/rp_extensions.rb +15 -36
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/rp_stringscanner.rb +33 -0
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby20_parser.rb +7128 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/lib/ruby20_parser.y +335 -252
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby21_parser.rb +7182 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/lib/ruby21_parser.y +330 -249
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby22_parser.rb +7228 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/lib/ruby22_parser.y +334 -251
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby23_parser.rb +7237 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0/lib/ruby26_parser.y → ruby_parser-3.18.1/lib/ruby23_parser.y} +336 -276
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby24_parser.rb +7268 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/lib/ruby24_parser.y +334 -251
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby25_parser.rb +7268 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0/lib/ruby30_parser.y → ruby_parser-3.18.1/lib/ruby25_parser.y} +335 -304
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby26_parser.rb +7287 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0/lib/ruby27_parser.y → ruby_parser-3.18.1/lib/ruby26_parser.y} +334 -288
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby27_parser.rb +8517 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0/lib/ruby_parser.yy → ruby_parser-3.18.1/lib/ruby27_parser.y} +906 -380
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby30_parser.rb +8751 -0
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby30_parser.y +3472 -0
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby3_parser.yy +3476 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/lib/ruby_lexer.rb +261 -609
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/lib/ruby_lexer.rex +27 -20
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/lib/ruby_lexer.rex.rb +59 -23
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby_lexer_strings.rb +638 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/lib/ruby_parser.rb +0 -0
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib/ruby_parser.yy +3487 -0
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/lib/ruby_parser_extras.rb +296 -115
- data/bundle/ruby/2.7.0/gems/{ruby_parser-3.16.0 → ruby_parser-3.18.1}/tools/munge.rb +34 -6
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/tools/ripper.rb +44 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.3 → sexp_processor-4.16.0}/History.rdoc +15 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.3 → sexp_processor-4.16.0}/Manifest.txt +0 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.3 → sexp_processor-4.16.0}/README.rdoc +0 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.3 → sexp_processor-4.16.0}/lib/composite_sexp_processor.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.3 → sexp_processor-4.16.0}/lib/pt_testcase.rb +7 -2
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.3 → sexp_processor-4.16.0}/lib/sexp.rb +19 -9
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.3 → sexp_processor-4.16.0}/lib/sexp_matcher.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.3 → sexp_processor-4.16.0}/lib/sexp_processor.rb +1 -1
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.3 → sexp_processor-4.16.0}/lib/strict_sexp.rb +25 -3
- data/bundle/ruby/2.7.0/gems/{sexp_processor-4.15.3 → sexp_processor-4.16.0}/lib/unique.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.7.0 → unicode-display_width-1.8.0}/CHANGELOG.md +4 -0
- data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.7.0 → unicode-display_width-1.8.0}/MIT-LICENSE.txt +0 -0
- data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.7.0 → unicode-display_width-1.8.0}/README.md +1 -1
- data/bundle/ruby/2.7.0/gems/unicode-display_width-1.8.0/data/display_width.marshal.gz +0 -0
- data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.7.0 → unicode-display_width-1.8.0}/lib/unicode/display_width/constants.rb +2 -2
- data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.7.0 → unicode-display_width-1.8.0}/lib/unicode/display_width/index.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.7.0 → unicode-display_width-1.8.0}/lib/unicode/display_width/no_string_ext.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.7.0 → unicode-display_width-1.8.0}/lib/unicode/display_width/string_ext.rb +0 -0
- data/bundle/ruby/2.7.0/gems/{unicode-display_width-1.7.0 → unicode-display_width-1.8.0}/lib/unicode/display_width.rb +0 -0
- data/lib/brakeman/app_tree.rb +1 -1
- data/lib/brakeman/checks/base_check.rb +10 -0
- data/lib/brakeman/checks/check_eol_rails.rb +23 -0
- data/lib/brakeman/checks/check_eol_ruby.rb +26 -0
- data/lib/brakeman/checks/check_json_parsing.rb +1 -1
- data/lib/brakeman/checks/check_sql.rb +3 -2
- data/lib/brakeman/checks/check_symbol_dos.rb +1 -1
- data/lib/brakeman/checks/eol_check.rb +47 -0
- data/lib/brakeman/options.rb +8 -0
- data/lib/brakeman/processors/alias_processor.rb +7 -1
- data/lib/brakeman/processors/gem_processor.rb +3 -0
- data/lib/brakeman/processors/haml_template_processor.rb +9 -0
- data/lib/brakeman/processors/lib/call_conversion_helper.rb +2 -0
- data/lib/brakeman/processors/lib/rails3_route_processor.rb +2 -0
- data/lib/brakeman/processors/model_processor.rb +1 -0
- data/lib/brakeman/report/ignore/config.rb +1 -1
- data/lib/brakeman/report/report_csv.rb +1 -1
- data/lib/brakeman/report/report_sarif.rb +1 -1
- data/lib/brakeman/report/report_text.rb +1 -1
- data/lib/brakeman/scanner.rb +15 -13
- data/lib/brakeman/tracker/config.rb +8 -1
- data/lib/brakeman/version.rb +1 -1
- data/lib/brakeman/warning_codes.rb +4 -0
- data/lib/brakeman.rb +2 -2
- data/lib/ruby_parser/bm_sexp.rb +11 -1
- metadata +105 -99
- data/bundle/ruby/2.7.0/gems/parallel-1.20.1/lib/parallel/processor_count.rb +0 -42
- data/bundle/ruby/2.7.0/gems/parallel-1.20.1/lib/parallel/version.rb +0 -3
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/rp_stringscanner.rb +0 -64
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby20_parser.rb +0 -7075
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby21_parser.rb +0 -7148
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby22_parser.rb +0 -7185
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby23_parser.rb +0 -7199
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby23_parser.y +0 -2643
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby24_parser.rb +0 -7219
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby25_parser.rb +0 -7218
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby25_parser.y +0 -2651
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby26_parser.rb +0 -7240
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby27_parser.rb +0 -7358
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/lib/ruby30_parser.rb +0 -7358
- data/bundle/ruby/2.7.0/gems/ruby_parser-3.16.0/tools/ripper.rb +0 -39
- data/bundle/ruby/2.7.0/gems/unicode-display_width-1.7.0/data/display_width.marshal.gz +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6672aa0a7532078f913b27574846fc26abd9fc624af178b9017f2de885f5505
|
4
|
+
data.tar.gz: a3eeda0729d72d601bc94f4296f4f878e2cd970ef089f38dd0fcaad2e361f36c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 700ed2e62792a1d2a38222199f2030f29aafee865f79e0b57be17fbbc718f6bbc1dadc1f5e3ceab4b961635f165f1fdcd9303520a4e5a897044e682319aca200
|
7
|
+
data.tar.gz: 2f030bd82e1c7bccd70610151c8baec7a0ed4723226e41f9cd0104d56c51cc443ace66ac9ac43381aaee4f27d5ffad807476060eca2d308d5f878370e0bd7874
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
# 5.2.1 - 2022-01-30
|
2
|
+
|
3
|
+
* Add warning codes for EOL software warnings
|
4
|
+
|
5
|
+
# 5.2.0 - 2021-12-15
|
6
|
+
|
7
|
+
* Initial Rails 7 support
|
8
|
+
* Require Ruby 2.5.0+
|
9
|
+
* Fix issue with calls to `foo.root` in routes
|
10
|
+
* Ignore `I18n.locale` in SQL queries
|
11
|
+
* Do not treat `sanitize_sql_like` as safe
|
12
|
+
* Add new checks for unsupported Ruby and Rails versions
|
13
|
+
|
14
|
+
# 5.1.2 - 2021-10-28
|
15
|
+
|
16
|
+
* Handle cases where enums are not symbols
|
17
|
+
* Support newer Haml with ::Haml::AttributeBuilder.build
|
18
|
+
* Fix issue where the previous output is still visible (Jason Frey)
|
19
|
+
* Fix warning sorting with nil line numbers
|
20
|
+
* Update for latest RubyParser (Ryan Davis)
|
21
|
+
|
1
22
|
# 5.1.1 - 2021-07-19
|
2
23
|
|
3
24
|
* Unrefactor IgnoreConfig's use of `Brakeman::FilePath`
|
@@ -449,7 +470,7 @@
|
|
449
470
|
* Delay loading vendored gems and modifying load path
|
450
471
|
* Avoid warning about SQL injection with `quoted_primary_key`
|
451
472
|
* Support more safe `&.` operations
|
452
|
-
* Allow
|
473
|
+
* Allow multiple line regex in `validates_format_of` (Dmitrij Fedorenko)
|
453
474
|
* Only consider `if` branches in templates
|
454
475
|
* Avoid overwriting instance/class methods with same name (Tim Wade)
|
455
476
|
* Add `--force-scan` option (Neil Matatall)
|
data/README.md
CHANGED
@@ -66,7 +66,7 @@ Outside of Rails root (note that the output file is relative to path/to/rails/ap
|
|
66
66
|
|
67
67
|
Brakeman should work with any version of Rails from 2.3.x to 6.x.
|
68
68
|
|
69
|
-
Brakeman can analyze code written with Ruby 1.8 syntax and newer, but requires at least Ruby 2.
|
69
|
+
Brakeman can analyze code written with Ruby 1.8 syntax and newer, but requires at least Ruby 2.4.0 to run.
|
70
70
|
|
71
71
|
# Basic Options
|
72
72
|
|
data/bundle/load.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
path = File.expand_path('../..', __FILE__)
|
2
|
+
$:.unshift "#{path}/bundle/ruby/2.7.0/gems/ruby_parser-3.18.1/lib"
|
2
3
|
$:.unshift "#{path}/bundle/ruby/2.7.0/gems/temple-0.8.2/lib"
|
3
|
-
$:.unshift "#{path}/bundle/ruby/2.7.0/gems/
|
4
|
-
$:.unshift "#{path}/bundle/ruby/2.7.0/gems/unicode-display_width-1.7.0/lib"
|
4
|
+
$:.unshift "#{path}/bundle/ruby/2.7.0/gems/sexp_processor-4.16.0/lib"
|
5
5
|
$:.unshift "#{path}/bundle/ruby/2.7.0/gems/tilt-2.0.10/lib"
|
6
|
+
$:.unshift "#{path}/bundle/ruby/2.7.0/gems/unicode-display_width-1.8.0/lib"
|
6
7
|
$:.unshift "#{path}/bundle/ruby/2.7.0/gems/slim-4.1.0/lib"
|
7
8
|
$:.unshift "#{path}/bundle/ruby/2.7.0/gems/highline-2.0.3/lib"
|
8
9
|
$:.unshift "#{path}/bundle/ruby/2.7.0/gems/ruby2ruby-2.4.4/lib"
|
9
10
|
$:.unshift "#{path}/bundle/ruby/2.7.0/gems/terminal-table-1.8.0/lib"
|
10
|
-
$:.unshift "#{path}/bundle/ruby/2.7.0/gems/
|
11
|
-
$:.unshift "#{path}/bundle/ruby/2.7.0/gems/parallel-1.
|
11
|
+
$:.unshift "#{path}/bundle/ruby/2.7.0/gems/haml-5.2.2/lib"
|
12
|
+
$:.unshift "#{path}/bundle/ruby/2.7.0/gems/parallel-1.21.0/lib"
|
12
13
|
$:.unshift "#{path}/bundle/ruby/2.7.0/gems/ruby_parser-legacy-1.0.0/lib"
|
13
14
|
$:.unshift "#{path}/bundle/ruby/2.7.0/gems/erubis-2.7.0/lib"
|
14
|
-
$:.unshift "#{path}/bundle/ruby/2.7.0/gems/haml-5.2.1/lib"
|
15
15
|
$:.unshift "#{path}/bundle/ruby/2.7.0/gems/rexml-3.2.5/lib"
|
16
16
|
$:.unshift "#{path}/bundle/ruby/2.7.0/gems/safe_yaml-1.0.5/lib"
|
@@ -1,5 +1,13 @@
|
|
1
1
|
# Haml Changelog
|
2
2
|
|
3
|
+
## 5.2.2
|
4
|
+
Released on July 27, 2021
|
5
|
+
([diff](https://github.com/haml/haml/compare/v5.2.1...v5.2.2)).
|
6
|
+
|
7
|
+
* Support for adding Annotations to Haml output (a Rails feature 6.1+)
|
8
|
+
* Expanded test matrix to include Ruby 3.0 and Rails 6.1
|
9
|
+
* Only testing Ruby 2.7+ and Rails 5.2+
|
10
|
+
|
3
11
|
## 5.2.1
|
4
12
|
|
5
13
|
Released on November 30, 2020
|
File without changes
|
File without changes
|
File without changes
|
@@ -10,6 +10,13 @@ more pleasant to write HTML documents, by eliminating redundancy, reflecting the
|
|
10
10
|
underlying structure that the document represents, and providing an elegant syntax
|
11
11
|
that's both powerful and easy to understand.
|
12
12
|
|
13
|
+
### Supported Versions
|
14
|
+
|
15
|
+
* Ruby 2.6+
|
16
|
+
* Rails 5.1+
|
17
|
+
|
18
|
+
Other versions may likely work, but we don't test against them.
|
19
|
+
|
13
20
|
## Basic Usage
|
14
21
|
|
15
22
|
Haml can be used from the command line or as part of a Ruby web framework. The
|
@@ -162,35 +169,34 @@ on a specific area:
|
|
162
169
|
ruby -Itest test/helper_test.rb -n test_buffer_access
|
163
170
|
~~~
|
164
171
|
|
165
|
-
Haml currently supports Ruby 2.
|
172
|
+
Haml currently supports Ruby 2.7.0 and higher, so please make sure your changes run on 2.7+.
|
166
173
|
|
167
174
|
## Team
|
168
175
|
|
169
176
|
### Current Maintainers
|
170
177
|
|
171
|
-
* [
|
172
|
-
* [Matt Wildig](https://github.com/mattwildig)
|
173
|
-
* [Tee Parham](https://github.com/teeparham)
|
178
|
+
* [Hampton Catlin](https://github.com/hcatlin)
|
174
179
|
* [Takashi Kokubun](https://github.com/k0kubun)
|
180
|
+
* [Akira Matsuda](https://github.com/amatsuda)
|
175
181
|
|
176
182
|
### Alumni
|
177
183
|
|
178
184
|
Haml was created by [Hampton Catlin](http://hamptoncatlin.com), the author of
|
179
|
-
the original implementation.
|
180
|
-
but still consults on language issues.
|
185
|
+
the original implementation.
|
181
186
|
|
182
|
-
[Natalie Weizenbaum](
|
187
|
+
[Natalie Weizenbaum](https://github.com/nex3) was for many years the primary developer
|
183
188
|
and architect of the "modern" Ruby implementation of Haml.
|
184
189
|
|
185
|
-
|
186
|
-
|
187
|
-
## License
|
190
|
+
This project's been around for many years, and we have many amazing people who kept the project
|
191
|
+
alive! as former maintainers like:
|
188
192
|
|
189
|
-
|
193
|
+
[Norman Clarke](http://github.com/norman)
|
194
|
+
[Matt Wildig](https://github.com/mattwildig)
|
195
|
+
[Tee Parham](https://github.com/teeparham)
|
190
196
|
|
191
|
-
|
197
|
+
## License
|
192
198
|
|
193
|
-
Copyright (c) 2006-
|
199
|
+
Copyright (c) 2006-2021 Hampton Catlin, Natalie Weizenbaum and the Haml team
|
194
200
|
|
195
201
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
196
202
|
this software and associated documentation files (the "Software"), to deal in
|
@@ -107,13 +107,20 @@ output.
|
|
107
107
|
In Rails, options can be set by setting the {Haml::Template#options Haml::Template.options}
|
108
108
|
hash in an initializer:
|
109
109
|
|
110
|
-
|
111
|
-
|
110
|
+
```ruby
|
111
|
+
# config/initializers/haml.rb
|
112
|
+
Haml::Template.options[:format] = :html5
|
113
|
+
|
114
|
+
# Avoid escaping attributes which are already escaped
|
115
|
+
Haml::Template.options[:escape_attrs] = :once
|
116
|
+
```
|
112
117
|
|
113
118
|
Outside Rails, you can set them by configuring them globally in
|
114
119
|
Haml::Options.defaults:
|
115
120
|
|
116
|
-
|
121
|
+
```ruby
|
122
|
+
Haml::Options.defaults[:format] = :html5
|
123
|
+
```
|
117
124
|
|
118
125
|
In sinatra specifically, you can set them in global config with:
|
119
126
|
```ruby
|
File without changes
|
File without changes
|
@@ -6,6 +6,17 @@ module Haml
|
|
6
6
|
INVALID_ATTRIBUTE_NAME_REGEX = /[ \0"'>\/=]/
|
7
7
|
|
8
8
|
class << self
|
9
|
+
def build(class_id, obj_ref, is_html, attr_wrapper, escape_attrs, hyphenate_data_attrs, *attributes_hashes)
|
10
|
+
attributes = class_id
|
11
|
+
attributes_hashes.each do |old|
|
12
|
+
result = {}
|
13
|
+
old.each { |k, v| result[k.to_s] = v }
|
14
|
+
merge_attributes!(attributes, result)
|
15
|
+
end
|
16
|
+
merge_attributes!(attributes, parse_object_ref(obj_ref)) if obj_ref
|
17
|
+
build_attributes(is_html, attr_wrapper, escape_attrs, hyphenate_data_attrs, attributes)
|
18
|
+
end
|
19
|
+
|
9
20
|
def build_attributes(is_html, attr_wrapper, escape_attrs, hyphenate_data_attrs, attributes = {})
|
10
21
|
# @TODO this is an absolutely ridiculous amount of arguments. At least
|
11
22
|
# some of this needs to be moved into an instance method.
|
@@ -159,6 +170,50 @@ module Haml
|
|
159
170
|
hash.merge! flatten_data_attributes(v, joined, join_char, seen)
|
160
171
|
end
|
161
172
|
end
|
173
|
+
|
174
|
+
# Takes an array of objects and uses the class and id of the first
|
175
|
+
# one to create an attributes hash.
|
176
|
+
# The second object, if present, is used as a prefix,
|
177
|
+
# just like you can do with `dom_id()` and `dom_class()` in Rails
|
178
|
+
def parse_object_ref(ref)
|
179
|
+
prefix = ref[1]
|
180
|
+
ref = ref[0]
|
181
|
+
# Let's make sure the value isn't nil. If it is, return the default Hash.
|
182
|
+
return {} if ref.nil?
|
183
|
+
class_name =
|
184
|
+
if ref.respond_to?(:haml_object_ref)
|
185
|
+
ref.haml_object_ref
|
186
|
+
else
|
187
|
+
underscore(ref.class)
|
188
|
+
end
|
189
|
+
ref_id =
|
190
|
+
if ref.respond_to?(:to_key)
|
191
|
+
key = ref.to_key
|
192
|
+
key.join('_') unless key.nil?
|
193
|
+
else
|
194
|
+
ref.id
|
195
|
+
end
|
196
|
+
id = "#{class_name}_#{ref_id || 'new'}"
|
197
|
+
if prefix
|
198
|
+
class_name = "#{ prefix }_#{ class_name}"
|
199
|
+
id = "#{ prefix }_#{ id }"
|
200
|
+
end
|
201
|
+
|
202
|
+
{ 'id'.freeze => id, 'class'.freeze => class_name }
|
203
|
+
end
|
204
|
+
|
205
|
+
# Changes a word from camel case to underscores.
|
206
|
+
# Based on the method of the same name in Rails' Inflector,
|
207
|
+
# but copied here so it'll run properly without Rails.
|
208
|
+
def underscore(camel_cased_word)
|
209
|
+
word = camel_cased_word.to_s.dup
|
210
|
+
word.gsub!(/::/, '_')
|
211
|
+
word.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
212
|
+
word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
|
213
|
+
word.tr!('-', '_')
|
214
|
+
word.downcase!
|
215
|
+
word
|
216
|
+
end
|
162
217
|
end
|
163
218
|
end
|
164
219
|
end
|
@@ -51,7 +51,8 @@ module Haml
|
|
51
51
|
# @param dynamic_attributes [Haml::Parser::DynamicAttributes]
|
52
52
|
# @return [String] Attributes rendering code
|
53
53
|
def compile_runtime_build(attributes, object_ref, dynamic_attributes)
|
54
|
-
|
54
|
+
arguments = [@is_html, @attr_wrapper, @escape_attrs, @hyphenate_data_attrs].map(&method(:to_literal)).join(', ')
|
55
|
+
"::Haml::AttributeBuilder.build(#{to_literal(attributes)}, #{object_ref}, #{arguments}, #{dynamic_attributes.to_literal})"
|
55
56
|
end
|
56
57
|
|
57
58
|
# Build array of grouped values whose sort order may go back and forth, which is also sorted with key name.
|
@@ -106,7 +107,8 @@ module Haml
|
|
106
107
|
hash_content = values.group_by(&:key).map do |key, values_for_key|
|
107
108
|
"#{frozen_string(key)} => #{merged_value(key, values_for_key)}"
|
108
109
|
end.join(', ')
|
109
|
-
[
|
110
|
+
arguments = [@is_html, @attr_wrapper, @escape_attrs, @hyphenate_data_attrs].map(&method(:to_literal)).join(', ')
|
111
|
+
[:dynamic, "::Haml::AttributeBuilder.build({ #{hash_content} }, nil, #{arguments})"]
|
110
112
|
end
|
111
113
|
|
112
114
|
# Renders attribute values statically.
|
File without changes
|
@@ -130,18 +130,6 @@ module Haml
|
|
130
130
|
@real_tabs += tab_change
|
131
131
|
end
|
132
132
|
|
133
|
-
def attributes(class_id, obj_ref, *attributes_hashes)
|
134
|
-
attributes = class_id
|
135
|
-
attributes_hashes.each do |old|
|
136
|
-
result = {}
|
137
|
-
old.each { |k, v| result[k.to_s] = v }
|
138
|
-
AttributeBuilder.merge_attributes!(attributes, result)
|
139
|
-
end
|
140
|
-
AttributeBuilder.merge_attributes!(attributes, parse_object_ref(obj_ref)) if obj_ref
|
141
|
-
AttributeBuilder.build_attributes(
|
142
|
-
html?, @options[:attr_wrapper], @options[:escape_attrs], @options[:hyphenate_data_attrs], attributes)
|
143
|
-
end
|
144
|
-
|
145
133
|
# Remove the whitespace from the right side of the buffer string.
|
146
134
|
# Doesn't do anything if we're at the beginning of a capture_haml block.
|
147
135
|
def rstrip!
|
@@ -190,49 +178,5 @@ module Haml
|
|
190
178
|
tabs = [count + @tabulation, 0].max
|
191
179
|
@@tab_cache[tabs] ||= ' ' * tabs
|
192
180
|
end
|
193
|
-
|
194
|
-
# Takes an array of objects and uses the class and id of the first
|
195
|
-
# one to create an attributes hash.
|
196
|
-
# The second object, if present, is used as a prefix,
|
197
|
-
# just like you can do with `dom_id()` and `dom_class()` in Rails
|
198
|
-
def parse_object_ref(ref)
|
199
|
-
prefix = ref[1]
|
200
|
-
ref = ref[0]
|
201
|
-
# Let's make sure the value isn't nil. If it is, return the default Hash.
|
202
|
-
return {} if ref.nil?
|
203
|
-
class_name =
|
204
|
-
if ref.respond_to?(:haml_object_ref)
|
205
|
-
ref.haml_object_ref
|
206
|
-
else
|
207
|
-
underscore(ref.class)
|
208
|
-
end
|
209
|
-
ref_id =
|
210
|
-
if ref.respond_to?(:to_key)
|
211
|
-
key = ref.to_key
|
212
|
-
key.join('_') unless key.nil?
|
213
|
-
else
|
214
|
-
ref.id
|
215
|
-
end
|
216
|
-
id = "#{class_name}_#{ref_id || 'new'}"
|
217
|
-
if prefix
|
218
|
-
class_name = "#{ prefix }_#{ class_name}"
|
219
|
-
id = "#{ prefix }_#{ id }"
|
220
|
-
end
|
221
|
-
|
222
|
-
{ 'id'.freeze => id, 'class'.freeze => class_name }
|
223
|
-
end
|
224
|
-
|
225
|
-
# Changes a word from camel case to underscores.
|
226
|
-
# Based on the method of the same name in Rails' Inflector,
|
227
|
-
# but copied here so it'll run properly without Rails.
|
228
|
-
def underscore(camel_cased_word)
|
229
|
-
word = camel_cased_word.to_s.dup
|
230
|
-
word.gsub!(/::/, '_')
|
231
|
-
word.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
232
|
-
word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
|
233
|
-
word.tr!('-', '_')
|
234
|
-
word.downcase!
|
235
|
-
word
|
236
|
-
end
|
237
181
|
end
|
238
182
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/helpers/action_view_extensions.rb
RENAMED
File without changes
|
File without changes
|
data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/helpers/action_view_xss_mods.rb
RENAMED
File without changes
|
data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/helpers/safe_erubi_template.rb
RENAMED
File without changes
|
data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/lib/haml/helpers/safe_erubis_template.rb
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -4,6 +4,11 @@ module Haml
|
|
4
4
|
|
5
5
|
# This module makes Haml work with Rails using the template handler API.
|
6
6
|
class Plugin
|
7
|
+
class << self
|
8
|
+
attr_accessor :annotate_rendered_view_with_filenames
|
9
|
+
end
|
10
|
+
self.annotate_rendered_view_with_filenames = false
|
11
|
+
|
7
12
|
def handles_encoding?; true; end
|
8
13
|
|
9
14
|
def compile(template, source)
|
@@ -14,9 +19,21 @@ module Haml
|
|
14
19
|
options[:mime_type] = template.mime_type
|
15
20
|
end
|
16
21
|
options[:filename] = template.identifier
|
22
|
+
|
23
|
+
preamble = '@output_buffer = output_buffer ||= ActionView::OutputBuffer.new if defined?(ActionView::OutputBuffer);'
|
24
|
+
postamble = ''
|
25
|
+
|
26
|
+
if self.class.annotate_rendered_view_with_filenames
|
27
|
+
# short_identifier is only available in Rails 6+. On older versions, 'inspect' gives similar results.
|
28
|
+
ident = template.respond_to?(:short_identifier) ? template.short_identifier : template.inspect
|
29
|
+
preamble += "haml_concat '<!-- BEGIN #{ident} -->'.html_safe;"
|
30
|
+
postamble += "haml_concat '<!-- END #{ident} -->'.html_safe;"
|
31
|
+
end
|
32
|
+
|
17
33
|
Haml::Engine.new(source, options).compiler.precompiled_with_ambles(
|
18
34
|
[],
|
19
|
-
after_preamble:
|
35
|
+
after_preamble: preamble,
|
36
|
+
before_postamble: postamble
|
20
37
|
)
|
21
38
|
end
|
22
39
|
|
@@ -42,6 +42,11 @@ module Haml
|
|
42
42
|
Haml::Filters::RailsErb.template_class = Haml::SafeErubisTemplate
|
43
43
|
end
|
44
44
|
Haml::Template.options[:filters] = { 'erb' => Haml::Filters::RailsErb }
|
45
|
+
|
46
|
+
if app.config.respond_to?(:action_view) &&
|
47
|
+
app.config.action_view.annotate_rendered_view_with_filenames
|
48
|
+
Haml::Plugin.annotate_rendered_view_with_filenames = true
|
49
|
+
end
|
45
50
|
end
|
46
51
|
end
|
47
52
|
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -65,7 +65,7 @@ module Haml
|
|
65
65
|
# (see {file:REFERENCE.md#encodings the `:encoding` option}).
|
66
66
|
#
|
67
67
|
# @return [String]
|
68
|
-
def precompiled_with_ambles(local_names, after_preamble: '')
|
68
|
+
def precompiled_with_ambles(local_names, after_preamble: '', before_postamble: '')
|
69
69
|
preamble = <<END.tr("\n", ';')
|
70
70
|
begin
|
71
71
|
extend Haml::Helpers
|
@@ -74,6 +74,7 @@ _erbout = _hamlout.buffer
|
|
74
74
|
#{after_preamble}
|
75
75
|
END
|
76
76
|
postamble = <<END.tr("\n", ';')
|
77
|
+
#{before_postamble}
|
77
78
|
#{precompiled_method_return_value}
|
78
79
|
ensure
|
79
80
|
@haml_buffer = @haml_buffer.upper if @haml_buffer
|
File without changes
|
File without changes
|
File without changes
|
data/bundle/ruby/2.7.0/gems/{haml-5.2.1 → haml-5.2.2}/yard/default/fulldoc/html/css/common.sass
RENAMED
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'etc'
|
3
|
+
|
4
|
+
module Parallel
|
5
|
+
# TODO: inline this method into parallel.rb and kill physical_processor_count in next major release
|
6
|
+
module ProcessorCount
|
7
|
+
# Number of processors seen by the OS, used for process scheduling
|
8
|
+
def processor_count
|
9
|
+
@processor_count ||= Integer(ENV['PARALLEL_PROCESSOR_COUNT'] || Etc.nprocessors)
|
10
|
+
end
|
11
|
+
|
12
|
+
# Number of physical processor cores on the current system.
|
13
|
+
def physical_processor_count
|
14
|
+
@physical_processor_count ||= begin
|
15
|
+
ppc =
|
16
|
+
case RbConfig::CONFIG["target_os"]
|
17
|
+
when /darwin[12]/
|
18
|
+
IO.popen("/usr/sbin/sysctl -n hw.physicalcpu").read.to_i
|
19
|
+
when /linux/
|
20
|
+
cores = {} # unique physical ID / core ID combinations
|
21
|
+
phy = 0
|
22
|
+
IO.read("/proc/cpuinfo").scan(/^physical id.*|^core id.*/) do |ln|
|
23
|
+
if ln.start_with?("physical")
|
24
|
+
phy = ln[/\d+/]
|
25
|
+
elsif ln.start_with?("core")
|
26
|
+
cid = "#{phy}:#{ln[/\d+/]}"
|
27
|
+
cores[cid] = true unless cores[cid]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
cores.count
|
31
|
+
when /mswin|mingw/
|
32
|
+
require 'win32ole'
|
33
|
+
result_set = WIN32OLE.connect("winmgmts://").ExecQuery(
|
34
|
+
"select NumberOfCores from Win32_Processor"
|
35
|
+
)
|
36
|
+
result_set.to_enum.collect(&:NumberOfCores).reduce(:+)
|
37
|
+
else
|
38
|
+
processor_count
|
39
|
+
end
|
40
|
+
# fall back to logical count if physical info is invalid
|
41
|
+
ppc > 0 ? ppc : processor_count
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|