| Age | Commit message (Collapse) | Author |
|
Fix Style/ZeroLengthPredicate unsafe offenses
|
|
Remove minor safe offenses
|
|
Fix Style/AndOr offenses
|
|
Fix Lint/Void offenses
|
|
Fix hash transformation related offenses
|
|
Fix YARD warnings
|
|
- Use https where possible
- Capitalize Excel
|
|
|
|
|
|
- Style/RaiseArgs
- Style/RedundantCondition
- Style/RedundantReturn
- Style/SelfAssignment
- Style/SoleNestedConditional
|
|
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
|
|
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
|
|
|
|
- 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
```
|
|
- `should_use_same_id_as?` has been replaced by `ids_cache_key` in 913003e
Also fixes a typo
[ci skip]
|
|
|
|
- Fix Performance/RedundantMatch and Performance/RegexpMatch
- Fix Performance/RedundantSplitRegexpArgument
|
|
|
|
|
|
|
|
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
```
|
|
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.
|
|
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.
|
|
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.
|
|
Co-authored-by: Geremia Taglialatela <[email protected]>
|
|
There are 2 offenses left but they would be breaking backwards
compatibility.
|
|
This avoid parse_options doing anything which can be expensive if it
happens for each cell.
|
|
The `row_ref` method is called once for each column in a row and once at the
row level.
|
|
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`
|
|
Fix a couple of performance RuboCop offenses in workbook
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
Add RuboCop (and fix simple whitespace, magic comment, trailing comma offenses)
|
|
Fix #195
|
|
```
rubocop --only Layout/LeadingCommentSpace -a
```
|
|
Configure with `AllowBeforeTrailingComments: true`
|
|
|
|
```
rubocop --only Layout/ArgumentAlignment -a
```
|
|
```
rubocop --only Layout/EmptyLineAfterGuardClause -a
```
|
|
- Layout/SpaceAfterComma
- Layout/SpaceAroundEqualsInParameterDefault
- Layout/SpaceAroundOperators
- Layout/SpaceBeforeBlockBraces
- Layout/SpaceInsideBlockBraces
- Layout/SpaceInsideHashLiteralBraces
- Layout/SpaceInsideParens
|
|
|