Skip to content

Commit

Permalink
fix: 기존 파일 prettier:fix
Browse files Browse the repository at this point in the history
  • Loading branch information
choisohyun committed Sep 11, 2024
1 parent f18f1d8 commit 1511730
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 65 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# githru-vscode-ext

Lightweight but robust Githru for VSCode Extension

## Getting Started
Expand Down
76 changes: 37 additions & 39 deletions packages/analysis-engine/src/parser.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getCommitMessageType } from "./commit.util";
import getCommitRaws from "./parser";
import getCommitRaws from "./parser";
import type { CommitRaw, DifferenceStatistic } from "./types";

describe("commit message type", () => {
Expand Down Expand Up @@ -34,85 +34,79 @@ describe("commit message type", () => {
});
});

describe('getCommitRaws', () => {
describe("getCommitRaws", () => {
const testCommitLines = [
"commit a b (HEAD)",
"commit a b (HEAD -> main, origin/main, origin/HEAD)",
"commit a b (HEAD, tag: v1.0.0)",
"commit a b (HEAD -> main, origin/main, origin/HEAD, tag: v2.0.0)",
"commit a b (HEAD, tag: v2.0.0, tag: v1.4)"
"commit a b (HEAD, tag: v2.0.0, tag: v1.4)",
];

const expectedBranches = [
['HEAD'],
['HEAD', 'main', 'origin/main', 'origin/HEAD'],
['HEAD'],
['HEAD', 'main', 'origin/main', 'origin/HEAD'],
['HEAD']
["HEAD"],
["HEAD", "main", "origin/main", "origin/HEAD"],
["HEAD"],
["HEAD", "main", "origin/main", "origin/HEAD"],
["HEAD"],
];

const expectedTags = [
[],
[],
['v1.0.0'],
['v2.0.0'],
['v2.0.0', 'v1.4']
];
const expectedTags = [[], [], ["v1.0.0"], ["v2.0.0"], ["v2.0.0", "v1.4"]];

const testCommitFileChanges = [
"10\t0\ta.ts\n1\t0\tREADME.md",
"3\t3\ta.ts",
"4\t0\ta.ts",
"0\t6\ta.ts\n2\t0\tb.ts\n3\t3\tc.ts"
"0\t6\ta.ts\n2\t0\tb.ts\n3\t3\tc.ts",
];

const expectedFileChanged:DifferenceStatistic[] = [
const expectedFileChanged: DifferenceStatistic[] = [
{
totalInsertionCount: 11,
totalDeletionCount: 0,
fileDictionary: {
'a.ts': { insertionCount: 10, deletionCount: 0 },
'README.md': { insertionCount: 1, deletionCount: 0 },
}
"a.ts": { insertionCount: 10, deletionCount: 0 },
"README.md": { insertionCount: 1, deletionCount: 0 },
},
},
{
totalInsertionCount: 3,
totalDeletionCount: 3,
fileDictionary: { 'a.ts': { insertionCount: 3, deletionCount: 3 } }
fileDictionary: { "a.ts": { insertionCount: 3, deletionCount: 3 } },
},
{
totalInsertionCount: 4,
totalDeletionCount: 0,
fileDictionary: { 'a.ts': { insertionCount: 4, deletionCount: 0 } }
fileDictionary: { "a.ts": { insertionCount: 4, deletionCount: 0 } },
},
{
totalInsertionCount: 5,
totalDeletionCount: 9,
fileDictionary: {
'a.ts': { insertionCount: 0, deletionCount: 6 },
'b.ts': { insertionCount: 2, deletionCount: 0 },
'c.ts': { insertionCount: 3, deletionCount: 3 },
}
}
"a.ts": { insertionCount: 0, deletionCount: 6 },
"b.ts": { insertionCount: 2, deletionCount: 0 },
"c.ts": { insertionCount: 3, deletionCount: 3 },
},
},
];

const commonExpectatedResult: CommitRaw={
const commonExpectatedResult: CommitRaw = {
sequence: 0,
id: 'a',
parents: ['b'],
branches: ['HEAD'],
id: "a",
parents: ["b"],
branches: ["HEAD"],
tags: [],
author: { name: 'John Park', email: '[email protected]' },
authorDate: new Date('Sun Sep 4 20:17:59 2022 +0900'),
committer: { name: 'John Park', email: '[email protected]' },
committerDate: new Date('Sun Sep 4 20:17:59 2022 +0900'),
message: 'commit message',
author: { name: "John Park", email: "[email protected]" },
authorDate: new Date("Sun Sep 4 20:17:59 2022 +0900"),
committer: { name: "John Park", email: "[email protected]" },
committerDate: new Date("Sun Sep 4 20:17:59 2022 +0900"),
message: "commit message",
differenceStatistic: {
totalInsertionCount: 0,
totalDeletionCount: 0,
fileDictionary: {},
},
commitMessageType: ""
commitMessageType: "",
};

testCommitLines.forEach((mockLog, index) => {
Expand All @@ -125,8 +119,12 @@ CommitDate: Sun Sep 4 20:17:59 2022 +0900
\n\tcommit message
`;
const result = getCommitRaws(mock);
const expectedResult = { ...commonExpectatedResult, branches: expectedBranches[index], tags: expectedTags[index] };

const expectedResult = {
...commonExpectatedResult,
branches: expectedBranches[index],
tags: expectedTags[index],
};

expect(result).toEqual([expectedResult]);
});
});
Expand Down
15 changes: 8 additions & 7 deletions packages/analysis-engine/src/pluginOctokit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ export class PluginOctokit extends Octokit.plugin(throttling) {
private _getPullRequest = async (pullNumber: number) => {
const { owner, repo } = this;

const pullRequestDetail:PullsListResponseData = await this.rest.pulls.get({
const pullRequestDetail: PullsListResponseData = await this.rest.pulls.get({
owner,
repo,
pull_number: pullNumber,
});

const pullRequestCommits:PullsListCommitsResponseData = await this.rest.pulls.listCommits({
const pullRequestCommits: PullsListCommitsResponseData = await this.rest.pulls.listCommits({
owner,
repo,
pull_number: pullNumber,
Expand All @@ -73,11 +73,12 @@ export class PluginOctokit extends Octokit.plugin(throttling) {
};
};


public getPullRequests = async (): Promise<{
detail: PullsListResponseData,
commitDetails: PullsListCommitsResponseData
}[]> => {
public getPullRequests = async (): Promise<
{
detail: PullsListResponseData;
commitDetails: PullsListCommitsResponseData;
}[]
> => {
const { owner, repo } = this;

const { data } = await this.rest.pulls.list({
Expand Down
8 changes: 4 additions & 4 deletions packages/analysis-engine/src/summary.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { CommitRaw } from "./types";

const apiKey = process.env.GEMENI_API_KEY || '';
const apiKey = process.env.GEMENI_API_KEY || "";
const apiUrl = "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key=";

export async function getSummary(csmNodes: CommitRaw[]) {
const commitMessages = csmNodes.map((csmNode) => csmNode.message.split('\n')[0]).join(', ');
const commitMessages = csmNodes.map((csmNode) => csmNode.message.split("\n")[0]).join(", ");

try {
const response = await fetch(apiUrl + apiKey, {
Expand All @@ -13,7 +13,7 @@ export async function getSummary(csmNodes: CommitRaw[]) {
"Content-Type": "application/json",
},
body: JSON.stringify({
contents: [{parts: [{text: `${prompt} \n${commitMessages}`}]}],
contents: [{ parts: [{ text: `${prompt} \n${commitMessages}` }] }],
}),
});

Expand Down Expand Up @@ -53,4 +53,4 @@ Output format:
- {prefix (if any)}:{commit summary3}
‘’
Commits:`
Commits:`;
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import {
fakeFirstClusterNode,
fakeSecondClusterNode,
fakePrev,
} from "../../../tests/fakeAsset";
import { fakeFirstClusterNode, fakeSecondClusterNode, fakePrev } from "../../../tests/fakeAsset";

import { selectedDataUpdater } from "./VerticalClusterList.util";

const EmptyArrayAddSelectedDataUpdater = selectedDataUpdater(
fakeFirstClusterNode,
0,
);
const EmptyArrayAddSelectedDataUpdater = selectedDataUpdater(fakeFirstClusterNode, 0);
const PrevAddSelectedDataUpdater = selectedDataUpdater(fakeFirstClusterNode, 5);
const RemoveSelectedDataUpdater = selectedDataUpdater(fakeSecondClusterNode, 1);

Expand Down
19 changes: 15 additions & 4 deletions packages/vscode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

Githru-vscode-ext is an extension supporting visual analytics to understand the history of GitHub repositories.

The theoretical basis of the extension is `Githru: Visual Analytics for Understanding Software Development History Through Git Metadata Analysis`(https://ieeexplore.ieee.org/document/9222261).
The theoretical basis of the extension is `Githru: Visual Analytics for Understanding Software Development History Through Git Metadata Analysis`(https://ieeexplore.ieee.org/document/9222261).

## Visualization Features

### Summarized Graph
The straightened graph help users understand the complex GitHub commit graph.

The straightened graph help users understand the complex GitHub commit graph.

### Visual Analytics Components

Visualization components represent statistics for users' interested area.

<!-- ## Requirements
Expand All @@ -19,7 +21,7 @@ If you have any requirements or dependencies, add a section describing those and
<!-- ## Extension Settings
Include if your extension adds any VS Code settings through the `contributes.configuration` extension point.
For example:
This extension contributes the following settings:
Expand All @@ -32,48 +34,57 @@ This extension contributes the following settings:
Calling out known issues can help limit users opening duplicate issues against your extension. -->

## Release Notes

### 0.7.1

- Theme Selector!
- Optimized UI Rendering
- Boost up second Loading

### 0.7.0

- UI enhancement
- Patches for UI bugs

### 0.6.1

- subgraph
- launch one panel only

### 0.6.0

- branch selector
- reset github auth
- error handling for pr/auth
- e2e test

### 0.5.0

- login by github auth
- fix minor ui issues
- author avatar in details
- error handling

### 0.4.0

- app loading ui
- improved internal architecture
- theme color palette

### 0.3.0

- temporal filter by brushing
- refresh
- put avatar in author bar chart
- improved some UX.

### 0.2.0

- New Logo!
- GitHub User Avatar
- GitHub Pull Request Association
- Author Filtering

### 0.1.0

Initial release.
Initial release.
4 changes: 2 additions & 2 deletions packages/vscode/src/setting-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export const setGithubToken = async (secrets: vscode.SecretStorage, newGithubTok
};

export const deleteGithubToken = async (secrets: vscode.SecretStorage) => {
return await secrets.delete(SETTING_PROPERTY_NAMES.GITHUB_TOKEN);
}
return await secrets.delete(SETTING_PROPERTY_NAMES.GITHUB_TOKEN);
};

export const setPrimaryColor = (color: string) => {
const configuration = vscode.workspace.getConfiguration();
Expand Down

0 comments on commit 1511730

Please sign in to comment.