Repository navigation
refactor: address SonarCloud findings on #438 - #439
Merged
Merged
Conversation
- handleResponse: a successful response that is not JSON goes through the one rejection path instead of a second Promise.reject - applying an ignore area to the whole build is one flat promise chain - zip entry numbering uses a while loop over the name it tests
|
pashidlos
added a commit
that referenced
this pull request
Oct 24, 2026
… list and switcher (#442) * build(lint): run SonarCloud's rules locally with eslint-plugin-sonarjs SonarCloud only looks at a PR once it is open, so its findings arrived after review (#438 → #439). eslint-plugin-sonarjs 4.2.2 runs the same rules in `npm run lint`, the pre-commit hook and CI. The 21 findings in the current code: - window.open for "Open an issue in GitHub" now passes noopener,noreferrer, so the opened page gets no handle on the app's tab (test first) - three nested ternaries and two one-case switch reducers rewritten as plain ifs; a float constant compared with toBeCloseTo - todo-tag is a warning: the TODOs are debt to see, not a failed build - off for Playwright specs only: assertions-in-tests (specs assert through helpers and page objects) and void-use (`void fixture` asks for a fixture used only for its setup) * feat(projects): favourites, recently opened and search in the project list and switcher A long project list was one unsorted grid, and the switcher on the build page a plain select. Now: - a star on each card marks a favourite; favourites are kept per user by the API (GET /projects/favorites, PUT/DELETE /projects/:id/favorite) and listed first, under "Favourites" - the last five projects opened are listed next, under "Recently opened", kept in this browser per user - the rest follow by name; the order is the same in the list and switcher - a search field filters by name, id or main branch, keeps the query in the URL (?q=) and takes focus on "/" - the switcher on the build, variations and profile pages is an autocomplete with the same groups and search - Builds and Variations are router links: they used to reload the whole app An API without favourites (older backend) answers 404: the list then works without them instead of greeting every login with an error. The star goes back and the error shows if saving it fails. ProjectCard, ProjectGrid and ProjectSearchField keep the page under 300 lines. The e2e sign-in fixture answers no favourites by default; new specs cover starring, the order, search, "/", the switcher and navigation without a reload. screens.spec gains the grouped list, a search without matches and the open switcher; baselines regenerated in Docker. * test: raise the coverage floors to the reached level * fix(projects): keep the switcher where the select was; address SonarCloud on #442; wait before legacy screenshots - The project switcher had a margin above its label, which the select it replaced had not: the label, the name and everything under them sat 8px lower on the build, variations and profile pages. Only the sides and the bottom keep the inset now, and the layout matches master again. - SonarCloud: the two favourite mocks drop an async they never awaited, and the lint config's comment no longer reads as an open task. require-await (Sonar's S7503, outside eslint-plugin-sonarjs) runs as a warning, since older tests and mocks have 40 such functions. - The per-spec "renders" tests of six pages took their screenshot before the lazy route had rendered, so they flaked (on master too) and an update run wrote the empty page as the baseline. They wait for the page's heading and for the network to settle first. Baselines regenerated in Docker; those within the 100px tolerance of master are master's again.
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 and why
SonarCloud reported 4 new issues on #438 (its quality gate passed). This addresses them without changing behaviour:
handleResponse(S7746, S6671): a successful response whose body is not JSON now goes through the one existing rejection path instead of a secondPromise.reject. The rejection stays a string on purpose: every service caller passes it toenqueueSnackbar(err, { variant: "error" }), and notistack takes anErrorobject as its options, which drops the error style — the bug fix: bugs from the frontend review — wrong runs in bulk actions, lost ignore areas, stale answers #438 fixed.TestDetailsModalapplying an ignore area to the whole build (S9381): one flat promise chain instead of a nested.then; a failure still reaches the samecatch.downloadAsZipentry numbering (S1994): awhileloop over the name it tests, instead of aforwhose condition and counter were different variables.How it was checked
npm run lint(0 errors) andnpm run typechecknpm test: 602 pass, including the existing tests for the non-JSON response, the build-wide ignore area failure and the zip numberingnpm run buildnpm run test:pw:docker: not rerun; no rendered output or flow changedScreenshots
Nothing visible changed.