Skip to content

CLDSRV-1002: format the whole codebase with prettier - #6297

Open
DarkIsDude wants to merge 16 commits into
development/9.4from
improvement/CLDSRV-1002/prettier-whole-repo
Open

DarkIsDude wants to merge 16 commits into
development/9.4from
improvement/CLDSRV-1002/prettier-whole-repo

Conversation

@DarkIsDude

@DarkIsDude DarkIsDude commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Motivation and context

Prettier has only ever been checked on the files a PR touches, so the codebase
was being reformatted a few files at a time and most of it was still
unformatted. The RRR of Sep 7, 2026 concluded we should stop spreading it out
and do it in one go, so that formatting noise never lands in a review again.

Base is development/9.4; 9.5 inherits it by forward merge.

What changed

  1. 👷 check prettier formatting on the whole repo — the CI job runs
    prettier --check . instead of diffing against the merge base.
    scripts/prettier-diff.sh and the prettier:diff script are gone, replaced
    by prettier:check and prettier:write. ESLint's max-len is turned off:
    it duplicates Prettier's printWidth and disagrees with it on lines
    Prettier cannot break (long string literals). The now-dead
    eslint-disable max-len directives are removed with it.
  2. 🙈 keep the website test fixtures out of prettier — their exact bytes
    are asserted as ETags in websiteHead.js / websiteHeadWithACL.js.
  3. 🎨 format the whole codebase with prettier — 499 files, the plain
    output of yarn prettier:write, no manual edit on top.
  4. 💚 keep the reformatted table within mdlint's line limit — Prettier's
    table padding pushed a CLAUDE.md table past MD013.
  5. 📝 ignore the reformat commit in git blame — adds
    .git-blame-ignore-revs.
  6. 📝 put the blame ignore setup first, one comment per commit
  7. 🎨 merge string literals that prettier left concatenated — Prettier
    collapses '...' + '...' onto one line but keeps the +; runs of adjacent
    literals are merged (or re-split into fewer pieces when too long). Also adds
    the spaces that were missing at some of those joins.
  8. 👷 run the prettier check in the tests workflow lint job — drops the
    separate lint workflow; Prettier now runs on every push next to ESLint.

Commit 3 is mechanical; commit 7 is scripted with string values unchanged apart from the added spaces.

Verification

  • yarn prettier:check — clean
  • yarn lint — 0 errors, 3004 warnings, identical to development/9.4
  • yarn test — 6105 passing, 5 pending

Related issues

https://scality.atlassian.net/browse/CLDSRV-1002

@DarkIsDude DarkIsDude self-assigned this Sep 21, 2026
@bert-e

bert-e commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Hello darkisdude,

My role is to assist you with the merge of this
pull request. Please type @bert-e help to get information
on this process, or consult the user documentation.

Available options
name description privileged authored
/after_pull_request Wait for the given pull request id to be merged before continuing with the current one.
/bypass_author_approval Bypass the pull request author's approval ⭐
/bypass_build_status Bypass the build and test status ⭐
/bypass_commit_size Bypass the check on the size of the changeset TBA ⭐
/bypass_incompatible_branch Bypass the check on the source branch prefix ⭐
/bypass_jira_check Bypass the Jira issue check ⭐
/bypass_peer_approval Bypass the pull request peers' approval ⭐
/bypass_leader_approval Bypass the pull request leaders' approval ⭐
/bypass_source_branch_lineage Bypass the cross-branch contamination check ⭐
/approve Instruct Bert-E that the author has approved the pull request. ✍️
/create_pull_requests Allow the creation of integration pull requests.
/create_integration_branches Allow the creation of integration branches.
/no_octopus Prevent Wall-E from doing any octopus merge and use multiple consecutive merge instead
/unanimity Change review acceptance criteria from one reviewer at least to all reviewers
/wait Instruct Bert-E not to run until further notice.
Available commands
name description privileged
/help Print Bert-E's manual in the pull request.
/status Print Bert-E's current status in the pull request.
/clear Remove all comments from Bert-E from the history TBA
/retry Re-start a fresh build TBA
/build Re-start a fresh build TBA
/force_reset Delete integration branches & pull requests, and restart merge process from the beginning.
/reset Try to remove integration branches unless there are commits on them which do not appear on the source branch.

Status report is not available.

@DarkIsDude

Copy link
Copy Markdown
Contributor Author

/create_pull_requests

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@codecov

This comment was marked as off-topic.

@DarkIsDude

This comment was marked as resolved.

@DarkIsDude
DarkIsDude marked this pull request as ready for review September 21, 2026 15:06
@DarkIsDude
DarkIsDude requested review from a team, delthas and francoisferrand September 21, 2026 15:06
Comment thread .github/scripts/cleanupOldGCPBuckets.js Outdated
Comment thread bin/search_bucket.js Outdated
Comment thread lib/api/apiUtils/bucket/bucketCors.js Outdated
Comment thread lib/api/apiUtils/bucket/bucketWebsite.js
Comment thread .git-blame-ignore-revs Outdated
@francoisferrand

francoisferrand commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

It seems prettier does not handle strings well -creating useless string concatenations, keeping unneeded wrapped lines or not splitting lines, and leaving multi-line strings concatenated with single-line strings-, which this is not caught by the linter either, and I ended up doing the linter myself...
→ can't post the comments -too many of them for GitHub 😬-, but the useless string concats and rewrap should be addressed (by AI?)

