mirror of
https://github.com/status-im/sourcecred.git
synced 2025-01-13 06:05:22 +00:00
Disable the Git plugin
This commit disables the Git plugin by removing it from the default list of plugins to load, or to display in the frontend. Rationale: The git plugin doesn't currently add very much to cred quality. Git commits have edges to their parent, which isn't a very meaningful relationship for cred purposes. We'll want to re-enable the Git plugin once we're ready to support e.g. file and directory level cred tracking. I've skipped a block of tests around the git analysisAdapter. (I intend to deprecate the analysisAdapters, so skipping the tests seemed preferrable to updating them). I also updated our sharness test for catching test files without a proper describe block, so that it won't error on skipped blocks. Test plan: `yarn test --full` passes. Loading a new repository and inspecting it in the frontend gives consistent results. There are no references to Git plugin weights in the frontend, now that corresponding nodes are not available.
This commit is contained in:
parent
e454a44c71
commit
7d26c196f2
@ -1 +0,0 @@
|
||||
[{"type":"sourcecred/graph","version":"0.8.0"},{"edges":[{"address":["sourcecred","git","HAS_PARENT","2","COMMIT","0a223346b4e6dec0127b1e6aa892c4ee0424b66a","2","COMMIT","ec91adb718a6045b492303f00d8e8beb957dc780"],"dstIndex":4,"srcIndex":0,"timestampMs":1519807427000},{"address":["sourcecred","git","HAS_PARENT","2","COMMIT","0a223346b4e6dec0127b1e6aa892c4ee0424b66a","2","COMMIT","ecc889dc94cf6da17ae6eab5bb7b7155f577519d"],"dstIndex":5,"srcIndex":0,"timestampMs":1519807427000},{"address":["sourcecred","git","HAS_PARENT","2","COMMIT","6bd1b4c0b719c22c688a74863be07a699b7b9b34","2","COMMIT","c430bd74455105f77215ece51945094ceeee6c86"],"dstIndex":3,"srcIndex":1,"timestampMs":1536806901000},{"address":["sourcecred","git","HAS_PARENT","2","COMMIT","6d5b3aa31ebb68a06ceb46bbd6cf49b6ccd6f5e6","2","COMMIT","0a223346b4e6dec0127b1e6aa892c4ee0424b66a"],"dstIndex":0,"srcIndex":2,"timestampMs":1519878354000},{"address":["sourcecred","git","HAS_PARENT","2","COMMIT","c430bd74455105f77215ece51945094ceeee6c86","2","COMMIT","6d5b3aa31ebb68a06ceb46bbd6cf49b6ccd6f5e6"],"dstIndex":2,"srcIndex":3,"timestampMs":1536788634000},{"address":["sourcecred","git","HAS_PARENT","2","COMMIT","ecc889dc94cf6da17ae6eab5bb7b7155f577519d","2","COMMIT","ec91adb718a6045b492303f00d8e8beb957dc780"],"dstIndex":4,"srcIndex":5,"timestampMs":1519807329000}],"nodes":[{"description":"0a223346b4e6dec0127b1e6aa892c4ee0424b66a","index":0,"timestampMs":1519807427000},{"description":"6bd1b4c0b719c22c688a74863be07a699b7b9b34","index":1,"timestampMs":1536806901000},{"description":"6d5b3aa31ebb68a06ceb46bbd6cf49b6ccd6f5e6","index":2,"timestampMs":1519878354000},{"description":"c430bd74455105f77215ece51945094ceeee6c86","index":3,"timestampMs":1536788634000},{"description":"ec91adb718a6045b492303f00d8e8beb957dc780","index":4,"timestampMs":1519807271000},{"description":"ecc889dc94cf6da17ae6eab5bb7b7155f577519d","index":5,"timestampMs":1519807329000}],"sortedNodeAddresses":[["sourcecred","git","COMMIT","0a223346b4e6dec0127b1e6aa892c4ee0424b66a"],["sourcecred","git","COMMIT","6bd1b4c0b719c22c688a74863be07a699b7b9b34"],["sourcecred","git","COMMIT","6d5b3aa31ebb68a06ceb46bbd6cf49b6ccd6f5e6"],["sourcecred","git","COMMIT","c430bd74455105f77215ece51945094ceeee6c86"],["sourcecred","git","COMMIT","ec91adb718a6045b492303f00d8e8beb957dc780"],["sourcecred","git","COMMIT","ecc889dc94cf6da17ae6eab5bb7b7155f577519d"]]}]
|
@ -1 +0,0 @@
|
||||
{"commitToRepoId":{"0a223346b4e6dec0127b1e6aa892c4ee0424b66a":{"sourcecred/example-github":true},"6bd1b4c0b719c22c688a74863be07a699b7b9b34":{"sourcecred/example-github":true},"6d5b3aa31ebb68a06ceb46bbd6cf49b6ccd6f5e6":{"sourcecred/example-github":true},"c430bd74455105f77215ece51945094ceeee6c86":{"sourcecred/example-github":true},"ec91adb718a6045b492303f00d8e8beb957dc780":{"sourcecred/example-github":true},"ecc889dc94cf6da17ae6eab5bb7b7155f577519d":{"sourcecred/example-github":true}},"commits":{"0a223346b4e6dec0127b1e6aa892c4ee0424b66a":{"createdAt":1519807427000,"hash":"0a223346b4e6dec0127b1e6aa892c4ee0424b66a","parentHashes":["ec91adb718a6045b492303f00d8e8beb957dc780","ecc889dc94cf6da17ae6eab5bb7b7155f577519d"],"shortHash":"0a22334","summary":"Merge pull request #3 from sourcecred/add-readme"},"6bd1b4c0b719c22c688a74863be07a699b7b9b34":{"createdAt":1536806901000,"hash":"6bd1b4c0b719c22c688a74863be07a699b7b9b34","parentHashes":["c430bd74455105f77215ece51945094ceeee6c86"],"shortHash":"6bd1b4c","summary":"A commit from someone with no GitHub account"},"6d5b3aa31ebb68a06ceb46bbd6cf49b6ccd6f5e6":{"createdAt":1519878354000,"hash":"6d5b3aa31ebb68a06ceb46bbd6cf49b6ccd6f5e6","parentHashes":["0a223346b4e6dec0127b1e6aa892c4ee0424b66a"],"shortHash":"6d5b3aa","summary":"This pull request will be more contentious. I can feel it... (#5)"},"c430bd74455105f77215ece51945094ceeee6c86":{"createdAt":1536788634000,"hash":"c430bd74455105f77215ece51945094ceeee6c86","parentHashes":["6d5b3aa31ebb68a06ceb46bbd6cf49b6ccd6f5e6"],"shortHash":"c430bd7","summary":"Hello from credbot!"},"ec91adb718a6045b492303f00d8e8beb957dc780":{"createdAt":1519807271000,"hash":"ec91adb718a6045b492303f00d8e8beb957dc780","parentHashes":[],"shortHash":"ec91adb","summary":"Commit without pull request."},"ecc889dc94cf6da17ae6eab5bb7b7155f577519d":{"createdAt":1519807329000,"hash":"ecc889dc94cf6da17ae6eab5bb7b7155f577519d","parentHashes":["ec91adb718a6045b492303f00d8e8beb957dc780"],"shortHash":"ecc889d","summary":"Add README, merge via PR."}}}
|
File diff suppressed because one or more lines are too long
@ -22,7 +22,7 @@ test_expect_success "setup" '
|
||||
# Happily, doing so would be highly questionable anyway.
|
||||
while read -r filename; do
|
||||
test_expect_success SETUP "test file: ${filename}" '
|
||||
grep "^describe(" -- "${root}/src/${filename}" >describes &&
|
||||
grep "^describe\(\.skip\)\?(" -- "${root}/src/${filename}" >describes &&
|
||||
grep -F -- "${filename%.test.js}" describes
|
||||
'
|
||||
done <test_files
|
||||
|
@ -8,9 +8,7 @@ import * as NullUtil from "../util/null";
|
||||
|
||||
export type PluginName = "git" | "github";
|
||||
|
||||
export function defaultPlugins(): PluginName[] {
|
||||
return ["git", "github"];
|
||||
}
|
||||
export const defaultPlugins: PluginName[] = Object.freeze(["github"]);
|
||||
|
||||
export function defaultSourcecredDirectory() {
|
||||
return path.join(os.tmpdir(), "sourcecred");
|
||||
|
@ -17,8 +17,8 @@ describe("cli/common", () => {
|
||||
});
|
||||
|
||||
describe("defaultPlugins", () => {
|
||||
it("gives an array including the Git plugin name", () => {
|
||||
expect(defaultPlugins()).toEqual(expect.arrayContaining(["git"]));
|
||||
it("is an array including the GitHub plugin name", () => {
|
||||
expect(defaultPlugins).toEqual(expect.arrayContaining(["github"]));
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -47,7 +47,7 @@ function usage(print: (string) => void): void {
|
||||
|
||||
--plugin PLUGIN
|
||||
Plugin for which to load data. Valid options are 'git' and
|
||||
'github'. If not specified, data for all plugins will be
|
||||
'github'. If not specified, data for all default plugins will be
|
||||
loaded.
|
||||
|
||||
--help
|
||||
@ -188,7 +188,7 @@ export const makeLoadDefaultPlugins = (saveGraph: SaveGraph) => {
|
||||
...args,
|
||||
];
|
||||
const tasks = [
|
||||
...Common.defaultPlugins().map((pluginName) => ({
|
||||
...Common.defaultPlugins.map((pluginName) => ({
|
||||
id: `load-${pluginName}`,
|
||||
cmd: sourcecredCommand([
|
||||
"load",
|
||||
|
@ -4,6 +4,7 @@ import path from "path";
|
||||
import tmp from "tmp";
|
||||
|
||||
import {run} from "./testUtil";
|
||||
import {defaultPlugins} from "./common";
|
||||
import {
|
||||
makeLoadCommand,
|
||||
makeLoadDefaultPlugins,
|
||||
@ -476,9 +477,9 @@ describe("cli/load", () => {
|
||||
});
|
||||
expect(execDependencyGraph).toHaveBeenCalledTimes(1);
|
||||
const loadTasks = execDependencyGraph.mock.calls[0][0];
|
||||
expect(loadTasks).toHaveLength(["git", "github"].length);
|
||||
expect(loadTasks).toHaveLength(defaultPlugins.length);
|
||||
expect(loadTasks.map((task) => task.id)).toEqual(
|
||||
expect.arrayContaining(["load-git", "load-github"])
|
||||
expect.arrayContaining(defaultPlugins.map((x) => `load-${x}`))
|
||||
);
|
||||
for (const task of loadTasks) {
|
||||
expect(task.cmd).toEqual([
|
||||
|
@ -23,7 +23,6 @@ import {type NodeAndEdgeTypes} from "../analysis/types";
|
||||
import {combineTypes} from "../analysis/pluginDeclaration";
|
||||
import {weightsToEdgeEvaluator} from "../analysis/weightsToEdgeEvaluator";
|
||||
import {BackendAdapterLoader as GithubAdapterLoader} from "../plugins/github/analysisAdapter";
|
||||
import {BackendAdapterLoader as GitAdapterLoader} from "../plugins/git/analysisAdapter";
|
||||
|
||||
function usage(print: (string) => void): void {
|
||||
print(
|
||||
@ -169,10 +168,7 @@ export async function savePagerankGraph(
|
||||
|
||||
// TODO(#1120): This should be canonicalized somewhere more appropriate,
|
||||
// e.g. in src/plugins/defaultPlugins.js
|
||||
export const defaultAdapterLoaders = () => [
|
||||
new GithubAdapterLoader(),
|
||||
new GitAdapterLoader(),
|
||||
];
|
||||
export const defaultAdapterLoaders = () => [new GithubAdapterLoader()];
|
||||
|
||||
const declarations = () => defaultAdapterLoaders().map((x) => x.declaration());
|
||||
|
||||
|
@ -5,16 +5,11 @@ import React from "react";
|
||||
import type {Assets} from "../webutil/assets";
|
||||
import {StaticExplorerAdapterSet} from "../explorer/adapters/explorerAdapterSet";
|
||||
import {StaticExplorerAdapter as GithubAdapter} from "../plugins/github/explorerAdapter";
|
||||
import {StaticExplorerAdapter as GitAdapter} from "../plugins/git/explorerAdapter";
|
||||
import {GithubGitGateway} from "../plugins/github/githubGitGateway";
|
||||
import {AppPage} from "../explorer/App";
|
||||
import type {RepoId} from "../core/repoId";
|
||||
|
||||
function homepageStaticAdapters(): StaticExplorerAdapterSet {
|
||||
return new StaticExplorerAdapterSet([
|
||||
new GithubAdapter(),
|
||||
new GitAdapter(new GithubGitGateway()),
|
||||
]);
|
||||
return new StaticExplorerAdapterSet([new GithubAdapter()]);
|
||||
}
|
||||
|
||||
export default class HomepageExplorer extends React.Component<{|
|
||||
|
@ -7,7 +7,13 @@ import {stringToRepoId} from "../../core/repoId";
|
||||
import {declaration} from "./declaration";
|
||||
import {Graph} from "../../core/graph";
|
||||
|
||||
describe("plugins/git/analysisAdapter", () => {
|
||||
// This test is skipped because the Git plugin is currently disabled, but the
|
||||
// tests depend on data being loaded in the `sourcecred load` snapshot. I
|
||||
// elected to disable the test rather than update it because I consider the
|
||||
// AnalysisAdapters deprecated now that the Graph natively contains
|
||||
// descriptions and timestamps. Rather than having an AnalysisAdapter, we
|
||||
// should just use the graph file directly.
|
||||
describe.skip("plugins/git/analysisAdapter", () => {
|
||||
const sourcecredDirectory = path.join(
|
||||
"sharness",
|
||||
"__snapshots__",
|
||||
|
Loading…
x
Reference in New Issue
Block a user