Skip to content

Commit d6a03a0

Browse files
committed
chore: format all files
1 parent 8b6465c commit d6a03a0

File tree

297 files changed

+6361
-6299
lines changed

Some content is hidden

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

297 files changed

+6361
-6299
lines changed

.github/actions/sync-data/src/shared/constants.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const EXCLUDED_PROJECTS = [
3939
'w3c-distributed-tracing-wg',
4040
'w3c-trace-context',
4141
'w3c-trace-context-binary',
42-
'w3c-trace-response'
42+
'w3c-trace-response',
4343
];
4444

4545
// TO DO - Ascertain Github's GraphQL query limits
@@ -48,11 +48,11 @@ const SCREENSHOT_FOLDERS = {
4848
screenshots: 'master:screenshots/',
4949
assetsScreenshots: 'master:assets/screenshots/',
5050
assetsDocumentationImages: 'master:assets/documentation-images/',
51-
catalogScreenshots: 'master:catalog/screenshots/'
51+
catalogScreenshots: 'master:catalog/screenshots/',
5252
};
5353

5454
module.exports = {
5555
ORG_REPOS,
5656
EXCLUDED_PROJECTS,
57-
SCREENSHOT_FOLDERS
57+
SCREENSHOT_FOLDERS,
5858
};
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
/* eslint-disable no-console */
2-
const prettyPrintJson = json => console.log(JSON.stringify(json, null, 2));
2+
const prettyPrintJson = (json) => console.log(JSON.stringify(json, null, 2));
33

4-
const prettyPrint = message => console.log(message);
4+
const prettyPrint = (message) => console.log(message);
55

