Skip to content

Commit 4123c87

Browse files
style: apply Prettier formatting to JS, JSON, and MD files
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
1 parent 55bf66d commit 4123c87

File tree

540 files changed

+69969
-61311
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

540 files changed

+69969
-61311
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ the **[Zenko Forum](http://forum.zenko.io/)**.
99
> Questions opened as GitHub issues will systematically be closed, and moved to
1010
> the [Zenko Forum](http://forum.zenko.io/).
1111
12-
--------------------------------------------------------------------------------
12+
---
1313

1414
## Avoiding duplicates
1515

@@ -21,7 +21,7 @@ any duplicates already open:
2121
- if there is a duplicate, please do not open your issue, and add a comment
2222
to the existing issue instead.
2323

24-
--------------------------------------------------------------------------------
24+
---
2525

2626
## Bug report information
2727

@@ -52,7 +52,7 @@ Describe the results you expected
5252
- distribution/OS,
5353
- optional: anything else you deem helpful to us.
5454

55-
--------------------------------------------------------------------------------
55+
---
5656

5757
## Feature Request
5858

@@ -78,10 +78,10 @@ Please provide use cases for changing the current behavior
7878
### Additional information
7979

8080
- Is this request for your company? Y/N
81-
- If Y: Company name:
82-
- Are you using any Scality Enterprise Edition products (RING, Zenko EE)? Y/N
81+
- If Y: Company name:
82+
- Are you using any Scality Enterprise Edition products (RING, Zenko EE)? Y/N
8383
- Are you willing to contribute this feature yourself?
8484
- Position/Title:
8585
- How did you hear about us?
8686

87-
--------------------------------------------------------------------------------
87+
---

.github/docker/vault-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"kmsAWS": {
6969
"noAwsArn": true,
7070
"providerName": "local",
71-
"region": "us-east-1",
71+
"region": "us-east-1",
7272
"endpoint": "http://0:8080",
7373
"ak": "456",
7474
"sk": "123"

CONTRIBUTING.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Contributing rules
22

33
Please follow the
4-
[Contributing Guidelines](
5-
https://github.com/scality/Guidelines/blob/master/CONTRIBUTING.md).
4+
[Contributing Guidelines](https://github.com/scality/Guidelines/blob/master/CONTRIBUTING.md).
5+
6+
## Development Setup
7+
8+
For development setup, code style guidelines, and formatting instructions,
9+
see the **Development** section in the [README.md](README.md#development).

Healthchecks.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ response with HTTP code
66

77
- 200 OK
88

9-
Server is up and running
9+
Server is up and running
1010

1111
- 500 Internal Server error
1212

13-
Server is experiencing an Internal Error
13+
Server is experiencing an Internal Error
1414

1515
- 400 Bad Request
1616

17-
Bad Request due to unsupported HTTP methods
17+
Bad Request due to unsupported HTTP methods
1818

1919
- 403 Forbidden
2020

21-
Request is not allowed due to IP restriction
21+
Request is not allowed due to IP restriction
2222

2323
## Stats
2424

@@ -53,12 +53,12 @@ returned. This is accomplished by retrieving the 6 keys that represent the 6
5353
five-second intervals. As Redis does not have a performant RANGE query, the
5454
list of keys are built manually as follows
5555

56-
* Take current timestamp
56+
- Take current timestamp
5757

58-
* Build each key by subtracting the interval from the timestamp (5 seconds)
58+
- Build each key by subtracting the interval from the timestamp (5 seconds)
5959

60-
* Total keys for each metric (total requests, 500s etc.) is TTL / interval
61-
30/5 = 6
60+
- Total keys for each metric (total requests, 500s etc.) is TTL / interval
61+
30/5 = 6
6262

6363
Note: When Redis is queried, results from non-existent keys are set to 0.
6464

README.md

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ application on the go.
3535
## Contributing
3636

3737
In order to contribute, please follow the
38-
[Contributing Guidelines](
39-
https://github.com/scality/Guidelines/blob/master/CONTRIBUTING.md).
38+
[Contributing Guidelines](https://github.com/scality/Guidelines/blob/master/CONTRIBUTING.md).
4039

4140
## Installation
4241

@@ -69,6 +68,54 @@ If you get an error regarding level-down bindings, try clearing your yarn cache:
6968
yarn cache clean
7069
```
7170

71+
## Development
72+
73+
### Code Style and Formatting
74+
75+
This project uses ESLint for code quality and Prettier for consistent code formatting.
76+
77+
#### Linting
78+
79+
Check code quality with ESLint:
80+
81+
```shell
82+
yarn run lint
83+
```
84+
85+
#### Formatting
86+
87+
Format all code with Prettier:
88+
89+
```shell
90+
yarn run format
91+
```
92+
93+
Check if code is properly formatted:
94+
95+
```shell
96+
yarn run check-format
97+
```
98+
99+
#### Pre-commit Guidelines
100+
101+
Before submitting a pull request, ensure that:
102+
103+
1. **Code is properly formatted**: Run `yarn run check-format` to verify
104+
2. **Code passes linting**: Run `yarn run lint` to check for issues
105+
3. **Tests pass**: Run `yarn test` for unit tests
106+
107+
The CI pipeline will automatically check formatting and linting, so make sure these pass locally first.
108+
109+
#### Code Style Rules
110+
111+
- **Quotes**: Use single quotes (`'`) instead of double quotes (`"`)
112+
- **Indentation**: Use 4 spaces (no tabs)
113+
- **Line Length**: Maximum 120 characters per line
114+
- **Semicolons**: Always use semicolons
115+
- **Trailing Commas**: Use trailing commas in ES5+ contexts
116+
117+
Prettier will automatically enforce most of these rules when you run `yarn run format`.
118+
72119
## Run it with a file backend
73120

74121
```shell
@@ -85,8 +132,8 @@ a secret key of verySecretKey1.
85132
By default the metadata files will be saved in the
86133
localMetadata directory and the data files will be saved
87134
in the localData directory within the ./S3 directory on your
88-
machine. These directories have been pre-created within the
89-
repository. If you would like to save the data or metadata in
135+
machine. These directories have been pre-created within the
136+
repository. If you would like to save the data or metadata in
90137
different locations of your choice, you must specify them with absolute paths.
91138
So, when starting the server:
92139

TESTING.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,26 @@
1010
### Features tested
1111

1212
- Authentication
13-
- Building signature
14-
- Checking timestamp
15-
- Canonicalization
16-
- Error Handling
13+
- Building signature
14+
- Checking timestamp
15+
- Canonicalization
16+
- Error Handling
1717

1818
- Bucket Metadata API
19-
- GET, PUT, DELETE Bucket Metadata
19+
- GET, PUT, DELETE Bucket Metadata
2020

2121
- s3 API
22-
- GET Service
23-
- GET, PUT, DELETE, HEAD Object
24-
- GET, PUT, DELETE, HEAD Bucket
25-
- ACL's
26-
- Bucket Policies
27-
- Lifecycle
28-
- Range requests
29-
- Multi-part upload
22+
- GET Service
23+
- GET, PUT, DELETE, HEAD Object
24+
- GET, PUT, DELETE, HEAD Bucket
25+
- ACL's
26+
- Bucket Policies
27+
- Lifecycle
28+
- Range requests
29+
- Multi-part upload
3030

3131
- Routes
32-
- GET, PUT, PUTRAW, DELETE, HEAD for objects and buckets
32+
- GET, PUT, PUTRAW, DELETE, HEAD for objects and buckets
3333

3434
## Functional Tests
3535

bin/metrics_server.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
#!/usr/bin/env node
22
'use strict';
33

4-
const {
5-
startWSManagementClient,
6-
startPushConnectionHealthCheckServer,
7-
} = require('../lib/management/push');
4+
const { startWSManagementClient, startPushConnectionHealthCheckServer } = require('../lib/management/push');
85

96
const logger = require('../lib/utilities/logger');
107

11-
const {
12-
PUSH_ENDPOINT: pushEndpoint,
13-
INSTANCE_ID: instanceId,
14-
MANAGEMENT_TOKEN: managementToken,
15-
} = process.env;
8+
const { PUSH_ENDPOINT: pushEndpoint, INSTANCE_ID: instanceId, MANAGEMENT_TOKEN: managementToken } = process.env;
169

1710
if (!pushEndpoint) {
1811
logger.error('missing push endpoint env var');

bin/search_bucket.js

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,7 @@ const http = require('http');
99
const https = require('https');
1010
const logger = require('../lib/utilities/logger');
1111

12-
function _performSearch(host,
13-
port,
14-
bucketName,
15-
query,
16-
listVersions,
17-
accessKey,
18-
secretKey,
19-
sessionToken,
20-
verbose, ssl) {
12+
function _performSearch(host, port, bucketName, query, listVersions, accessKey, secretKey, sessionToken, verbose, ssl) {
2113
const escapedSearch = encodeURIComponent(query);
2214
const options = {
2315
host,
@@ -88,21 +80,21 @@ function searchBucket() {
8880
.option('-h, --host <host>', 'Host of the server')
8981
.option('-p, --port <port>', 'Port of the server')
9082
.option('-s', '--ssl', 'Enable ssl')
91-
.option('-l, --list-versions', 'List all versions of the objects that meet the search query, ' +
92-
'otherwise only list the latest version')
83+
.option(
84+
'-l, --list-versions',
85+
'List all versions of the objects that meet the search query, ' + 'otherwise only list the latest version'
86+
)
9387
.option('-v, --verbose')
9488
.parse(process.argv);
95-
const { host, port, accessKey, secretKey, sessionToken, bucket, query, listVersions, verbose, ssl } =
96-
commander;
89+
const { host, port, accessKey, secretKey, sessionToken, bucket, query, listVersions, verbose, ssl } = commander;
9790

9891
if (!host || !port || !accessKey || !secretKey || !bucket || !query) {
9992
logger.error('missing parameter');
10093
commander.outputHelp();
10194
process.exit(1);
10295
}
10396

104-
_performSearch(host, port, bucket, query, listVersions, accessKey, secretKey, sessionToken, verbose,
105-
ssl);
97+
_performSearch(host, port, bucket, query, listVersions, accessKey, secretKey, sessionToken, verbose, ssl);
10698
}
10799

108100
searchBucket();

bin/secure_channel_proxy.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
#!/usr/bin/env node
22
'use strict';
33

4-
const {
5-
startWSManagementClient,
6-
startPushConnectionHealthCheckServer,
7-
} = require('../lib/management/push');
4+
const { startWSManagementClient, startPushConnectionHealthCheckServer } = require('../lib/management/push');
85

96
const logger = require('../lib/utilities/logger');
107

11-
const {
12-
PUSH_ENDPOINT: pushEndpoint,
13-
INSTANCE_ID: instanceId,
14-
MANAGEMENT_TOKEN: managementToken,
15-
} = process.env;
8+
const { PUSH_ENDPOINT: pushEndpoint, INSTANCE_ID: instanceId, MANAGEMENT_TOKEN: managementToken } = process.env;
169

1710
if (!pushEndpoint) {
1811
logger.error('missing push endpoint env var');

0 commit comments

Comments
 (0)