Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove major code smells from the source code #8742

Merged
merged 20 commits into from
Sep 27, 2021
Merged

Conversation

budnix
Copy link
Member

@budnix budnix commented Sep 23, 2021

Context

The PR removes all major code smells from the source code detected by the SonarCloud tool. Additionally, the PR fixes regular expression (marked as "risk") responsible for detecting numeric values. The expression causes performance degradation when an empty string is passed.

Test code snippet:
Handsontable.helper.isNumeric(' '.repeat(100000));

Results:

PR 9.0.2
isNumeric helper ~0.37ms ~7500ms

Working demo

PR 9.0.2
https://jsfiddle.net/budnix/mthor6w1/1/ https://jsfiddle.net/budnix/uo9stj45/1/

I analyzed this branch after my changes and the results can be found here https://sonarcloud.io/summary/new_code?id=handsontable_handsontable&pullRequest=8742.

How has this been tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature or improvement (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Additional language file or change to the existing one (translations)

Related issue(s):

  1. fixes Fix RegExp vulnerability and clean up major code smells #8752

Affected project(s):

  • handsontable
  • @handsontable/angular
  • @handsontable/react
  • @handsontable/vue

Checklist:

@budnix budnix self-assigned this Sep 23, 2021
@codesandbox-ci
Copy link

codesandbox-ci bot commented Sep 23, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 378ecb7:

Sandbox Source
vanilla-handsontable-pr Configuration

@budnix budnix changed the title Fix all bugs found by SonarCloud Remove major code smells from the source code Sep 23, 2021
@budnix budnix marked this pull request as ready for review September 27, 2021 08:51
@budnix budnix linked an issue Sep 27, 2021 that may be closed by this pull request
@budnix budnix self-assigned this Sep 27, 2021
@budnix budnix merged commit 7323f3d into develop Sep 27, 2021
@budnix budnix deleted the feature/sonarcloud-fixes branch September 27, 2021 11:17
budnix added a commit that referenced this pull request Sep 28, 2021
The commit removes all major code smells from the source code detected by the
SonarCloud tool. Additionally, the commit fixes regular expression (marked as
"risk") responsible for detecting numeric values. The expression causes
performance degradation when an empty string is passed.

Issue: #8752
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix RegExp vulnerability and clean up major code smells
2 participants