| Age | Commit message (Collapse) | Author |
|
No performance gain, this can be seen as a cosmetic change to have
shorter lines
|
|
- Use literal syntax on single line
- Use lambda method on multiple lines
Ref: https://rubystyle.guide/#lambda-multi-line
|
|
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
```
|
|
This commit fixes cases that cannot be detected by RuboCop
Ref: https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/FormatString
|
|
Fix negated if offenses
|
|
Should also provide a negligible performance improvement, about 3%
on Ruby 3.2 and 6% on Ruby 2.6 (M1 Pro)
|
|
- 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
|
|
|
|
Fix Style/SymbolProc offenses
|
|
Fix Style/MutableConstant offenses
|
|
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
```
|
|
|
|
|
|
|
|
Fix Style/IfInsideElse offense
|
|
|
|
|
|
Remove minor safe offenses
|
|
- Use https where possible
- Capitalize Excel
|
|
- Style/RaiseArgs
- Style/RedundantCondition
- Style/RedundantReturn
- Style/SelfAssignment
- Style/SoleNestedConditional
|
|
- Fix Performance/RedundantMatch and Performance/RegexpMatch
- Fix Performance/RedundantSplitRegexpArgument
|
|
The attributes in rows, cells, styles, etc are pre-defined for each
type and almost never change. The current code, however, does not
take that into account by reading all instance variables (via
declared_attributes), filtering out the blank one and ones that are
not xml attributes, and by camelizing each one.
We can avoid all this extra work by computing the camels and ivars for
xml attributes once and directly read the instance variables we care
about.
|
|
Use `key?` instead of `keys.include?` to improve performance
|
|
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.
|
|
|
|
|
|
- Lint/RedundantStringCoercion
- Style/CommentAnnotation offenses
- Style/DefWithParentheses
- Style/EvalWithLocation
- Style/MethodCallWithoutArgsParentheses
- Style/MethodDefParentheses
- Style/NilComparison
- Style/Semicolon
|
|
```
rubocop --only Layout/LeadingCommentSpace -a
```
|
|
Configure with `AllowBeforeTrailingComments: true`
|
|
|
|
```
rubocop --only Layout/EmptyLineAfterGuardClause -a
```
|
|
- Layout/SpaceAfterComma
- Layout/SpaceAroundEqualsInParameterDefault
- Layout/SpaceAroundOperators
- Layout/SpaceBeforeBlockBraces
- Layout/SpaceInsideBlockBraces
- Layout/SpaceInsideHashLiteralBraces
- Layout/SpaceInsideParens
|
|
|
|
```
rubocop --only Layout/SpaceBeforeFirstArg -a
```
|
|
Also regenerate config
|
|
```
rubocop --only Layout/EmptyLinesAroundAccessModifier,Layout/AccessModifierIndentation -a
```
|
|
```
rubocop --only Layout/CommentIndentation -a
```
|
|
```
rubocop --only Layout/EmptyLineBetweenDefs -a
```
|
|
```
rubocop --only Layout/EmptyLines -a
```
|
|
```
rubocop --only Style/Encoding -a
```
|
|
```
rubocop --only Layout/TrailingWhitespace -a
```
|
|
|
|
|
|
|
|
|
|
Not using binary mode can cause encoding issues, see #138.
|
|
|
|
|
|
Co-authored-by: Noel Peden <[email protected]>
|
|
|