summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/drawing
AgeCommit message (Collapse)Author
2023-10-19Fix frozen string error for scatter series with non-default markerKoza
2023-10-19Merge pull request #273 from tagliala/chore/fix-unused-block-argumentZsolt Kozaroczy
Fix Lint/UnusedBlockArgument offenses
2023-09-08Use `class.name` instead of `class.to_s`Geremia Taglialatela
`class.name` is faster, uses less memory than `class.to_s`, and can be used in this context. This micro optimization does not have practical effect, it is just a reference for the future in case this approach will be needed in other parts of the library ``` Comparison (IPS): Object.name: 13528803.0 i/s Object.to_s: 8213612.0 i/s - 1.65x (± 0.00) slower Comparison (Memory): Object.name: 0 allocated Object.to_s: 40 allocated - Infx more ```
2023-06-15Fix redundant self offensesGeremia Taglialatela
No performance gain, this can be seen as a cosmetic change to have shorter lines
2023-06-15Fix Lint/UnusedBlockArgument offensesGeremia Taglialatela
Use `each_value` instead of `each` where possible. The performance gain is minimal (3%). ``` Comparison: each_value: 4105733.4 i/s each: 3998011.4 i/s - 1.03x (± 0.00) slower ```
2023-06-13Fix safe Style/Lambda offensesGeremia Taglialatela
- Use literal syntax on single line - Use lambda method on multiple lines Ref: https://rubystyle.guide/#lambda-multi-line
2023-06-10Fix safe Style/ColonMethodCall offensesGeremia Taglialatela
Caxlsx is using both `.` and `::`, 220 occurrences vs 280 to invoke methods on `Axlsx` module. This commit standardizes the approach towards `.`, which will also allow shorter lines. Performance is not affected ``` Comparison: Axlsx.validate: 8515252.3 i/s Axlsx::validate: 8512863.7 i/s - same-ish: difference falls within error ```
2023-06-09Refactor random char generationGeremia Taglialatela
Fix the following safe offenses: - Style/OperatorMethodCall - Style/RandomWithOffset And use Array.new to avoid an extra allocation: ``` Comparison (IPS): Array.new(8) { rand(65..89).chr }.join: 492433.7 i/s (0...8).map { 65.+(rand(25)).chr }.join: 432155.8 i/s - 1.14x (± 0.00) slower Comparison (Memory): Array.new(8) { rand(65..89).chr }.join: 440 allocated (0...8).map { 65.+(rand(25)).chr }.join: 560 allocated - 1.27x more ```
2023-06-05Prefer `Kernel#format` to `String#%`Geremia Taglialatela
This commit fixes cases that cannot be detected by RuboCop Ref: https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/FormatString
2023-06-05Fix Style/RedundantInterpolation offensesGeremia Taglialatela
`%` is an operation on `String` that will return a new `String`, so the interpolation is redundant Also adds a missing spec on PivotTable#rels_pn ``` IPS: uninterpolated: 4045715.7 i/s interpolated: 2359775.6 i/s - 1.71x (± 0.00) slower Memory: uninterpolated: 160 allocated interpolated: 232 allocated - 1.45x more ```
2023-06-05Fix Style/FormatString offensesGeremia Taglialatela
`Kernel#format` is faster and will avoid to allocate an array compared to `String#%`. ``` IPS: kernel_format: 3877614.2 i/s string_percent: 3531475.0 i/s - 1.10x (± 0.00) slower Memory: kernel_format: 160 allocated string_percent: 200 allocated - 1.25x more ```
2023-06-05Merge pull request #274 from tagliala/chore/fix-negated-if-offensesZsolt Kozaroczy
Fix negated if offenses
2023-06-02Fix negated if offensesGeremia Taglialatela
Should also provide a negligible performance improvement, about 3% on Ruby 3.2 and 6% on Ruby 2.6 (M1 Pro)
2023-05-31Remove redundant parenthesesGeremia Taglialatela
- Style/ParenthesesAroundCondition - Style/RedundantParentheses - Style/TernaryParentheses `Style/ParenthesesAroundCondition` may be questionable, but a majority of comparison where not using parentheses, so offenses have been fixed for uniformity across the codebase
2023-05-31Use Ruby 1.9 hash syntaxGeremia Taglialatela
2023-05-31Merge pull request #268 from tagliala/chore/fix-symbol-proc-offensesZsolt Kozaroczy
Fix Style/SymbolProc offenses
2023-05-31Merge pull request #267 from tagliala/chore/freeze-mutable-constantsZsolt Kozaroczy
Fix Style/MutableConstant offenses
2023-05-31Fix Style/SymbolProc offensesGeremia Taglialatela
This also provides a performance improvement ``` Comparison (array of 4 elements): map(&): 3643131.4 i/s map {}: 3488052.5 i/s - 1.04x (± 0.00) slower Comparison (array of 20 elements): map(&): 466013.9 i/s map {}: 408447.2 i/s - 1.14x (± 0.00) slower ```
2023-05-31Fix Style/MutableConstant offensesGeremia Taglialatela
2023-05-31Fix Style/ConditionalAssignment offensesGeremia Taglialatela
2023-05-31Fix string concatenation offenses in production codeGeremia Taglialatela
2023-05-24Fix Style/RedundantFileExtensionInRequire offensesGeremia Taglialatela
2023-05-24Merge pull request #250 from tagliala/chore/fix-style-non-nil-check-offensesZsolt Kozaroczy
Fix Style/NonNilCheck offenses
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 #242 from tagliala/chore/fix-minor-safe-offensesZsolt Kozaroczy
Remove minor safe offenses
2023-05-22Merge pull request #240 from tagliala/chore/fix-void-contextsZsolt Kozaroczy
Fix Lint/Void offenses
2023-05-21Improve commentsGeremia Taglialatela
- Use https where possible - Capitalize Excel
2023-05-20Remove minor safe offensesGeremia Taglialatela
- Style/RaiseArgs - Style/RedundantCondition - Style/RedundantReturn - Style/SelfAssignment - Style/SoleNestedConditional
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-15Fix Performance/StringIdentifierArgument offenseGeremia Taglialatela
2023-05-10Fix Inefficient Hash Search offensesGeremia Taglialatela
Use `key?` instead of `keys.include?` to improve performance
2023-05-05Pipe output directly to str and avoid additional memory allocationsPaul Kmiec
Currently, there are lots of examples of code like this, ``` str << ('<tag ' << foo << ' ' << bar << '/>') ``` which create the string for the tag in memory before piping to str. We can avoid creating all of these intermediate strings by dropping the paranthesis and piping directly to str. This relies on the `str` passed around to handle lots of small appends. This is a problem when using RubyZip, but that is solved in the next commit.
2023-05-05Merge branch 'master' into frozenStringsZsolt Kozaroczy
2023-05-04Fix tests / code to work with frozen string literalsPaul Kmiec
2023-05-04Enable Style/FrozenStringLiteralComment and autocorrectPaul Kmiec
2023-05-04Fix Layout/HeredocIndentation offensesGeremia Taglialatela
Also use `XML` as delimiter to highlight syntax in supported editors
2023-05-03Fix safe, minor offenses to production codeGeremia Taglialatela
- Lint/RedundantStringCoercion - Style/CommentAnnotation offenses - Style/DefWithParentheses - Style/EvalWithLocation - Style/MethodCallWithoutArgsParentheses - Style/MethodDefParentheses - Style/NilComparison - Style/Semicolon
2023-04-12Rubocop fixesKoza
2023-04-12refactored code on Pic classSebastiano
2023-04-12clean codeSebastiano
2023-04-12improve validationSebastiano
add test cases
2023-04-12feat: add support for remote imagesSebastiano
2023-04-10Fix Layout/LeadingCommentSpace offensesGeremia Taglialatela
``` rubocop --only Layout/LeadingCommentSpace -a ```
2023-04-09Fix Layout/ExtraSpacing offensesGeremia Taglialatela
Configure with `AllowBeforeTrailingComments: true`
2023-04-09Fix offenses related to indentation consistencyGeremia Taglialatela
2023-04-09Fix Layout/ArgumentAlignment offensesGeremia Taglialatela
``` rubocop --only Layout/ArgumentAlignment -a ```
2023-04-08Fix Layout/EmptyLineAfterGuardClause offensesGeremia Taglialatela
``` rubocop --only Layout/EmptyLineAfterGuardClause -a ```
2023-04-08Fix space-related offensesGeremia Taglialatela
- Layout/SpaceAfterComma - Layout/SpaceAroundEqualsInParameterDefault - Layout/SpaceAroundOperators - Layout/SpaceBeforeBlockBraces - Layout/SpaceInsideBlockBraces - Layout/SpaceInsideHashLiteralBraces - Layout/SpaceInsideParens
2023-04-08Fix EmptyLines related offensesGeremia Taglialatela