diff options
| author | Zsolt Kozaroczy <[email protected]> | 2023-05-17 17:12:05 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-05-17 17:12:05 +0200 |
| commit | 6a4b82def2e94b4811c38c37e606d426710d1e6c (patch) | |
| tree | 039f6f5a3c4bdac5c048710b2362aa6bac22b231 | |
| parent | 7051298d8cb76b9fe7b35d614332f50bc38f8ef2 (diff) | |
| parent | a8d93e0f5163fba23e6f7b5213b8d67d2dd30e6d (diff) | |
| download | caxlsx-6a4b82def2e94b4811c38c37e606d426710d1e6c.tar.gz caxlsx-6a4b82def2e94b4811c38c37e606d426710d1e6c.zip | |
Merge pull request #233 from tagliala/chore/fix-safe-performance-offenses
Fix safe performance RuboCop offenses
| -rw-r--r-- | .rubocop_todo.yml | 15 | ||||
| -rw-r--r-- | lib/axlsx/stylesheet/color.rb | 2 | ||||
| -rw-r--r-- | lib/axlsx/workbook/worksheet/sheet_protection.rb | 2 |
3 files changed, 2 insertions, 17 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index a80ac256..19c4b3f5 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -102,21 +102,6 @@ Performance/RedundantBlockCall: - 'lib/axlsx/util/zip_command.rb' # This cop supports safe autocorrection (--autocorrect). -Performance/RedundantMatch: - Exclude: - - 'lib/axlsx/stylesheet/color.rb' - -# This cop supports safe autocorrection (--autocorrect). -Performance/RedundantSplitRegexpArgument: - Exclude: - - 'lib/axlsx/workbook/worksheet/sheet_protection.rb' - -# This cop supports safe autocorrection (--autocorrect). -Performance/RegexpMatch: - Exclude: - - 'lib/axlsx/stylesheet/color.rb' - -# This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. # SupportedStyles: separated, grouped Style/AccessorGrouping: diff --git a/lib/axlsx/stylesheet/color.rb b/lib/axlsx/stylesheet/color.rb index 47617da5..87308bb1 100644 --- a/lib/axlsx/stylesheet/color.rb +++ b/lib/axlsx/stylesheet/color.rb @@ -55,7 +55,7 @@ module Axlsx v = v.upcase v = v * 3 if v.size == 2 v = v.rjust(8, 'FF') - raise ArgumentError, "Invalid color rgb value: #{v}." unless v.match(/[0-9A-F]{8}/) + raise ArgumentError, "Invalid color rgb value: #{v}." unless /[0-9A-F]{8}/.match?(v) @rgb = v end diff --git a/lib/axlsx/workbook/worksheet/sheet_protection.rb b/lib/axlsx/workbook/worksheet/sheet_protection.rb index faf34f97..e506f8d9 100644 --- a/lib/axlsx/workbook/worksheet/sheet_protection.rb +++ b/lib/axlsx/workbook/worksheet/sheet_protection.rb @@ -98,7 +98,7 @@ module Axlsx # @return [String] def encode_password(password) i = 0 - chars = password.split(//) + chars = password.split("") count = chars.size chars.collect! do |char| |
