Repository navigation
fix: address SonarQube findings - #14
Merged
Merged
Conversation
- trim trailing slashes in linear time; the /\/+$/ replace on the request path backtracked quadratically on long runs of slashes - mark fire-and-forget PostHog calls with void - group the anchored TypeScript detection alternative explicitly - install CI dependencies with --ignore-scripts
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What
replace(/\/+$/, ""), which backtracks quadratically on a long run of slashes not at the end (a 16 KB path cost ~200 ms CPU). NewtrimTrailingSlasheshelper inutil.ts, also used for the publisher URL in the JSON-LD.void.phCapture/phExceptionhand the send toctx.waitUntil; the returned promise is intentionally not awaited. No behaviour change.^anchored alternative is grouped explicitly. Same matching behaviour.npm ci --ignore-scripts(no dependency needs install scripts; typecheck, tests and build pass without them).The remaining backtracking warnings on the language detection signals in
highlight.tsare left as they are: they only run on a sample capped at 4 KB with lines of at most 300 characters (worst adversarial input measured at under 4 ms).How to test
npm ci --ignore-scripts; npm run checkNew unit tests cover
trimTrailingSlashes, including a 100k-slash input.