6-
const sleep = delay => {
7-
return new Promise(resolve => {
6+
const sleep = (delay) => {
7+
return new Promise((resolve) => {
88
setTimeout(resolve, delay);
99
});
1010
};
1111

1212
module.exports = {
1313
prettyPrintJson,
1414
prettyPrint,
15-
sleep
15+
sleep,
1616
};

.github/actions/sync-data/src/stats-generator/github/fetch-all-pages.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ async function fetchAllPages(
1111
// it takes query results and returns array
1212
resultSelector,
1313
// eslint-disable-next-line no-unused-vars
14-
onPageFetchComplete = nodesFetched => {}
14+
onPageFetchComplete = (nodesFetched) => {},
1515
}
1616
) {
1717
let endCursor = null; // used to track pagination through the results
@@ -37,7 +37,7 @@ async function fetchAllPages(
3737

3838
onPageFetchComplete(nodes.length);
3939

40-
log.debug(nodes.map(d => `id: ${d.id} ${d.nameWithOwner}`).join('\n '));
40+
log.debug(nodes.map((d) => `id: ${d.id} ${d.nameWithOwner}`).join('\n '));
4141

4242
results = [...results, ...nodes];
4343
// log.json(results)
@@ -48,7 +48,7 @@ async function fetchAllPages(
4848
// last page results could be handy to fetch properties that are located
4949
// at different path than provided by results selector
5050
// lastPageProps: apiResponse,
51-
results
51+
results,
5252
};
5353
}
5454

.github/actions/sync-data/src/stats-generator/github/fetchContributorStats.js

+12-10
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ const GH_TOKEN = core.getInput('github-token') || process.env.GH_TOKEN;
99
const octokit = createOctokit({
1010
DEFAULT_ORG,
1111
accessToken: GH_TOKEN,
12-
cacheKey: ''
12+
cacheKey: '',
1313
});
1414

15-
const fetchContributorStats = async function(owner, repo) {
15+
const fetchContributorStats = async function (owner, repo) {
1616
// console.log("creating octokit")
1717
// const octokit = await createGithubClient(DEFAULT_ORG, '', token)
1818
// console.log("octokit created", octokit);
@@ -23,7 +23,7 @@ const fetchContributorStats = async function(owner, repo) {
2323
'GET /repos/:owner/:repo/stats/contributors',
2424
{
2525
owner,
26-
repo
26+
repo,
2727
}
2828
);
2929
// console.log(`Result: ${contributorStats}`);
@@ -44,9 +44,11 @@ const fetchRepoStatsByContributor_withRetry = async (owner, repo, retries) => {
4444
} catch (err) {
4545
error = err;
4646
prettyPrint(
47-
`[WARNING] at stats-generator.github.fetchContributorStats.fetchRepoStatsByContributor_withRetry \n | Try #${i +
48-
1} | owner: ${owner}, repo: ${repo} | getRepoStatsByContributor failed, retrying after ${delay /
49-
1000}s delay\n`
47+
`[WARNING] at stats-generator.github.fetchContributorStats.fetchRepoStatsByContributor_withRetry \n | Try #${
48+
i + 1
49+
} | owner: ${owner}, repo: ${repo} | getRepoStatsByContributor failed, retrying after ${
50+
delay / 1000
51+
}s delay\n`
5052
);
5153
await sleep(delay);
5254
}
@@ -56,14 +58,14 @@ const fetchRepoStatsByContributor_withRetry = async (owner, repo, retries) => {
5658
return null;
5759
};
5860

59-
const getRepoStatsByContributor = async function(owner, repo) {
61+
const getRepoStatsByContributor = async function (owner, repo) {
6062
const response = await fetchContributorStats(owner, repo);
6163
const { /* status, url, headers, */ data } = response;
6264

6365
if (Array.isArray(data)) {
6466
const formattedContributorStats = data.map(({ total, author }) => ({
6567
total: total,
66-
author: author
68+
author: author,
6769
}));
6870
return formattedContributorStats;
6971
}
@@ -74,7 +76,7 @@ const getRepoStatsByContributor = async function(owner, repo) {
7476
);
7577
};
7678

77-
const fetchStats = async function(owner, repo) {
79+
const fetchStats = async function (owner, repo) {
7880
const retries = 3;
7981
const contributorStats = await fetchRepoStatsByContributor_withRetry(
8082
owner,
@@ -90,5 +92,5 @@ const fetchStats = async function(owner, repo) {
9092
// })();
9193

9294
module.exports = {
93-
fetchStats
95+
fetchStats,
9496
};

.github/actions/sync-data/src/stats-generator/github/github-client.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ const createOctokit = ({ org, accessToken, tokenType = 'token', cacheKey }) => {
5858
// retry twice
5959
if (options.request.retryCount < 2) {
6060
log.warn(
61-
`Retrying after ${retryAfter} seconds, retry attempt=${options
62-
.request.retryCount + 1}`
61+
`Retrying after ${retryAfter} seconds, retry attempt=${
62+
options.request.retryCount + 1
63+
}`
6364
);
6465
// Return true to automatically retry the request after retryAfter seconds
6566
return true;
@@ -72,15 +73,15 @@ const createOctokit = ({ org, accessToken, tokenType = 'token', cacheKey }) => {
7273
log.warn(`Abuse detected for request ${options.method} ${options.url}`);
7374
log.json(options);
7475
return true;
75-
}
76+
},
7677
},
7778
log: {
7879
// eslint-disable-next-line no-unused-vars
7980
debug: (operation, payload) => {},
8081
info: log.info,
8182
warn: log.warn,
82-
error: log.error
83-
}
83+
error: log.error,
84+
},
8485
});
8586
};
8687

@@ -105,7 +106,7 @@ async function createGithubClient(org, cacheKey, accessToken) {
105106
const octokit = createOctokit({
106107
org,
107108
accessToken: githubAccessToken,
108-
cacheKey
109+
cacheKey,
109110
});
110111

111112
addGraphQL(octokit, org);
@@ -118,7 +119,7 @@ function createGithubUserClient(org, userAccessToken) {
118119
org,
119120
accessToken: userAccessToken,
120121
// it makes sense to set locks on token level, so we control concurrency per user
121-
cacheKey: userAccessToken
122+
cacheKey: userAccessToken,
122123
});
123124

124125
addGraphQL(octokit, org);
@@ -128,5 +129,5 @@ function createGithubUserClient(org, userAccessToken) {
128129
module.exports = {
129130
createGithubClient,
130131
createGithubUserClient,
131-
createOctokit
132+
createOctokit,
132133
};

.github/actions/sync-data/src/stats-generator/github/graphql.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const { distanceInWords } = require('date-fns');
66
const {
77
removeNewLines,
88
removeTabsAndSpaces,
9-
removeEscapedCharacters
9+
removeEscapedCharacters,
1010
} = require('../lib/utils');
1111
const log = require('../lib/log');
1212

@@ -29,7 +29,7 @@ class GraphQLError extends Error {
2929
}
3030
}
3131

32-
const getQueryName = query =>
32+
const getQueryName = (query) =>
3333
R.path([1], query.match(/[query|mutation] \s*(\w+)/m)) || 'unknown name';
3434

3535
const QUERY_COST_THRESHOLD = 50;
@@ -120,13 +120,13 @@ const graphql = (octokit, org, { operationType }) => async (
120120
// enable Checks (Check Suites)
121121
'application/vnd.github.antiope-preview+json',
122122
'content-type': 'application/json',
123-
...headers
123+
...headers,
124124
},
125125
method: 'POST',
126126
url: '/graphql',
127127

128128
query: query.query,
129-
variables: query.variables
129+
variables: query.variables,
130130
});
131131

132132
if (resp.status !== 200) {
@@ -142,7 +142,7 @@ const graphql = (octokit, org, { operationType }) => async (
142142
org,
143143
data,
144144
query: cleanedUpQuery,
145-
elapsedMs
145+
elapsedMs,
146146
});
147147
} else if (operationType === 'mutation') {
148148
logMutationInfo({ org, mutation: cleanedUpQuery, elapsedMs });

.github/actions/sync-data/src/stats-generator/index.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ async function generateStatsForOrgs({ organizations, paginationLimit = 5 }) {
2121

2222
log.info(
2323
`Generating stats for orgs: [${organizations
24-
.map(o => `${o.org}`)
24+
.map((o) => `${o.org}`)
2525
.join(',')}]`
2626
);
2727

@@ -32,7 +32,7 @@ async function generateStatsForOrgs({ organizations, paginationLimit = 5 }) {
3232
log.magenta(`Fetching all repos for org: ${org}`);
3333
const { repos } = await getAllReposForOrg(github)({
3434
org,
35-
paginationLimit
35+
paginationLimit,
3636
});
3737

3838
log.magenta(`Number of fetched repos: ${repos.length}`);
@@ -72,7 +72,7 @@ async function getProjectsAndExclusions() {
7272

7373
const projectFiles = await fsp.readdir(outputDir);
7474
const projects = await Promise.all(
75-
projectFiles.map(file => getProjectFullName(file, outputDir))
75+
projectFiles.map((file) => getProjectFullName(file, outputDir))
7676
);
7777

7878
log.info(
@@ -90,13 +90,13 @@ async function getProjectsAndExclusions() {
9090
*/
9191
async function generateDiff(results) {
9292
const projectList = await getProjectsAndExclusions();
93-
const repos = results.map(r => r.nameWithOwner);
94-
const missingProjects = repos.filter(r => !projectList.includes(r));
93+
const repos = results.map((r) => r.nameWithOwner);
94+
const missingProjects = repos.filter((r) => !projectList.includes(r));
9595

9696
// also filter on EXCLUDED_PROJECTS since that's included in projectList, but
9797
// we don't want stats for those
9898
const projectsWhereNoStatsGenerated = projectList.filter(
99-
p => !repos.includes(p) && !EXCLUDED_PROJECTS.includes(p)
99+
(p) => !repos.includes(p) && !EXCLUDED_PROJECTS.includes(p)
100100
);
101101

102102
return { missingProjects, projectsWhereNoStatsGenerated };
@@ -114,7 +114,7 @@ async function script() {
114114
// Get all stats data for newrelic and newrelic-experimental orgs
115115
const results = await generateStatsForOrgs({
116116
organizations: ORG_REPOS,
117-
paginationLimit: PAGINATION_LIMIT
117+
paginationLimit: PAGINATION_LIMIT,
118118
});
119119
log.info(`Total fetched repos: ${results.length}`);
120120

@@ -143,5 +143,5 @@ async function script() {
143143
}
144144

145145
module.exports = {
146-
script
146+
script,
147147
};

.github/actions/sync-data/src/stats-generator/lib/log.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ let prefix;
77
const coloredOutput = false;
88

99
const createMsg = (type = '') => (color, ...args) => {
10-
const stringifiedArgs = args.map(arg => {
10+
const stringifiedArgs = args.map((arg) => {
1111
if (arg instanceof Error) {
1212
const remainingProps = R.omit(['message', 'stack'], arg);
1313
return R.isEmpty(remainingProps)
@@ -56,7 +56,7 @@ const log = {
5656
json: (x, { colors = coloredOutput, depth = 4 } = {}) =>
5757
process.env.NODE_ENV === 'production'
5858
? console.log(toJson(x))
59-
: console.log(util.inspect(x, { colors, depth }))
59+
: console.log(util.inspect(x, { colors, depth })),
6060
};
6161
/* eslint-enable no-console */
6262

.github/actions/sync-data/src/stats-generator/lib/ramda-sheep.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,5 @@ module.exports = {
5555
memoize,
5656
findMaxBy,
5757
updateBy,
58-
includesAny
58+
includesAny,
5959
};

.github/actions/sync-data/src/stats-generator/lib/run-script.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ process.env.NODE_ENV = 'script';
55

66
const log = require('./log');
77

8-
const runScript = async scriptFunc => {
8+
const runScript = async (scriptFunc) => {
99
try {
1010
await scriptFunc();
1111
log.green('Script exited.');

.github/actions/sync-data/src/stats-generator/lib/to-json.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ function tryJSONStringify(obj) {
1515
}
1616
}
1717

18-
const toJson = obj => tryJSONStringify(obj) || stringify(obj);
18+
const toJson = (obj) => tryJSONStringify(obj) || stringify(obj);
1919

2020
module.exports = toJson;

.github/actions/sync-data/src/stats-generator/lib/utils.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const R = require('ramda');
44
// hashes string first, allows to map strings to colors
55
// useful in certain UI aspects when color should be the same
66
// given some string, but we don't know strings upfront to define it
7-
const stringToColor = str => {
7+
const stringToColor = (str) => {
88
if (!str) {
99
return '#000000';
1010
}
@@ -21,9 +21,9 @@ const stringToColor = str => {
2121
return colour;
2222
};
2323

24-
const removeNewLines = x => (x ? R.replace(/(\r\n|\n|\r)/gm, '', x) : x);
25-
const removeTabsAndSpaces = x => (x ? R.replace(/[ \t]+/g, ' ', x) : x);
26-
const removeEscapedCharacters = x =>
24+
const removeNewLines = (x) => (x ? R.replace(/(\r\n|\n|\r)/gm, '', x) : x);
25+
const removeTabsAndSpaces = (x) => (x ? R.replace(/[ \t]+/g, ' ', x) : x);
26+
const removeEscapedCharacters = (x) =>
2727
x ? R.replace(/( |\\t|\\n)/g, ' ', x) : x;
2828

2929
const rnd = (min, max) => {
@@ -37,5 +37,5 @@ module.exports = {
3737
removeNewLines,
3838
removeTabsAndSpaces,
3939
stringToColor,
40-
rnd
40+
rnd,
4141
};

0 commit comments

Comments
 (0)