summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/workbook
AgeCommit message (Collapse)Author
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-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 chore/use-delete-prefix-suffixZsolt Kozaroczy
2023-05-17Merge branch 'master' into chore/use-detect-and-includeZsolt Kozaroczy
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 ```
2023-05-15Remove ability to set `u=` to true in favor of :singlePaul Kmiec
The `u=` would convert `true` to `:single` for backwards compatibility. However, it is more explicit to set it to `:single` or one of the other underline options instead of relying on the conversion.
2023-05-15Only define @escape_formulas in cell if it is different from worksheetPaul Kmiec
The benchmarks showed that validate_boolean is called 200_005 times and almost all of those are to validate escape_formulas passed into cell. In this commit the worksheet does not pass in its escape_formulas value, avoiding validate_boolean, and instead the cell asks the worksheet for value when needed. Now validate_boolean is called 5 times in benchmarks.
2023-05-15Improve boolean validation constants (i.e. Axlsx::VALID_BOOLEAN_VALUES)Paul Kmiec
Added VALID_BOOLEAN_TRUE_VALUES and VALID_BOOLEAN_FALSE_VALUES so that those can be re-used in other placed and have the same notion of what a valid boolean value is. For example, we can use the true values in `Cell#u=`. Additionally, since validate_boolean / BOOLEAN_VALIDATOR are invoked so frequently, putting the likely values at the front can actually make a non-trivial difference. Since VALID_BOOLEAN_VALUES is derived from VALID_BOOLEAN_TRUE_VALUES and VALID_BOOLEAN_FALSE_VALUES, we use `Array#zip` to still end up with good order.
2023-05-15Using `between?` is more efficient than `cover?`Paul Kmiec
Co-authored-by: Geremia Taglialatela <[email protected]>
2023-05-15Fix safe rubocop offenses in Axslx::CellPaul Kmiec
There are 2 offenses left but they would be breaking backwards compatibility.
2023-05-15Treat escape_formulas similar to type, style, formula_valuePaul Kmiec
This avoid parse_options doing anything which can be expensive if it happens for each cell.
2023-05-15Also cache row_refPaul Kmiec
The `row_ref` method is called once for each column in a row and once at the row level.
2023-05-15Cache col_ref to avoid allocationsPaul Kmiec
In cases with lots of rows, each column will ask for its col_ref which will always be the same for the same column_index. We can cache this to avoid lots of small string allocations. Modified `CellSerializer` to use `#col_ref` and `#row_ref` avoiding the string allocation caused by `#col_r`
2023-05-15Use `include?` and `find` for performanceGeremia Taglialatela
Fix a couple of performance RuboCop offenses in workbook
2023-05-10Fix Inefficient Hash Search offensesGeremia Taglialatela
Use `key?` instead of `keys.include?` to improve performance
2023-05-09Do not change the whitespace that is produced by to_xml_string'sPaul Kmiec
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-04Fix tests / code to work with frozen string literalsPaul Kmiec
2023-05-04Enable Style/FrozenStringLiteralComment and autocorrectPaul Kmiec
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-23Revert formula characters other than =johnnyshields
2023-04-12Fix warnings with Ruby 2.xKoza
2023-04-13Update row.rbJohnny Shields
2023-04-13Merge branch 'master' into escape-formulas-improvementJohnny Shields
2023-04-12Small fixes: whitespace, typos, ordering, etc. (#188)Johnny Shields
2023-04-12Merge pull request #191 from tagliala/chore/add-rubocopZsolt Kozaroczy
Add RuboCop (and fix simple whitespace, magic comment, trailing comma offenses)
2023-04-10Fix tab color assignmentGeremia Taglialatela
Fix #195
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 offenses related to trailing commasGeremia Taglialatela