summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx
AgeCommit message (Collapse)Author
2023-05-31Merge pull request #260 from ↵Zsolt Kozaroczy
tagliala/chore/fix-redundant-file-extension-in-require-offenses Fix Style/RedundantFileExtensionInRequire offenses
2023-05-31Merge pull request #259 from tagliala/chore/enable-naming-copsZsolt Kozaroczy
Enable Naming cops
2023-05-31Merge pull request #255 from pkmiec/fixSimpleTypeListRegressionZsolt Kozaroczy
Use #== and #eql? from BasicObject
2023-05-27Improve absolute cell reference methodGeremia Taglialatela
Also inverts `string.match(REGEX)` with `REGEX.match(string)` because of uniformity and because it has been tested 5% more performant on Ruby 3.2. Performance on older Rubies is the same ``` REGEX.match(string): 1234330.7 i/s string.match(REGEX): 1172670.1 i/s - 1.05x (± 0.00) slower ```
2023-05-26Fix Style/HashEachMethods offenseGeremia Taglialatela
Replace `keys.each` with hash iteration ```rb MY_HASH = { first: '1', second: '2', third: '3' } %i[ips memory].each do |benchmark| Benchmark.send(benchmark) do |x| x.report("each_key") { MY_HASH.each_key { |k| MY_HASH[k] } } x.report("keys.each") { MY_HASH.keys.each { |k| MY_HASH[k] } } x.report("each") { MY_HASH.each { |k, v| v } } x.compare! end end ``` ``` IPS Comparison: each: 4283031.6 i/s each_key: 3683407.4 i/s - 1.16x (± 0.00) slower keys.each: 3387425.1 i/s - 1.26x (± 0.00) slower Memory Comparison: each_key: 0 allocated each: 0 allocated - same keys.each: 40 allocated - Infx more ```
2023-05-25Enable Naming copsGeremia Taglialatela
Also fix safe minor offenses - Naming/BinaryOperatorParameterName - Naming/HeredocDelimiterCase
2023-05-25Remove duplicate checkGeremia Taglialatela
Axlsx::Row is now an Array, so it is possible to remove the extra duplicate branch
2023-05-24Fix Style/IfInsideElse offenseGeremia Taglialatela
2023-05-24Fix Style/RedundantFileExtensionInRequire offensesGeremia Taglialatela
2023-05-24Do not use collection literal in loopsGeremia Taglialatela
Also refactors Page margins to avoid code duplication
2023-05-24Merge pull request #257 from tagliala/chore/improve-cell-type-from-valueZsolt Kozaroczy
Improve cell type from value implementation
2023-05-24Merge pull request #254 from tagliala/chore/performance-redundant-block-callZsolt Kozaroczy
Fix Performance/RedundantBlockCall offense
2023-05-24Merge pull request #253 from tagliala/chore/fix-line-end-concatenation-offensesZsolt Kozaroczy
Fix Style/LineEndConcatenation offenses
2023-05-24Merge pull request #252 from tagliala/security/enable-security-copsZsolt Kozaroczy
Enable Security cops
2023-05-24Merge pull request #250 from tagliala/chore/fix-style-non-nil-check-offensesZsolt Kozaroczy
Fix Style/NonNilCheck offenses
2023-05-23Improve Regexp validatorGeremia Taglialatela
Replace `.match` with `.match?`
2023-05-23Improve cell type from value implementationGeremia Taglialatela
- Use `Regexp.match?` instead of `=~` when match is not needed - Use `Regexp.match` instead of `string.match` for uniformity ``` match?: 7335121.2 i/s =~: 2329358.3 i/s - 3.15x (± 0.00) slower ```
2023-05-22Use #== and #eql? from BasicObjectPaul Kmiec
Prior to https://github.com/caxlsx/caxlsx/pull/223, SimpleTypeList was just an object and inheritied #== / #eql? from BasicObject. These versions are fast as they just compare whether two objects sit in the same memory location. After https://github.com/caxlsx/caxlsx/pull/223, we started to inherit #== / #eql? from Array. These are slow as they crawl all the elements in the Array. This commit restores the original version of #== / #eql?.
2023-05-23Fix Performance/RedundantBlockCall offenseGeremia Taglialatela
Ref: https://github.com/fastruby/fast-ruby#proccall-and-block-arguments-vs-yieldcode
2023-05-23Fix Style/LineEndConcatenation offensesGeremia Taglialatela
2023-05-23Enable Security copsGeremia Taglialatela
Also fixes a Security/Open offense that couldn't be exploited, because the only invocation of `get_mime_type_from_uri` was validating the input with a `URI::DEFAULT_PARSER` regexp
2023-05-22Fix Style/NonNilCheck offensesGeremia Taglialatela
There were 8 occurrences of `!nil?` and 4 of `!= nil`. This change will standardize the usage of non-nil checks
2023-05-22Fix safe class comparison offensesGeremia Taglialatela
Fixes: - Style/ClassCheck - Style/ClassEqualityComparison While `is_a?` and `kind_of?` are equivalent, there is a 5% gain when switching from class comparison to `intance_of?` ``` Comparison: instance_of: 16902635.9 i/s class comparison: 16061288.3 i/s - 1.05x (± 0.00) slower ```
2023-05-22Merge pull request #236 from pkmiec/smallPerfTweaksZsolt Kozaroczy
Add `Cell#style_str` so that we can directly return '0'
2023-05-22Merge pull request #246 from tagliala/chore/fix-useless-assignment-offensesZsolt Kozaroczy
Fix Lint/UselessAssignment offenses
2023-05-22Merge pull request #244 from tagliala/chore/remove-ruby-pre-25-codeZsolt Kozaroczy
Remove check needed for Ruby < 2.5
2023-05-22Merge pull request #243 from tagliala/chore/fix-zero-length-predicate-offensesZsolt Kozaroczy
Fix Style/ZeroLengthPredicate unsafe offenses
2023-05-22Merge pull request #242 from tagliala/chore/fix-minor-safe-offensesZsolt Kozaroczy
Remove minor safe offenses
2023-05-22Merge pull request #241 from tagliala/chore/fix-style-and-or-offenseZsolt Kozaroczy
Fix Style/AndOr offenses
2023-05-22Merge pull request #240 from tagliala/chore/fix-void-contextsZsolt Kozaroczy
Fix Lint/Void offenses
2023-05-22Merge pull request #237 from tagliala/chore/fix-hash-transform-keysZsolt Kozaroczy
Fix hash transformation related offenses
2023-05-22Merge pull request #235 from tagliala/chore/fix-yard-warningsZsolt Kozaroczy
Fix YARD warnings
2023-05-21Improve commentsGeremia Taglialatela
- Use https where possible - Capitalize Excel
2023-05-21Fix Lint/UselessAssignment offensesGeremia Taglialatela
2023-05-20Remove check needed for Ruby < 2.5Geremia Taglialatela
Ref: #202
2023-05-20Fix Style/ZeroLengthPredicate unsafe offensesGeremia Taglialatela
2023-05-20Remove minor safe offensesGeremia Taglialatela
- Style/RaiseArgs - Style/RedundantCondition - Style/RedundantReturn - Style/SelfAssignment - Style/SoleNestedConditional
2023-05-20Fix Style/AndOr offensesGeremia Taglialatela
From Ruby Style Guide: > Do not use `and` and `or` in boolean context - and and or are control flow operators and should be used as such. They have very low precedence, and can be used as a short form of specifying flow sequences like "evaluate expression 1, and only if it is not successful (returned `nil`), evaluate expression 2". This is especially useful for raising errors or early return without breaking the reading flow. Also: - Remove redundant use of self - Use attribute reader instead of accessing instance variable
2023-05-20Fix Lint/Void offensesGeremia Taglialatela
Setter methods return the assigned value. Given: ```rb class MyClass def foo=(v) v = 10 42 end end ``` `my_object.foo = 5` will always return `5` This methods removes code that does not have effect
2023-05-20Fix sheet_by_name for sheets with escaped charactersAdam Kiczula
2023-05-19Fix hash transformation related offensesGeremia Taglialatela
- Style/HashConversion - Style/HashTransformKeys ``` Comparison (IPS): transform_keys: 2890030.0 i/s Hash[map]: 1777641.0 i/s - 1.63x (± 0.00) slower Comparison (Memory): transform_keys: 168 allocated Hash[map]: 248 allocated - 1.48x more ```
2023-05-18Fix YARD warningsGeremia Taglialatela
- `should_use_same_id_as?` has been replaced by `ids_cache_key` in 913003e Also fixes a typo [ci skip]
2023-05-17Add `Cell#style_str` so that we can directly return '0'Paul Kmiec
2023-05-17Fix safe performance RuboCop offenses Geremia Taglialatela
- Fix Performance/RedundantMatch and Performance/RegexpMatch - Fix Performance/RedundantSplitRegexpArgument
2023-05-17Merge branch 'master' into serializedAttributesZsolt Kozaroczy
2023-05-17Merge branch 'master' into chore/use-delete-prefix-suffixZsolt Kozaroczy
2023-05-17Merge branch 'master' into chore/use-detect-and-includeZsolt Kozaroczy
2023-05-17Merge pull request #228 from tagliala/chore/fix-string-identifier-argumentZsolt Kozaroczy
Fix Performance/StringIdentifierArgument offense
2023-05-17Merge branch 'master' into cacheColRefZsolt Kozaroczy
2023-05-16Replace `sub` with `delete_prefix`/`delete_suffix`Geremia Taglialatela
Ruby 2.5 introduced `delete_prefix` and `delete_suffix`. Those methods are helpful when serializing formula and array formula values, that are supposed to start and end with given prefixes Also moves formula prefix to constants so they can be used by both `Cell` and `CellSerializer` classes Formula: ``` Ruby version: 3.2.2 Comparison: delete_prefix: 8759353.5 i/s sub: 2607022.4 i/s - 3.36x (± 0.00) slower Comparison: delete_prefix: 40 allocated sub: 160 allocated - 4.00x more ``` Array Formula: ``` Ruby version: 3.2.2 Comparison: delete_prefixes: 4798837.8 i/s sub_sub: 937072.1 i/s - 5.12x (± 0.00) slower Comparison: delete_prefixes: 120 allocated sub_sub: 488 allocated - 4.07x more ```