Skip to content

Commit b87fe94

Browse files
authored
Remove most recent commit information and sorting (#2637)
1 parent 8f99ed2 commit b87fe94

File tree

10 files changed

+3
-186
lines changed

10 files changed

+3
-186
lines changed

docs/test-plan.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,6 @@ This requires running a MRVA query and seeing the results view.
318318
1. Alphabetically
319319
2. By number of results
320320
3. By popularity
321-
4. By most recent commit
322321
9. Can filter repos
323322
10. Shows correct statistics
324323
1. Total number of results

extensions/ql-vscode/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## [UNRELEASED]
44

5+
- Remove "last updated" information and sorting from variant analysis results view. [#2637](https://github.com/github/vscode-codeql/pull/2637)
56
- Links to code on GitHub now include column numbers as well as line numbers. [#2406](https://github.com/github/vscode-codeql/pull/2406)
67
- No longer highlight trailing commas for jump to definition. [#2615](https://github.com/github/vscode-codeql/pull/2615)
78

extensions/ql-vscode/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,11 @@
350350
"enum": [
351351
"alphabetically",
352352
"popularity",
353-
"mostRecentCommit",
354353
"numberOfResults"
355354
],
356355
"enumDescriptions": [
357356
"Sort repositories alphabetically in the results view.",
358357
"Sort repositories by popularity in the results view.",
359-
"Sort repositories by most recent commit in the results view.",
360358
"Sort repositories by number of results in the results view."
361359
],
362360
"description": "The default sorting order for repositories in the variant analysis results view."

extensions/ql-vscode/src/stories/common/LastUpdated.stories.tsx

Lines changed: 0 additions & 20 deletions
This file was deleted.

extensions/ql-vscode/src/variant-analysis/shared/variant-analysis-filter-sort.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Repository, RepositoryWithMetadata } from "./repository";
2-
import { parseDate } from "../../common/date";
32
import { assertNever } from "../../common/helpers-pure";
43

54
export enum FilterKey {
@@ -10,7 +9,6 @@ export enum FilterKey {
109
export enum SortKey {
1110
Alphabetically = "alphabetically",
1211
Popularity = "popularity",
13-
MostRecentCommit = "mostRecentCommit",
1412
NumberOfResults = "numberOfResults",
1513
}
1614

@@ -81,16 +79,6 @@ export function compareRepository(
8179
}
8280
}
8381

84-
// Newest to oldest
85-
if (filterSortState?.sortKey === SortKey.MostRecentCommit) {
86-
const lastUpdated =
87-
(parseDate(right.updatedAt)?.getTime() ?? 0) -
88-
(parseDate(left.updatedAt)?.getTime() ?? 0);
89-
if (lastUpdated !== 0) {
90-
return lastUpdated;
91-
}
92-
}
93-
9482
// Fall back on name compare. Use en-US because the repository name does not contain
9583
// special characters due to restrictions in GitHub owner/repository names.
9684
return left.fullName.localeCompare(right.fullName, "en-US", {

extensions/ql-vscode/src/view/common/LastUpdated.tsx

Lines changed: 0 additions & 42 deletions
This file was deleted.

extensions/ql-vscode/src/view/variant-analysis/RepoRow.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import {
2424
import { vscode } from "../vscode-api";
2525
import { AnalyzedRepoItemContent } from "./AnalyzedRepoItemContent";
2626
import StarCount from "../common/StarCount";
27-
import { LastUpdated } from "../common/LastUpdated";
2827
import { useTelemetryOnChange } from "../common/telemetry";
2928
import { DeterminateProgressRing } from "../common/DeterminateProgressRing";
3029

@@ -297,7 +296,6 @@ export const RepoRow = ({
297296
<div>
298297
<StarCount starCount={repository.stargazersCount} />
299298
</div>
300-
<LastUpdated lastUpdated={repository.updatedAt} />
301299
</MetadataContainer>
302300
</TitleContainer>
303301
{isExpanded && expandableContentLoaded && (

extensions/ql-vscode/src/view/variant-analysis/RepositoriesSort.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ export const RepositoriesSort = ({ value, onChange, className }: Props) => {
3434
Number of results
3535
</VSCodeOption>
3636
<VSCodeOption value={SortKey.Popularity}>Popularity</VSCodeOption>
37-
<VSCodeOption value={SortKey.MostRecentCommit}>
38-
Most recent commit
39-
</VSCodeOption>
4037
</Dropdown>
4138
);
4239
};

extensions/ql-vscode/src/view/variant-analysis/__tests__/RepoRow.spec.tsx

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ describe(RepoRow.name, () => {
3838
expect(
3939
screen.queryByRole("img", {
4040
// There should not be any icons, except for the icons which are always shown
41-
name: (name) =>
42-
!["expand", "stars count", "most recent commit"].includes(
43-
name.toLowerCase(),
44-
),
41+
name: (name) => !["expand", "stars count"].includes(name.toLowerCase()),
4542
}),
4643
).not.toBeInTheDocument();
4744

@@ -279,26 +276,7 @@ describe(RepoRow.name, () => {
279276
).toBeInTheDocument();
280277
});
281278

282-
it("shows updated at", () => {
283-
render({
284-
repository: {
285-
...createMockRepositoryWithMetadata(),
286-
// 1 month ago
287-
updatedAt: new Date(
288-
Date.now() - 1000 * 60 * 60 * 24 * 30,
289-
).toISOString(),
290-
},
291-
});
292-
293-
expect(screen.getByText("last month")).toBeInTheDocument();
294-
expect(
295-
screen.getByRole("img", {
296-
name: "Most recent commit",
297-
}),
298-
).toBeInTheDocument();
299-
});
300-
301-
it("does not show star count and updated at when unknown", () => {
279+
it("does not show star count when unknown", () => {
302280
render({
303281
repository: {
304282
id: undefined,
@@ -312,11 +290,6 @@ describe(RepoRow.name, () => {
312290
name: "Stars count",
313291
}),
314292
).not.toBeInTheDocument();
315-
expect(
316-
screen.queryByRole("img", {
317-
name: "Most recent commit",
318-
}),
319-
).not.toBeInTheDocument();
320293
});
321294

322295
it("can expand the repo item", async () => {

extensions/ql-vscode/test/unit-tests/variant-analysis-filter-sort.test.ts

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -204,55 +204,6 @@ describe(compareRepository.name, () => {
204204
).toBeLessThan(0);
205205
});
206206
});
207-
208-
describe("when sort key is 'Most recent commit'", () => {
209-
const sorter = compareRepository({
210-
...permissiveFilterSortState,
211-
sortKey: SortKey.MostRecentCommit,
212-
});
213-
214-
const left = {
215-
fullName: "github/galaxy",
216-
updatedAt: "2020-01-01T00:00:00Z",
217-
};
218-
const right = {
219-
fullName: "github/world",
220-
updatedAt: "2021-01-01T00:00:00Z",
221-
};
222-
223-
it("compares correctly", () => {
224-
expect(sorter(left, right)).toBeGreaterThan(0);
225-
});
226-
227-
it("compares the inverse correctly", () => {
228-
expect(sorter(right, left)).toBeLessThan(0);
229-
});
230-
231-
it("compares equal values correctly", () => {
232-
expect(sorter(left, left)).toBe(0);
233-
});
234-
235-
it("compares equal single values correctly", () => {
236-
expect(
237-
sorter(left, {
238-
...right,
239-
updatedAt: left.updatedAt,
240-
}),
241-
).toBeLessThan(0);
242-
});
243-
244-
it("compares missing single values correctly", () => {
245-
expect(
246-
sorter(
247-
{
248-
...left,
249-
updatedAt: undefined,
250-
},
251-
right,
252-
),
253-
).toBeGreaterThan(0);
254-
});
255-
});
256207
});
257208

258209
describe(compareWithResults.name, () => {
@@ -303,32 +254,6 @@ describe(compareWithResults.name, () => {
303254
});
304255
});
305256

306-
describe("when sort key is 'Most recent commit'", () => {
307-
const sorter = compareWithResults({
308-
...permissiveFilterSortState,
309-
sortKey: SortKey.MostRecentCommit,
310-
});
311-
312-
const left = {
313-
repository: {
314-
id: 11,
315-
fullName: "github/galaxy",
316-
updatedAt: "2020-01-01T00:00:00Z",
317-
},
318-
};
319-
const right = {
320-
repository: {
321-
id: 12,
322-
fullName: "github/world",
323-
updatedAt: "2021-01-01T00:00:00Z",
324-
},
325-
};
326-
327-
it("compares correctly", () => {
328-
expect(sorter(left, right)).toBeGreaterThan(0);
329-
});
330-
});
331-
332257
describe("when sort key is results count", () => {
333258
const sorter = compareWithResults({
334259
...permissiveFilterSortState,

0 commit comments

Comments
 (0)