Skip to content

Conversation

williamlardier
Copy link
Contributor

@williamlardier williamlardier commented Jul 22, 2025

We should follow the eslint default, completed by the imported scality rules.

Any additional rule should add some constraints, like disabling .only tests to make the CI fail.

The reason is that we end up being too leniant on the style, and that translates into useless indent (or other style) changes in branches, due to local tooling auto-formatting the code, which make the reviews harder.

The main problem reported is the indentation: it is varying from file to file, making the code harder to read.

Almost all rules were already followed, so enabling them was not impacting the code at all.

Then we introduce prettier to ensure code style is consistent.

Issue: CLDSRV-723

@bert-e
Copy link
Contributor

bert-e commented Jul 22, 2025

Hello williamlardier,

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
/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 TBA
/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.

@bert-e
Copy link
Contributor

bert-e commented Jul 22, 2025

Incorrect fix version

The Fix Version/s in issue CLDSRV-723 contains:

  • 9.0.22

Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:

  • 9.0.21

  • 9.1.0

Please check the Fix Version/s of CLDSRV-723, or the target
branch of this pull request.

Copy link

codecov bot commented Jul 22, 2025

Codecov Report

Attention: Patch coverage is 76.66667% with 672 lines in your changes missing coverage. Please review.

Project coverage is 75.90%. Comparing base (e47d49e) to head (9254174).

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
lib/api/objectGet.js 44.44% 70 Missing ⚠️
lib/api/multiObjectDelete.js 62.42% 65 Missing ⚠️
lib/api/objectCopy.js 73.88% 41 Missing ⚠️
lib/api/objectPutCopyPart.js 70.64% 32 Missing ⚠️
lib/api/objectPutPart.js 76.10% 27 Missing ⚠️
lib/api/completeMultipartUpload.js 87.07% 19 Missing ⚠️
lib/api/apiUtils/object/createAndStoreObject.js 74.64% 18 Missing ⚠️
lib/api/metadataSearch.js 5.26% 18 Missing ⚠️
lib/api/bucketGetEncryption.js 0.00% 17 Missing ⚠️
lib/api/apiUtils/object/objectLockHelpers.js 34.78% 15 Missing ⚠️
... and 72 more
Additional details and impacted files

Impacted file tree graph

Files with missing lines Coverage Δ
lib/Config.js 79.29% <ø> (+0.18%) ⬆️
lib/api/apiUtils/bucket/bucketShield.js 100.00% <100.00%> (ø)
lib/api/apiUtils/bucket/createKeyForUserBucket.js 100.00% <ø> (ø)
...api/apiUtils/bucket/getReplicationConfiguration.js 90.90% <100.00%> (ø)
...b/api/apiUtils/bucket/validateReplicationConfig.js 84.61% <100.00%> (-1.10%) ⬇️
lib/api/apiUtils/bucket/validateSearch.js 96.42% <100.00%> (ø)
lib/api/apiUtils/object/applyZenkoUserMD.js 80.00% <100.00%> (ø)
lib/api/apiUtils/object/checkHttpHeadersSize.js 88.88% <100.00%> (ø)
lib/api/apiUtils/object/checkReadLocation.js 100.00% <100.00%> (ø)
lib/api/apiUtils/object/checkUserMetadataSize.js 61.53% <100.00%> (-2.75%) ⬇️
... and 160 more
@@                 Coverage Diff                 @@
##           development/9.0    #5877      +/-   ##
===================================================
+ Coverage            75.88%   75.90%   +0.02%     
===================================================
  Files                  188      188              
  Lines                11983    11957      -26     
===================================================
- Hits                  9093     9076      -17     
+ Misses                2890     2881       -9     
Flag Coverage Δ
ceph-backend-test 47.00% <40.83%> (+0.06%) ⬆️
file-ft-tests 47.35% <45.31%> (+0.03%) ⬆️
kmip-ft-tests 27.03% <13.75%> (+0.05%) ⬆️
mongo-v0-ft-tests 47.79% <45.45%> (+0.04%) ⬆️
mongo-v1-ft-tests 47.81% <45.45%> (+0.04%) ⬆️
multiple-backend 35.53% <18.22%> (+0.05%) ⬆️
quota-tests 32.30% <24.02%> (-0.80%) ⬇️
quota-tests-inflights 34.26% <30.00%> (+0.04%) ⬆️
unit 66.95% <72.77%> (+<0.01%) ⬆️
utapi-v2-tests 33.40% <28.92%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bert-e
Copy link
Contributor

bert-e commented Jul 22, 2025

Incorrect fix version

