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

Improve db util regular expression #2859

Closed
jsumners-nr opened this issue Jan 3, 2025 · 1 comment · Fixed by #2895
Closed

Improve db util regular expression #2859

jsumners-nr opened this issue Jan 3, 2025 · 1 comment · Fixed by #2895
Assignees
Labels
points: 3 A few days

Comments

@jsumners-nr
Copy link
Contributor

// Suppressing a warning on this regex because it is not obvious what this
// regex does, and we don't want to break anything.
// eslint-disable-next-line sonarjs/slow-regex, sonarjs/duplicates-in-character-class
const match = /^\s*use[^\w`]+([\w$_\u0080-\uFFFF]+|`[^`]+`)[\s;]*$/i.exec(sql)
return (match && match[1]) || null

This regular expression is triggering sonar-js's "slow regex" rule. We need to investigate what the regular expression does, and see if we can improve it.

@workato-integration
Copy link

@newrelic-node-agent-team newrelic-node-agent-team moved this to Triage Needed: Unprioritized Features in Node.js Engineering Board Jan 3, 2025
@kmudduluru kmudduluru moved this from Triage Needed: Unprioritized Features to Prioritized in Node.js Engineering Board Jan 17, 2025
@kmudduluru kmudduluru moved this from Prioritized to To do: In current sprint in Node.js Engineering Board Jan 21, 2025
@kmudduluru kmudduluru added the points: 3 A few days label Jan 21, 2025
@jsumners-nr jsumners-nr self-assigned this Jan 21, 2025
@jsumners-nr jsumners-nr moved this from To do: In current sprint to In progress: Issues being worked on in Node.js Engineering Board Jan 21, 2025
@github-project-automation github-project-automation bot moved this from In progress: Issues being worked on to Done: Issues recently completed in Node.js Engineering Board Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
points: 3 A few days
Projects
Status: Done: Issues recently completed
Development

Successfully merging a pull request may close this issue.

2 participants