| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since Rails 6.0 will support Ruby 2.4.1 or higher
`# frozen_string_literal: true` magic comment is enough to make string object frozen.
This magic comment is enabled by `Style/FrozenStringLiteralComment` cop.
* Exclude these files not to auto correct false positive `Regexp#freeze`
- 'actionpack/lib/action_dispatch/journey/router/utils.rb'
- 'activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb'
It has been fixed by https://github.com/rubocop-hq/rubocop/pull/6333
Once the newer version of RuboCop released and available at Code Climate these exclude entries should be removed.
* Replace `String#freeze` with `String#-@` manually if explicit frozen string objects are required
- 'actionpack/test/controller/test_case_test.rb'
- 'activemodel/test/cases/type/string_test.rb'
- 'activesupport/lib/active_support/core_ext/string/strip.rb'
- 'activesupport/test/core_ext/string_ext_test.rb'
- 'railties/test/generators/actions_test.rb'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In Ruby 2.3 or later, `String#+@` is available and `+@` is faster than `dup`.
```ruby
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
gem "benchmark-ips"
end
Benchmark.ips do |x|
x.report('+@') { +"" }
x.report('dup') { "".dup }
x.compare!
end
```
```
$ ruby -v benchmark.rb
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
Warming up --------------------------------------
+@ 282.289k i/100ms
dup 187.638k i/100ms
Calculating -------------------------------------
+@ 6.775M (± 3.6%) i/s - 33.875M in 5.006253s
dup 3.320M (± 2.2%) i/s - 16.700M in 5.032125s
Comparison:
+@: 6775299.3 i/s
dup: 3320400.7 i/s - 2.04x slower
```
|
|
|
|
| |
This basically reverts 8da30ad6be34339124ba4cb4e36aea260dda12bc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Without this, `XmlMini_JDOM` raises an error as follwing:
```
RuntimeError: can't modify frozen String
org/jruby/RubyString.java:2264:in `concat'
activesupport/lib/active_support/xml_mini/jdom.rb:177:in `block in empty_content?'
org/jruby/RubyRange.java:485:in `each'
activesupport/lib/active_support/xml_mini/jdom.rb:174:in `empty_content?'
activesupport/lib/active_support/xml_mini/jdom.rb:86:in `collapse'
activesupport/lib/active_support/xml_mini/jdom.rb:66:in `merge_element!'
activesupport/lib/active_support/xml_mini/jdom.rb:84:in `block in collapse'
org/jruby/RubyRange.java:485:in `each'
activesupport/lib/active_support/xml_mini/jdom.rb:82:in `collapse'
activesupport/lib/active_support/xml_mini/jdom.rb:66:in `merge_element!'
activesupport/lib/active_support/xml_mini/jdom.rb:51:in `parse'
activesupport/lib/active_support/xml_mini.rb:101:in `parse'
```
We already have tests about `XmlMini_JDOM`. But it is not running in CI.
https://github.com/rails/rails/blob/master/activesupport/test/xml_mini/jdom_engine_test.rb
|
| |
|
| |
|
| |
|
|\ |
|
| |
| |
| |
| |
| | |
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
|
| |\
| | |
| | |
| | | |
Enforce frozen string in Rubocop
|
| | | |
|
| |/
| |
| |
| |
| |
| |
| | |
The ActiveSupport test suite only passes currently if it uses the latest unreleased commits for dalli, and a patch for Builder:
https://github.com/tenderlove/builder/pull/6
Beyond that, all external dependencies (at least, to the extent they’re used by ActiveSupport) are happy, including Nokogiri as of 1.8.0.
|
|/ |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are a lot of monkey patches inside the code base but there's
no need to document external constants so let's remove them from
the documentation
Also, since there are monkey patches for some test cases classes,
there were sometimes both documented and sneaked under the wrong
section in the sidebar.
Finally, for future references, the `active_support/vendor`
folder has been originally ignored in https://git.io/vDqfA but
no longer exists.
[ci skip]
|
|
|
|
| |
Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
|
| |
|
|
|
|
|
|
| |
All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772.
But comments was still kept absolute position. This commit aligns
comments with method definitions for consistency.
|
|
|
|
|
|
|
|
| |
Style/SpaceBeforeBlockBraces
Style/SpaceInsideBlockBraces
Style/SpaceInsideHashLiteralBraces
Fix all violations in the repository.
|
| |
|
| |
|
|
|
|
|
| |
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
|
|
|
|
| |
Where appropriate prefer the more concise Regexp#match?, String#include?,
String#start_with?, and String#end_with?
|
|
|
|
|
|
|
|
|
| |
* Hash#from_xml works with frozen strings
Fixes #24647
* Fix rexml engine test
[Marek Kirejczyk + Rafael Mendonça França]
|
|
|
|
|
|
|
| |
XML documents that are too deep can cause an stack overflow, which in
turn will cause a potential DoS attack.
CVE-2015-3227
|
|
|
|
| |
ref: https://github.com/rails/rails/pull/18763#issuecomment-72349769
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Removed some useless docstrings and no-doc'ed some.
|
| |
|
|
|
|
|
|
|
|
|
| |
Reason: This is slower, and any? is not equivalent in the
general case.
See discussion in https://github.com/rails/rails/pull/3779
This reverts commit 20cbf8eddc3844126d20f1218f068889d17b0dcf.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
's/[ \t]*$//' -i {} \;)
|
|
|
|
| |
installed
|
|
|
|
| |
Signed-off-by: José Valim <jose.valim@gmail.com>
|
|
|
|
| |
not "ActiveRecord"
|
|
|
|
| |
state:resolved]
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
[#3636 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
|
|
|
|
| |
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
|