Skip to content

Commit

Permalink
style: update 13 files
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelCurrin committed Aug 24, 2023
1 parent 9d03fa8 commit d654424
Show file tree
Hide file tree
Showing 13 changed files with 225 additions and 225 deletions.
14 changes: 7 additions & 7 deletions src/api/git.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,10 @@ export interface Repository {

getObjectDetails(
treeish: string,
path: string
path: string,
): Promise<{ mode: string; object: string; size: number }>;
detectObjectType(
object: string
object: string,
): Promise<{ mimetype: string; encoding?: string }>;
buffer(ref: string, path: string): Promise<Buffer>;
show(ref: string, path: string): Promise<string>;
Expand Down Expand Up @@ -231,13 +231,13 @@ export interface Repository {
getBranch(name: string): Promise<Branch>;
getBranches(
query: BranchQuery,
cancellationToken?: CancellationToken
cancellationToken?: CancellationToken,
): Promise<Ref[]>;
setBranchUpstream(name: string, upstream: string): Promise<void>;

getRefs(
query: RefQuery,
cancellationToken?: CancellationToken
cancellationToken?: CancellationToken,
): Promise<Ref[]>;

getMergeBase(ref1: string, ref2: string): Promise<string>;
Expand All @@ -259,7 +259,7 @@ export interface Repository {
remoteName?: string,
branchName?: string,
setUpstream?: boolean,
force?: ForcePushMode
force?: ForcePushMode,
): Promise<void>;

blame(path: string): Promise<string>;
Expand Down Expand Up @@ -307,7 +307,7 @@ export interface PushErrorHandler {
repository: Repository,
remote: Remote,
refspec: string,
error: Error & { gitErrorCode: GitErrorCodes }
error: Error & { gitErrorCode: GitErrorCodes },
): Promise<boolean>;
}

Expand Down Expand Up @@ -336,7 +336,7 @@ export interface API {
registerRemoteSourceProvider(provider: RemoteSourceProvider): Disposable;
registerCredentialsProvider(provider: CredentialsProvider): Disposable;
registerPostCommitCommandsProvider(
provider: PostCommitCommandsProvider
provider: PostCommitCommandsProvider,
): Disposable;
registerPushErrorHandler(handler: PushErrorHandler): Disposable;
}
Expand Down
4 changes: 2 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function _validateFoundRepos(git: API) {
*/
async function _handleRepos(
git: API,
sourceControl: vscode.SourceControl
sourceControl: vscode.SourceControl,
): Promise<Repository | false> {
const selectedRepo = git.repositories.find(repository => {
const uri = sourceControl.rootUri;
Expand Down Expand Up @@ -85,7 +85,7 @@ async function _chooseRepoForAutofill(sourceControl?: vscode.SourceControl) {
export function activate(context: vscode.ExtensionContext) {
const disposable = vscode.commands.registerCommand(
"commitMsg.autofill",
_chooseRepoForAutofill
_chooseRepoForAutofill,
);

context.subscriptions.push(disposable);
Expand Down
2 changes: 1 addition & 1 deletion src/generate/convCommit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export class ConventionalCommit {
*/
export function getConventionType(
action: ACTION,
filePath: string
filePath: string,
): CONVENTIONAL_TYPE {
if (action === ACTION.R || action === ACTION.D) {
return CONVENTIONAL_TYPE.CHORE;
Expand Down
4 changes: 2 additions & 2 deletions src/git/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function _execute(cwd: string, subcommand: string, options: string[] = []) {
*/
async function _diffIndex(
repository: Repository,
options: string[] = []
options: string[] = [],
): Promise<Array<string>> {
const cwd = repository.rootUri.fsPath;
const cmd = "diff-index";
Expand Down Expand Up @@ -77,7 +77,7 @@ export async function getChanges(repository: Repository) {
}

console.debug(
"Staging area is empty. Using unstaged files (tracked files only still)."
"Staging area is empty. Using unstaged files (tracked files only still).",
);

const allChanges = await _diffIndex(repository);
Expand Down
4 changes: 2 additions & 2 deletions src/git/parseOutput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const GIT_STATUS_SPLIT = " -> ";
export function parseStatus(line: string): FileChange {
if (line.length <= 4) {
throw new Error(
`Input string must be at least 4 characters. Got: '${line}'`
`Input string must be at least 4 characters. Got: '${line}'`,
);
}
const x = line[0];
Expand Down Expand Up @@ -56,7 +56,7 @@ export function parseStatus(line: string): FileChange {
export function parseDiffIndex(line: string): FileChange {
if (line.length <= 4) {
throw new Error(
`Invalid input. Input string must be at least 4 characters. Got: '${line}'`
`Invalid input. Input string must be at least 4 characters. Got: '${line}'`,
);
}
const x = line[0];
Expand Down
2 changes: 1 addition & 1 deletion src/lib/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export function humanList(paths: string[]) {
*/
export function moveOrRenameFromPaths(
oldP: SplitPathResult,
newP: SplitPathResult
newP: SplitPathResult,
) {
let result: MoveOrRename;

Expand Down
8 changes: 4 additions & 4 deletions src/prepareCommitMsg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export function _newMsg(lines: string[]) {
*/
export function _joinOldAndNew(
autoMsgPieces: ConvCommitMsg,
oldMsgPieces: MsgPieces
oldMsgPieces: MsgPieces,
): string {
let typePrefix = "";

Expand All @@ -205,7 +205,7 @@ export function _joinOldAndNew(

const descResult = _joinWithSpace(
autoMsgPieces.description,
oldMsgPieces.description
oldMsgPieces.description,
);

if (!typePrefix) {
Expand Down Expand Up @@ -239,7 +239,7 @@ export function _joinOldAndNew(
export function _combineOldAndNew(
autoType: CONVENTIONAL_TYPE,
autoDesc: string,
oldMsg: string
oldMsg: string,
): string {
if (!oldMsg) {
const autoCommitMsg: ConvCommitMsg = {
Expand Down Expand Up @@ -273,7 +273,7 @@ export function _combineOldAndNew(
export function _generateMsgWithOld(lines: string[], oldMsg: string) {
if (oldMsg === "") {
throw new Error(
"`oldMsg` must be non-empty here, or use `generateNewMsg` instead."
"`oldMsg` must be non-empty here, or use `generateNewMsg` instead.",
);
}
const { typePrefix, description } = _msgFromChanges(lines);
Expand Down
22 changes: 11 additions & 11 deletions src/test/generate/action.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,63 +37,63 @@ describe("Desribe a file using two paths", function () {
it("can describe a renamed file", function () {
assert.strictEqual(
moveOrRenameMsg("foo.txt", "bar.txt"),
"rename foo.txt to bar.txt"
"rename foo.txt to bar.txt",
);

assert.strictEqual(
moveOrRenameMsg("buzz/foo.txt", "buzz/bar.txt"),
"rename foo.txt to bar.txt"
"rename foo.txt to bar.txt",
);

assert.strictEqual(
moveOrRenameMsg("fizz buzz/foo.txt", "fizz buzz/bar.txt"),
"rename foo.txt to bar.txt"
"rename foo.txt to bar.txt",
);
});

it("can describe a moved file", function () {
assert.strictEqual(
moveOrRenameMsg("buzz/foo.txt", "fizz/foo.txt"),
"move foo.txt to fizz"
"move foo.txt to fizz",
);

assert.strictEqual(
moveOrRenameMsg("buzz/foo bar.txt", "fizz/foo bar.txt"),
"move 'foo bar.txt' to fizz"
"move 'foo bar.txt' to fizz",
);

assert.strictEqual(
moveOrRenameMsg("buzz/foo.txt", "foo.txt"),
"move foo.txt to repo root"
"move foo.txt to repo root",
);

assert.strictEqual(
moveOrRenameMsg("buzz/foo bar.txt", "foo bar.txt"),
"move 'foo bar.txt' to repo root"
"move 'foo bar.txt' to repo root",
);
});

it("can describe a remamed and moved file", function () {
assert.strictEqual(
moveOrRenameMsg("foo.txt", "fizz/bar.txt"),
"move and rename foo.txt to fizz/bar.txt"
"move and rename foo.txt to fizz/bar.txt",
);

// This is a rare case, so don't bother trying to handle it smarter around
// paths.
assert.strictEqual(
moveOrRenameMsg("fuzz/foo.txt", "fizz/bar.txt"),
"move and rename foo.txt to fizz/bar.txt"
"move and rename foo.txt to fizz/bar.txt",
);

assert.strictEqual(
moveOrRenameMsg("fuzz/foo.txt", "fizz/bar bazz.txt"),
"move and rename foo.txt to 'fizz/bar bazz.txt'"
"move and rename foo.txt to 'fizz/bar bazz.txt'",
);

assert.strictEqual(
moveOrRenameMsg("fizz/foo.txt", "bar.txt"),
"move and rename foo.txt to bar.txt at repo root"
"move and rename foo.txt to bar.txt at repo root",
);
});
});
Expand Down
Loading

0 comments on commit d654424

Please sign in to comment.