The Fix Version/s in issue CLDSRV-723 contains:

  • 9.0.22

Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:

  • 9.0.22

  • 9.1.0

Please check the Fix Version/s of CLDSRV-723, or the target
branch of this pull request.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally we should use .editorconfig for the IDE to format correctly.

We should use prettier for formatting stuff like indent.
And use eslint prettier plugin / config to turn off eslint stylistic rules like indent or quotes (they'll be moved and and not enabled by default in v10)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can add a prettier yes. But we still want to enforce indentation before v10. How about introducing a prettier with an action to ensure it ran, then when upgrading to v10, we can remove the eslint rules? (actually, nothing to do, if they are removed).

I'll check for the .editorconfig at the same time.

Copy link
Contributor

@BourgoisMickael BourgoisMickael Jul 22, 2025

Choose a reason for hiding this comment

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

indentation is the job of prettier as it rewrite the file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I introduced prettier, now binded to eslint for consistent rules, with an .editorconfig and CI rules to verify the format.

As discussed, because this is a lot of changes, let's wait for unification to complete first.

Overall we really had a lot of formatting inconsistencies, so this will a bit slow down git blames as most of the lines are impacted, but it will be easier to work with integration branches from now on.

Copy link
Contributor

Choose a reason for hiding this comment

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

editorconfig needs an IDE extension for some IDE: https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig

we could include a .vscode/extensions.json (like https://github.com/microsoft/TypeScript/blob/main/.vscode/extensions.json) so all devs could see a popup to install the extension in their vscode.

Same for prettier and eslint could have extensions to format on save.

@williamlardier williamlardier force-pushed the improvement/CLDSRV-723-remove-eslint-custom-rules branch from 5d2b194 to 1fe7d14 Compare July 22, 2025 14:25
@williamlardier williamlardier changed the title Remove eslint custom rules Remove eslint custom rules and introduce prettier Jul 22, 2025
We should follow the eslint default, completed by the imported
scality rules.

Any additional rule should add some constraints, like disabling
.only tests to make the CI fail.

The reason is that we end up being too leniant on the style,
and that translates into useless indent (or other style) changes
in branches, due to local tooling auto-formatting the code,
which make the reviews harder.

Issue: CLDSRV-723
- Add Prettier and eslint-config-prettier dependencies
- Configure Prettier with single quotes and 120-char line width
- Add format and check-format npm scripts
- Create .prettierignore to exclude build outputs and binaries
- Add .editorconfig for consistent IDE settings across team

Issue: CLDSRV-723
- Extend eslint-config-prettier to disable formatting rules
- Add check-format step to GitHub Actions workflow
- Ensure CI enforces code formatting standards

Issue: CLDSRV-723
@williamlardier williamlardier marked this pull request as draft July 22, 2025 14:29
Update yarn.lock to include new dependencies:
- prettier@^3.3.3
- eslint-config-prettier@^9.1.0

Issue: CLDSRV-723
@williamlardier williamlardier force-pushed the improvement/CLDSRV-723-remove-eslint-custom-rules branch from 1fe7d14 to da39f13 Compare July 22, 2025 14:35
Apply consistent code formatting using Prettier to appropriate file types:
- Convert double quotes to single quotes in JS/MJS/JSON files
- Standardize indentation to 4 spaces across JS files
- Normalize spacing and line breaks with 120-char width
- Apply consistent trailing commas and semicolons
- Update package.json scripts to exclude YAML files from formatting
- Format ~500 JS/JSON/MD files while preserving YAML formatting

Issue: CLDSRV-723
@williamlardier williamlardier force-pushed the improvement/CLDSRV-723-remove-eslint-custom-rules branch from da39f13 to 4123c87 Compare July 22, 2025 14:44
@@ -46,8 +46,7 @@ const constants = {
// only public resources
publicId: 'http://acs.amazonaws.com/groups/global/AllUsers',
// All Authenticated Users is an ACL group.
allAuthedUsersId: 'http://acs.amazonaws.com/groups/' +
'global/AuthenticatedUsers',
allAuthedUsersId: 'http://acs.amazonaws.com/groups/' + 'global/AuthenticatedUsers',
Copy link
Contributor

Choose a reason for hiding this comment

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

This is because it was before limited to 80 chars, now it's 120, so those strings can be regrouped, we might have a lot like that in the code

"cover": "nyc --clean --silent yarn run",
"postcover": "nyc report --report-dir ./coverage/test --reporter=lcov"
}
"name": "@zenko/cloudserver",
Copy link
Contributor

Choose a reason for hiding this comment

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

this is 4 indents, not following prettierc

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