Skip to content

Commit abfdc8f

Browse files
committed
solved linter issues
1 parent 0363d83 commit abfdc8f

File tree

5 files changed

+58
-58
lines changed

5 files changed

+58
-58
lines changed

codegens/golang/lib/index.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var _ = require('./lodash'),
1313
* @param {Object} body Raw body data
1414
* @param {boolean} trim trim body option
1515
*/
16-
function parseRawBody(body, trim) {
16+
function parseRawBody (body, trim) {
1717
var bodySnippet;
1818
bodySnippet = `payload := strings.NewReader(\`${sanitizeMultiline(body.toString(), trim)}\`)`;
1919
return bodySnippet;
@@ -25,7 +25,7 @@ function parseRawBody(body, trim) {
2525
* @param {Object} body Raw body data
2626
* @param {boolean} trim trim body option
2727
*/
28-
function parseGraphQL(body, trim) {
28+
function parseGraphQL (body, trim) {
2929
let query = body.query,
3030
graphqlVariables,
3131
bodySnippet;
@@ -48,7 +48,7 @@ function parseGraphQL(body, trim) {
4848
* @param {Object} body URLEncoded Body
4949
* @param {boolean} trim trim body option
5050
*/
51-
function parseURLEncodedBody(body, trim) {
51+
function parseURLEncodedBody (body, trim) {
5252
var payload, bodySnippet;
5353
payload = _.reduce(body, function (accumulator, data) {
5454
if (!data.disabled) {
@@ -68,7 +68,7 @@ function parseURLEncodedBody(body, trim) {
6868
* @param {boolean} trim trim body option
6969
* @param {string} indent indent string
7070
*/
71-
function parseFormData(body, trim, indent) {
71+
function parseFormData (body, trim, indent) {
7272
var bodySnippet = `payload := &bytes.Buffer{}\n${indent}writer := multipart.NewWriter(payload)\n`;
7373
_.forEach(body, function (data, index) {
7474
if (!data.disabled) {
@@ -101,16 +101,16 @@ function parseFormData(body, trim, indent) {
101101
}
102102
});
103103
bodySnippet += `${indent}err := writer.Close()\n${indent}if err != nil ` +
104-
`{\n${indent.repeat(2)}fmt.Println(err)\n` +
105-
`${indent.repeat(2)}return\n${indent}}\n`;
104+
`{\n${indent.repeat(2)}fmt.Println(err)\n` +
105+
`${indent.repeat(2)}return\n${indent}}\n`;
106106
return bodySnippet;
107107
}
108108

109109
/**
110110
* Parses file body from the Request
111111
*
112112
*/
113-
function parseFile() {
113+
function parseFile () {
114114
// var bodySnippet = `payload := &bytes.Buffer{}\n${indent}writer := multipart.NewWriter(payload)\n`;
115115
// isFile = true;
116116
// bodySnippet += `${indent}// add your file name in the next statement in place of path\n`;
@@ -130,7 +130,7 @@ function parseFile() {
130130
* @param {boolean} trim trim body option
131131
* @param {string} indent indent string
132132
*/
133-
function parseBody(body, trim, indent) {
133+
function parseBody (body, trim, indent) {
134134
if (!_.isEmpty(body)) {
135135
switch (body.mode) {
136136
case 'urlencoded':
@@ -156,7 +156,7 @@ function parseBody(body, trim, indent) {
156156
* @param {Object} headers headers from the request.
157157
* @param {string} indent indent string
158158
*/
159-
function parseHeaders(headers, indent) {
159+
function parseHeaders (headers, indent) {
160160
var headerSnippet = '';
161161
if (!_.isEmpty(headers)) {
162162
headers = _.reject(headers, 'disabled');

codegens/js-xhr/lib/index.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var _ = require('./lodash'),
1010
*
1111
* @param {*} body URLEncoded Body
1212
*/
13-
function parseURLEncodedBody(body) {
13+
function parseURLEncodedBody (body) {
1414
var payload = [],
1515
bodySnippet;
1616
_.forEach(body, function (data) {
@@ -29,7 +29,7 @@ function parseURLEncodedBody(body) {
2929
* @param {*} trim trim body option
3030
* @param {String} contentType Content type of the body being sent
3131
*/
32-
function parseRawBody(body, trim, contentType) {
32+
function parseRawBody (body, trim, contentType) {
3333
var bodySnippet = 'var data = ';
3434
// Match any application type whose underlying structure is json
3535
// For example application/vnd.api+json
@@ -56,7 +56,7 @@ function parseRawBody(body, trim, contentType) {
5656
* @param {boolean} trim trim body option
5757
* @param {String} indentString indentation to be added to the snippet
5858
*/
59-
function parseGraphQL(body, trim, indentString) {
59+
function parseGraphQL (body, trim, indentString) {
6060
let query = body.query,
6161
graphqlVariables,
6262
bodySnippet;
@@ -79,7 +79,7 @@ function parseGraphQL(body, trim, indentString) {
7979
* @param {*} body formData Body
8080
* @param {*} trim trim body option
8181
*/
82-
function parseFormData(body, trim) {
82+
function parseFormData (body, trim) {
8383
var bodySnippet = 'var data = new FormData();\n';
8484
_.forEach(body, (data) => {
8585
if (!(data.disabled)) {
@@ -104,7 +104,7 @@ function parseFormData(body, trim) {
104104
* Parses file body from the Request
105105
*
106106
*/
107-
function parseFile() {
107+
function parseFile () {
108108
// var bodySnippet = 'var data = new FormData();\n';
109109
// bodySnippet += `data.append("${sanitize(body.key, trim)}", "${sanitize(body.src, trim)}", `;
110110
// bodySnippet += `"${sanitize(body.key, trim)}");\n`;
@@ -120,7 +120,7 @@ function parseFile() {
120120
* @param {String} indentString indentation to be added to the snippet
121121
* @param {String} contentType Content type of the body being sent
122122
*/
123-
function parseBody(body, trim, indentString, contentType) {
123+
function parseBody (body, trim, indentString, contentType) {
124124
if (!_.isEmpty(body)) {
125125
switch (body.mode) {
126126
case 'urlencoded':
@@ -145,7 +145,7 @@ function parseBody(body, trim, indentString, contentType) {
145145
*
146146
* @param {Object} headers headers from the request.
147147
*/
148-
function parseHeaders(headers) {
148+
function parseHeaders (headers) {
149149
var headerSnippet = '';
150150
if (!_.isEmpty(headers)) {
151151
headers = _.reject(headers, 'disabled');
@@ -161,7 +161,7 @@ function parseHeaders(headers) {
161161
*
162162
* @returns {Array} - Returns an array of option objects
163163
*/
164-
function getOptions() {
164+
function getOptions () {
165165
return [
166166
{
167167
name: 'Set indentation count',
@@ -184,7 +184,7 @@ function getOptions() {
184184
type: 'positiveInteger',
185185
default: 0,
186186
description: 'Set number of milliseconds the request should wait for a response' +
187-
' before timing out (use 0 for infinity)'
187+
' before timing out (use 0 for infinity)'
188188
},
189189
{
190190
name: 'Trim request body fields',
@@ -206,7 +206,7 @@ function getOptions() {
206206
* @param {Number} options.requestTimeout : time in milli-seconds after which request will bail out
207207
* @param {Function} callback - callback function with parameters (error, snippet)
208208
*/
209-
function convert(request, options, callback) {
209+
function convert (request, options, callback) {
210210

211211
if (!_.isFunction(callback)) {
212212
throw new Error('JS-XHR-Converter: callback is not valid function');

codegens/objective-c/lib/index.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ var _ = require('./lodash'),
1212
* @param {String} indent indentation required for code snippet
1313
* @param {Boolean} trim indicates whether to trim string or not
1414
*/
15-
function parseRawBody(body, indent, trim) {
15+
function parseRawBody (body, indent, trim) {
1616
var bodySnippet = '';
1717
bodySnippet += 'NSData *postData = [[NSData alloc] initWithData:[@"' + sanitize(body.toString(), trim) + '" ' +
18-
'dataUsingEncoding:NSUTF8StringEncoding]];\n';
18+
'dataUsingEncoding:NSUTF8StringEncoding]];\n';
1919
bodySnippet += '[request setHTTPBody:postData];\n';
2020
return bodySnippet;
2121
}
@@ -27,11 +27,11 @@ function parseRawBody(body, indent, trim) {
2727
* @param {String} indent indentation required for code snippet
2828
* @param {Boolean} trim indicates whether to trim string or not
2929
*/
30-
function parseGraphQLBody(body, indent, trim) {
30+
function parseGraphQLBody (body, indent, trim) {
3131
var bodySnippet = '',
3232
rawBody = JSON.stringify(body);
3333
bodySnippet += 'NSData *postData = [[NSData alloc] initWithData:[@"' + sanitize(rawBody, trim) + '" ' +
34-
'dataUsingEncoding:NSUTF8StringEncoding]];\n';
34+
'dataUsingEncoding:NSUTF8StringEncoding]];\n';
3535
bodySnippet += '[request setHTTPBody:postData];\n';
3636
return bodySnippet;
3737
}
@@ -43,7 +43,7 @@ function parseGraphQLBody(body, indent, trim) {
4343
* @param {String} indent indentation required for code snippet
4444
* @param {Boolean} trim indicates whether to trim string or not
4545
*/
46-
function parseURLEncodedBody(body, indent, trim) {
46+
function parseURLEncodedBody (body, indent, trim) {
4747
let bodySnippet = '',
4848
key,
4949
value,
@@ -54,11 +54,11 @@ function parseURLEncodedBody(body, indent, trim) {
5454
value = trim ? data.value.trim() : data.value;
5555
if (first) {
5656
bodySnippet += 'NSMutableData *postData = [[NSMutableData alloc] initWithData:[@"' +
57-
sanitize(key, true) + '=' + sanitize(value, trim) + '" dataUsingEncoding:NSUTF8StringEncoding]];\n';
57+
sanitize(key, true) + '=' + sanitize(value, trim) + '" dataUsingEncoding:NSUTF8StringEncoding]];\n';
5858
}
5959
else {
6060
bodySnippet += '[postData appendData:[@"&' + sanitize(key, true) + '=' + sanitize(value, trim) +
61-
'" dataUsingEncoding:NSUTF8StringEncoding]];\n';
61+
'" dataUsingEncoding:NSUTF8StringEncoding]];\n';
6262
}
6363
first = false;
6464
}
@@ -74,7 +74,7 @@ function parseURLEncodedBody(body, indent, trim) {
7474
* @param {String} indent indentation required for code snippet
7575
* @param {Boolean} trim indicates whether to trim string or not
7676
*/
77-
function parseFormData(body, indent, trim) {
77+
function parseFormData (body, indent, trim) {
7878
let bodySnippet = '',
7979
formDataArray = [],
8080
key,
@@ -143,7 +143,7 @@ function parseFormData(body, indent, trim) {
143143
* @param {String} indent indentation required for code snippet
144144
* @param {trim} trim indicates whether to trim string or not
145145
*/
146-
function parseBody(body, indent, trim) {
146+
function parseBody (body, indent, trim) {
147147
if (!_.isEmpty(body)) {
148148
switch (body.mode) {
149149
case 'urlencoded':
@@ -170,7 +170,7 @@ function parseBody(body, indent, trim) {
170170
* @param {String} indent indentation required for code snippet
171171
* @param {Boolean} trim indicates whether to trim string or not
172172
*/
173-
function parseHeaders(headersArray, indent, trim) {
173+
function parseHeaders (headersArray, indent, trim) {
174174
var headerString = '',
175175
headerDictionary = [];
176176
if (_.isEmpty(headersArray)) {
@@ -298,7 +298,7 @@ self = module.exports = {
298298

299299
// if boilerplate is included then two more indent needs to be added in snippet
300300
(options.includeBoilerplate) &&
301-
(codeSnippet = indent + codeSnippet.split('\n').join('\n' + indent) + '\n');
301+
(codeSnippet = indent + codeSnippet.split('\n').join('\n' + indent) + '\n');
302302

303303
callback(null, headerSnippet + codeSnippet + footerSnippet);
304304
},
@@ -327,7 +327,7 @@ self = module.exports = {
327327
// TODO: Find out a way to set infinite timeout.
328328
default: 10000,
329329
description: 'Set number of milliseconds the request should wait for a response' +
330-
' before timing out (use 0 for infinity)'
330+
' before timing out (use 0 for infinity)'
331331
},
332332
{
333333
name: 'Trim request body fields',

codegens/ocaml-cohttp/lib/ocaml.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var _ = require('./lodash'),
1313
* @param {boolean} trim - trim body option
1414
* @returns {String} request body in the desired format
1515
*/
16-
function parseRawBody(body, mode, trim) {
16+
function parseRawBody (body, mode, trim) {
1717
var bodySnippet;
1818
bodySnippet = `let postData = ref ${sanitize(body, mode, trim)};;\n\n`;
1919
return bodySnippet;
@@ -27,7 +27,7 @@ function parseRawBody(body, mode, trim) {
2727
* @param {boolean} trim - trim body option
2828
* @returns {String} request body in the desired format
2929
*/
30-
function parseGraphQL(body, mode, trim) {
30+
function parseGraphQL (body, mode, trim) {
3131
let query = body.query,
3232
graphqlVariables,
3333
bodySnippet;
@@ -52,7 +52,7 @@ function parseGraphQL(body, mode, trim) {
5252
* @param {boolean} trim - trim body option
5353
* @returns {String} request body in the desired format
5454
*/
55-
function parseURLEncodedBody(body, mode, trim) {
55+
function parseURLEncodedBody (body, mode, trim) {
5656
var payload, bodySnippet;
5757
payload = _.reduce(body, function (accumulator, data) {
5858
if (!data.disabled) {
@@ -73,24 +73,24 @@ function parseURLEncodedBody(body, mode, trim) {
7373
* @param {String} indent - indentation string
7474
* @returns {String} request body in the desired format
7575
*/
76-
function parseFormData(body, trim, indent) {
76+
function parseFormData (body, trim, indent) {
7777
var parameters = '[|\n' + _.reduce(body, (accumalator, data) => {
78-
if (!data.disabled || data.disabled === false) {
79-
const key = sanitize(data.key, 'formdata-key', trim);
78+
if (!data.disabled || data.disabled === false) {
79+
const key = sanitize(data.key, 'formdata-key', trim);
8080

81-
if (data.type === 'file') {
82-
const filename = data.src;
83-
accumalator.push(`${indent}[| ("name", "${key}"); ("fileName", "${filename}") |]`);
84-
}
85-
else {
86-
const value = sanitize(data.value, 'formdata-value', trim);
87-
accumalator.push(`${indent}[| ("name", "${key}"); ("value", "${value}")` +
88-
(data.contentType ? `; ("contentType", "${data.contentType}")` : '') +
89-
' |]');
81+
if (data.type === 'file') {
82+
const filename = data.src;
83+
accumalator.push(`${indent}[| ("name", "${key}"); ("fileName", "${filename}") |]`);
84+
}
85+
else {
86+
const value = sanitize(data.value, 'formdata-value', trim);
87+
accumalator.push(`${indent}[| ("name", "${key}"); ("value", "${value}")` +
88+
(data.contentType ? `; ("contentType", "${data.contentType}")` : '') +
89+
' |]');
90+
}
9091
}
91-
}
92-
return accumalator;
93-
}, []).join(';\n') + '\n|];;',
92+
return accumalator;
93+
}, []).join(';\n') + '\n|];;',
9494
bodySnippet = '';
9595

9696
bodySnippet = `let parameters = ${parameters}\n`;
@@ -129,7 +129,7 @@ function parseFormData(body, trim, indent) {
129129
*
130130
* @returns {String} request body in the desired format
131131
*/
132-
function parseFile() {
132+
function parseFile () {
133133
// var bodySnippet = 'let load_file f =\n';
134134
// bodySnippet += `${indent}let ic = open_in f in\n`;
135135
// bodySnippet += `${indent}let n = in_channel_length ic in\n`;
@@ -150,7 +150,7 @@ function parseFile() {
150150
* @param {String} indent - indentation string
151151
* @returns {String} utility function for getting request body in the desired format
152152
*/
153-
function parseBody(body, trim, indent) {
153+
function parseBody (body, trim, indent) {
154154
if (!_.isEmpty(body) && (!_.isEmpty(body[body.mode]))) {
155155
switch (body.mode) {
156156
case 'urlencoded':
@@ -161,7 +161,7 @@ function parseBody(body, trim, indent) {
161161
return parseGraphQL(body.graphql, 'raw', trim);
162162
case 'formdata':
163163
return parseFormData(body.formdata, trim, indent);
164-
/* istanbul ignore next */
164+
/* istanbul ignore next */
165165
case 'file':
166166
return parseFile(indent);
167167
default:
@@ -179,7 +179,7 @@ function parseBody(body, trim, indent) {
179179
* @param {String} indent - indent indent string
180180
* @returns {String} request headers in the desired format
181181
*/
182-
function parseHeaders(bodyMode, headers, indent) {
182+
function parseHeaders (bodyMode, headers, indent) {
183183
var headerSnippet = '';
184184
if (!_.isEmpty(headers)) {
185185
headers = _.reject(headers, 'disabled');
@@ -205,7 +205,7 @@ function parseHeaders(bodyMode, headers, indent) {
205205
* @param {String} method - method type of request
206206
* @returns {String} Method argument for ocaml call function
207207
*/
208-
function getMethodArg(method) {
208+
function getMethodArg (method) {
209209
var methodArg = '',
210210
supportedMethods = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD'],
211211
flag = false;
@@ -263,7 +263,7 @@ self = module.exports = {
263263
type: 'positiveInteger',
264264
default: 0,
265265
description: 'Set number of milliseconds the request should wait for a response' +
266-
' before timing out (use 0 for infinity)'
266+
' before timing out (use 0 for infinity)'
267267
},
268268
{
269269
name: 'Follow redirects',

0 commit comments

Comments
 (0)