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

maryia/fix: sonarcloud issues on TS migration branch for package 2 #19

Conversation

maryia-deriv
Copy link
Collaborator

Changes:

Please provide a summary of the change.

Screenshots:

Please provide some screenshots of the change.

@@ -612,7 +611,7 @@ export const ContractType = (() => {
const arr_cancellation_range: string[] =
getPropertyValue(available_contract_types, [contract_type, 'config', 'cancellation_range']) || [];

const regex = new RegExp('^([0-9]+)|([a-zA-Z]+)$', 'g');
const regex = /^\d{1,}|[a-zA-Z]{1,}$/g;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  1. used a regular expression literal instead of the 'RegExp' constructor.
  2. replaced + with {1,} equivalent in order to prevent the regex from being vulnerable to denial of service (DoS) attacks due to backtracking.
  3. used concise character class syntax '\d' instead of '[0-9]'.
  4. removed extra brackets around 2 OR operands in order to make the intended operator precedence explicit.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 5655609946

  • 0 of 12 (0.0%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.001%) to 8.883%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/trader/src/Stores/Modules/Trading/Helpers/contract-type.ts 0 4 0.0%
packages/trader/src/Stores/base-store.ts 0 8 0.0%
Files with Coverage Reduction New Missed Lines %
packages/trader/src/Stores/Modules/Trading/Helpers/contract-type.ts 1 0%
Totals Coverage Status
Change from base Build 5654446217: 0.001%
Covered Lines: 8625
Relevant Lines: 81662

💛 - Coveralls

@kate-deriv kate-deriv merged commit 7d655a3 into kate-deriv:kate/dtra-269/ts_migration_trader_package_2 Jul 25, 2023
1 check passed
kate-deriv added a commit that referenced this pull request Sep 27, 2023
…ckage (deriv-com#9284)

* fix: ts-migrate screen small

* fix: sass was unable to be found

* chore: add key files from prev branch

* chore: empty commit

* Maryia/dtra-279/TS migration [Trader]: TradeModals, MarketUnavailableModal & UnsupportedContractModal (#16)

* maryia/WEBREL-323/feat: ts migration of base-store (#18)

* chore: start ts migration of base-store

* chore: add more types to BaseStore

* chore: added more types to base-store

* chore: added more types to base-store

* chore: finalize base-store ts migration

* chore: reorder imports

* Maryia/webrel-483/TS migration of ContractType function (#17)

* chore: start ts migration

* chore: continue ts migration of contract-types

* chore: add more types to contract-types

* chore: add type for getContractValues return value

* chore: improve reduce types

* fix: sonarcloud issues (#19)

* chore: update reg exp

* chore: remove code smell

* chore: remove security hotspot

* chore: update reg exp

* chore: update reg exp to prev version

* fix: conflict

* fix: ts error

* refactor: apply suggestions

* fix: resolve more conflicts

* fix: conflicts in start date

* fix: type of onchangestartdate

* fix: type of contract cat list in usetraderstore

* fix: types in contract type and allow equals

* refactor: aplly part of suggestions

* refactor: remove unused type

* refactor: remove wrong types

* refactor: types of time

* refactor: revert changes

* chore: empty commit

* fix: more conflicts

---------

Co-authored-by: Henry Hein <henry@regentmarkets.com>
Co-authored-by: Akmal Djumakhodjaev <akmal@binary.com>
Co-authored-by: Maryia <103177211+maryia-deriv@users.noreply.github.com>
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.

3 participants