Specific remarks:

  • the "linter" workflow should be brought back into the "main" workflow running on push (test I think) : should run on any push like the rest, and no reason to have a separate workflow now (esp. since that one already has "lint" job)
  • prettier:... commands are not very useful, as arguments can be passed to the yarn command directly : yarn run prettier --check

A few extra notable findings regarding tech debts we may handle to address sooner rather than later (though not in this PR obviously):

  • async.waterflow with 10 params in the write path (putObject, putMPU, copyObject) becomes unreadable with prettier putting each param on its own line (just return + next callback takes the screen!). Maybe the change to migrate these functions to async
  • in many places we have the pattern .then(() => cb()).catch(cb) which can lead to calling the callback twice - should be migrated to callbackify, .then(() => cb(), cb) or fully go with async

Comment thread tests/functional/s3cmd/tests.js Outdated
Comment thread lib/api/objectDelete.js Outdated
@scality scality deleted a comment from bert-e Sep 24, 2026
@scality scality deleted a comment from bert-e Sep 24, 2026
DarkIsDude and others added 16 commits September 24, 2026 12:07
The lint job of the tests workflow runs prettier --check on every file,
next to ESLint, instead of a separate workflow diffing the files a pull
request touches; the diff script goes away.

Issue: CLDSRV-1002
Prettier and max-len both cap lines at 120 columns, but Prettier cannot
break string literals, template literals or comments, so it leaves some
lines longer and max-len reports them: 109 errors on the reformatted tree.
Fixing them would mean hand-split strings or disable comments, which is
the concatenation noise the reformat removes. Turn max-len off.

The eslint-disable max-len directives become unused, which ESLint 9
reports as warnings and the lint job fails on (--max-warnings 0), so they
are removed with it.

Issue: CLDSRV-1002
The website fixtures' exact bytes are asserted as ETags in websiteHead.js
and websiteHeadWithACL.js. monitoring/dashboard.json is generated from
dashboard.py by grafanalib; it is also marked as generated so GitHub
collapses its diff.

Issue: CLDSRV-1002
Plain output of `yarn prettier:write`, no manual edit on top.

Issue: CLDSRV-1002
Prettier pads markdown table cells for alignment, which pushed this table
to 82 columns and tripped MD013. mdlint's config lives in the shared
Guidelines package and cannot be relaxed per repo, so shorten the widest
cell instead.

Issue: CLDSRV-1002
Adds .git-blame-ignore-revs, which GitHub reads automatically; the file
explains the one-time git config needed locally.

Issue: CLDSRV-1002
Prettier reflowed the code to 120 columns, which left many messages and
test descriptions as chains of short literals joined with `+`. Merge
adjacent literals into a single string wherever the result fits; strings
that cannot fit are re-split into as few pieces as possible.

Issue: CLDSRV-1002
Strings that were wrapped by hand for the old 80-column limit kept their
short pieces after the Prettier reflow, often as one short line followed
by several full ones. Re-split them into as few balanced pieces as fit in
120 columns, or into a single literal when it fits.

Issue: CLDSRV-1002
Where a message was built as a plain string concatenated with a template
literal, merge the pieces into a single template literal. Kept separate
from the plain-string merges so it can be reviewed, or dropped, on its
own.

Issue: CLDSRV-1002
Merging the hand-wrapped literals exposed pieces that had been joined
without a separating space (and one doubled space), in test names and in
a few error messages. Add the missing spaces.

Issue: CLDSRV-1002
Covers code added to development/9.4 after the cleanup was written and
every remaining plain, template or mixed pair joined with + on one line,
so no-useless-concat has nothing left to report. The ACL XML builder now
pushes whole fragments instead of separate hardcoded entries joined with
''. String values are unchanged, checked by comparing the parsed string
contents of every file before and after.

Issue: CLDSRV-1002
Joins that glued two words (badconfig, localCachesentinel, ...), a
missing space after a colon, a double space, and the localCache password
assertion message. No test asserts these messages.

Issue: CLDSRV-1002
Nothing is left for it to report after the string cleanup; enabling it
stops new '...' + '...' joins on one line. Chains split over several lines
are not reported, by the rule's design.

Issue: CLDSRV-1002
From review: drop quotes docker-compose does not need, keep the async
check ternary on three lines (an empty trailing comment stops prettier
joining it), merge the completempu test title, add blank lines between
tests, indent the encryption test XML bodies with the code, and drop the
quotes around function names in describe titles.

Issue: CLDSRV-1002
The template literal carried the code indentation into the response body,
between the XML declaration and the root element. Only that whitespace
changes; the document is the same.

Issue: CLDSRV-1002
`.then(() => cb()).catch(cb)` calls cb a second time with the error when
cb itself throws. Pass cb as the rejection handler instead, and let the
bucket logging cleanup return its promise to mocha.

Issue: CLDSRV-1002
@DarkIsDude
DarkIsDude force-pushed the improvement/CLDSRV-1002/prettier-whole-repo branch from d1c449e to 2b69358 Compare September 24, 2026 10:07
@scality scality deleted a comment from bert-e Sep 24, 2026
@bert-e

bert-e commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Integration data created

I have created the integration data for the additional destination branches.

The following branches will NOT be impacted:

  • development/7.10
  • development/7.4
  • development/7.70
  • development/8.8
  • development/9.0
  • development/9.1
  • development/9.2
  • development/9.3

Follow integration pull requests if you would like to be notified of
build statuses by email.

The following options are set: create_pull_requests

@bert-e

bert-e commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • the author

  • 2 peers

The following options are set: create_pull_requests

This branch has not been deployed

No deployments
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.

6 participants