Skip to content

Commit 4f7b4a5

Browse files
committed
chore: run autoformatter
1 parent 2a85784 commit 4f7b4a5

File tree

3 files changed

+27
-28
lines changed

3 files changed

+27
-28
lines changed

lib/updaters/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function getUpdaterByFilename(filename) {
4343
return getUpdaterByType('yaml');
4444
}
4545
if (/pyproject.toml/.test(filename)) {
46-
return getUpdaterByType('python')
46+
return getUpdaterByType('python');
4747
}
4848
throw Error(
4949
`Unsupported file (${filename}) provided for bumping.\n Please specify the updater \`type\` or use a custom \`updater\`.`,

lib/updaters/types/python.js

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
const versionExtractRegex = /version[" ]*=[ ]*["'](.*)["']/i
1+
const versionExtractRegex = /version[" ]*=[ ]*["'](.*)["']/i;
22

33
const getVersionIndex = function (lines) {
4-
let version
5-
const lineNumber = lines.findIndex(line => {
6-
const versionMatcher = line.match(versionExtractRegex)
4+
let version;
5+
const lineNumber = lines.findIndex((line) => {
6+
const versionMatcher = line.match(versionExtractRegex);
77
// if version not found in lines provided, return false
88
if (versionMatcher == null) {
9-
return false
9+
return false;
1010
}
11-
version = versionMatcher[1]
12-
return true
13-
})
14-
return { version, lineNumber }
15-
}
11+
version = versionMatcher[1];
12+
return true;
13+
});
14+
return { version, lineNumber };
15+
};
1616

1717
module.exports.readVersion = function (contents) {
18-
const lines = contents.split('\n')
19-
const versionIndex = getVersionIndex(lines)
20-
return versionIndex.version
21-
}
18+
const lines = contents.split('\n');
19+
const versionIndex = getVersionIndex(lines);
20+
return versionIndex.version;
21+
};
2222

2323
module.exports.writeVersion = function (contents, version) {
24-
const lines = contents.split('\n')
25-
const versionIndex = getVersionIndex(lines)
26-
const versionLine = lines[versionIndex.lineNumber]
27-
const newVersionLine = versionLine.replace(versionIndex.version, version)
28-
lines[versionIndex.lineNumber] = newVersionLine
29-
return lines.join('\n')
30-
}
24+
const lines = contents.split('\n');
25+
const versionIndex = getVersionIndex(lines);
26+
const versionLine = lines[versionIndex.lineNumber];
27+
const newVersionLine = versionLine.replace(versionIndex.version, version);
28+
lines[versionIndex.lineNumber] = newVersionLine;
29+
return lines.join('\n');
30+
};

test/core.spec.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -1136,7 +1136,7 @@ describe('cli', function () {
11361136
'./test/mocks/pyproject-1.1.0.toml',
11371137
'utf-8',
11381138
);
1139-
1139+
11401140
const filename = 'python.toml';
11411141
mock({
11421142
bump: 'minor',
@@ -1147,26 +1147,25 @@ describe('cli', function () {
11471147
},
11481148
],
11491149
});
1150-
1150+
11511151
await exec({
11521152
packageFiles: [{ filename, type: 'python' }],
11531153
bumpFiles: [{ filename, type: 'python' }],
11541154
});
1155-
1155+
11561156
// filePath is the first arg passed to writeFileSync
11571157
const packageJsonWriteFileSynchCall = findWriteFileCallForPath({
11581158
writeFileSyncSpy,
11591159
filename,
11601160
});
1161-
1161+
11621162
if (!packageJsonWriteFileSynchCall) {
11631163
throw new Error(`writeFileSynch not invoked with path ${filename}`);
11641164
}
1165-
1165+
11661166
const calledWithContentStr = packageJsonWriteFileSynchCall[1];
11671167
expect(calledWithContentStr).toEqual(expected);
11681168
});
1169-
11701169
});
11711170

11721171
it('`packageFiles` are bumped along with `bumpFiles` defaults [commit-and-tag-version#533]', async function () {

0 commit comments

Comments
 (0)