Skip to content

Fix named expression names that start with a valid cell reference - #1130

Merged
sequba merged 26 commits into
developfrom
feature/issue-1058
Feb 3, 2023
Merged

sequba merged 26 commits into
developfrom
feature/issue-1058

Conversation

@sequba

@sequba sequba commented Dec 29, 2022 •

Copy link
Copy Markdown
Contributor

Context

Summary of the rules for the names of the named expressions:

Name ODFF Excel Google Sheets HyperFormula BEFORE HyperFormula AFTER
letters, digits, _ character allowed allowed allowed allowed allowed
. character not allowed allowed allowed, but not mentioned in the docs allowed, but not mentioned in the docs allowed
_ as the first character not allowed allowed allowed allowed allowed
A valid valid valid docs says invalid, but works valid
A1 invalid invalid invalid invalid invalid
AAAA1 invalid valid* valid* invalid invalid
A1BC valid valid valid causes error** valid
R1C1 valid invalid invalid invalid invalid
RC*** valid invalid invalid for consistency it should be invalid, but works invalid
TRUE invalid invalid invalid valid valid****
min length not specified 1 1 docs says, it can be configured, but it's 1 regardless of the configuration 1
max length not specified not specified 250 docs says 255, but longer names work not limited
* Excel and Sheets allow names equivalent to cell references when the column address is at least 4-letter long. I described it in the runtime-differences guide.
** I fixed it.
*** `RC` is a special case of an R1C1-style reference. In my opinion, it was also a bug, but it might be considered a breaking change, because if a client uses the named expression `RC` it will stop working after updating.
**** It's intended. In HF we don't have keywords `TRUE` and `FALSE`. Users can define them as named expressions to improve Excel compatibility: https://hyperformula.handsontable.com/guide/compatibility-with-microsoft-excel.html#true-and-false-constants.

How did you test your changes?

  • unit tests pass
  • new unit tests for the changed behavior
  • local docs build
  • tested examples from the docs

Types of changes

  • Breaking change (a fix or a feature because of which an existing functionality doesn't work as expected anymore)
  • New feature or improvement (a non-breaking change that adds functionality)
  • Bug fix (a non-breaking change that fixes an issue)
  • Additional language file, or a change to an existing language file (translations)
  • Change to the documentation

Related issues:

Fixes #1058
Fixes #880

Checklist:

  • My change is compliant with the OpenDocument standard.
  • My change is compatible with Microsoft Excel.
  • My change is compatible with Google Sheets.
  • My code follows the code style of this project.
  • I described my changes in the CHANGELOG.md file.
  • My changes require a documentation update.
  • My changes require a migration guide.

@sequba sequba self-assigned this Dec 29, 2022
@github-actions

github-actions Bot commented Dec 29, 2022 •

Copy link
Copy Markdown

Performance comparison of head (0edd6cc) vs base (5d56080)

                                     testName |  base |  head |  change
-----------------------------------------------------------------------
                                      Sheet A | 631.6 | 656.5 |  +3.94%
                                      Sheet B | 290.4 | 286.3 |  -1.41%
                                      Sheet T | 335.4 | 359.4 |  +7.16%
                                Column ranges | 801.5 | 815.4 |  +1.73%
Sheet A:  change value, add/remove row/column |    43 |    48 | +11.63%
 Sheet B: change value, add/remove row/column |   359 |   387 |  +7.80%
                   Column ranges - add column |   329 |   294 | -10.64%
                Column ranges - without batch |   853 |   977 | +14.54%
                        Column ranges - batch |   196 |   204 |  +4.08%

Comment thread test/named-expressions.spec.ts Fixed
Comment thread test/engine.spec.ts Resolved
@sequba sequba linked an issue Jan 3, 2023 that may be closed by this pull request
Comment thread docs/guide/named-expressions.md Resolved
@sequba
sequba marked this pull request as ready for review January 3, 2023 17:01
Comment thread src/parser/LexerConfig.ts Fixed
Comment thread src/parser/LexerConfig.ts Fixed
Comment thread src/parser/parser-consts.ts Fixed
Comment thread src/parser/LexerConfig.ts Fixed
Comment thread test/named-expressions.spec.ts Resolved
@sequba
sequba removed the request for review from adamu-handsontable January 4, 2023 10:11
Comment thread docs/guide/list-of-differences.md Resolved
Comment thread docs/guide/basic-operations.md Resolved
Comment thread docs/guide/list-of-differences.md Resolved
Comment thread docs/guide/named-expressions.md Resolved

@adamu-handsontable adamu-handsontable left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this PR. I've added my proposed changes in this review and comments which I've added before I started the review.

Comment thread test/named-expressions.spec.ts Resolved
Comment thread src/parser/LexerConfig.ts Resolved
Comment thread src/parser/CellReferenceMatcher.ts Resolved

@adamu-handsontable adamu-handsontable left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good, thank you

@codecov

codecov Bot commented Feb 3, 2023

Copy link
Copy Markdown

Codecov Report

Merging #1130 (0edd6cc) into develop (5d56080) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1130      +/-   ##
===========================================
+ Coverage    95.82%   95.84%   +0.01%     
===========================================
  Files          162      165       +3     
  Lines        14097    14144      +47     
  Branches      3004     3007       +3     
===========================================
+ Hits         13509    13556      +47     
  Misses         572      572              
  Partials        16       16              
Impacted Files Coverage Δ
src/Config.ts 98.00% <ø> (ø)
src/DependencyGraph/FormulaCellVertex.ts 84.00% <ø> (ø)
src/Operations.ts 98.87% <ø> (ø)
src/errors.ts 98.19% <ø> (ø)
src/interpreter/plugin/InformationPlugin.ts 93.33% <ø> (ø)
src/interpreter/plugin/NumericAggregationPlugin.ts 96.76% <ø> (ø)
src/parser/ParserWithCaching.ts 94.55% <ø> (ø)
src/NamedExpressions.ts 88.32% <100.00%> (+0.24%) ⬆️
src/parser/CellReferenceMatcher.ts 100.00% <100.00%> (ø)
src/parser/FormulaParser.ts 97.74% <100.00%> (ø)
... and 5 more

@sequba
sequba merged commit 5dc0e45 into develop Feb 3, 2023
@sequba
sequba deleted the feature/issue-1058 branch February 3, 2023 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants