From 39fd3fa35406765bae6053e13ae91717d2965b29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dandelion=20Man=C3=A9?= Date: Tue, 20 Mar 2018 18:32:05 -0700 Subject: [PATCH] Make GitHub capitalization consistent within code (#100) * Make GitHub capitalization consistent within code We now never capitalize the H in GitHub within variable or function names. We still capitalize it in comments or user facing strings. Test plan: Unit tests, the fetchGithubRepoTest.sh, and `git grep itHub` only shows comment lines and print statements. * Fix William's klaxon --- config/paths.js | 4 ++-- src/plugins/artifact/editor/App.js | 10 +++++----- ...GitHubGraphFetcher.js => GithubGraphFetcher.js} | 14 +++++++------- .../editor/adapters/githubPluginAdapter.js | 2 +- ...intGitHubRepo.js => fetchAndPrintGithubRepo.js} | 8 ++++---- .../{fetchGitHubRepo.js => fetchGithubRepo.js} | 2 +- ...tchGitHubRepoTest.sh => fetchGithubRepoTest.sh} | 2 +- 7 files changed, 21 insertions(+), 21 deletions(-) rename src/plugins/artifact/editor/{GitHubGraphFetcher.js => GithubGraphFetcher.js} (85%) rename src/plugins/github/bin/{fetchAndPrintGitHubRepo.js => fetchAndPrintGithubRepo.js} (81%) rename src/plugins/github/{fetchGitHubRepo.js => fetchGithubRepo.js} (99%) rename src/plugins/github/{fetchGitHubRepoTest.sh => fetchGithubRepoTest.sh} (93%) diff --git a/config/paths.js b/config/paths.js index 0c94542..d2f25fb 100644 --- a/config/paths.js +++ b/config/paths.js @@ -59,8 +59,8 @@ module.exports = { // source file, and the key will be the filename of the bundled entry // point within the build directory. backendEntryPoints: { - fetchAndPrintGitHubRepo: resolveApp( - "src/plugins/github/bin/fetchAndPrintGitHubRepo.js" + fetchAndPrintGithubRepo: resolveApp( + "src/plugins/github/bin/fetchAndPrintGithubRepo.js" ), }, }; diff --git a/src/plugins/artifact/editor/App.js b/src/plugins/artifact/editor/App.js index 7d8ebb6..179ac6b 100644 --- a/src/plugins/artifact/editor/App.js +++ b/src/plugins/artifact/editor/App.js @@ -8,18 +8,18 @@ import "./pluginAdapter"; import type {Graph, Node} from "../../../core/graph"; import type {ArtifactNodePayload} from "../artifactPlugin"; import type { - NodePayload as GitHubNodePayload, - EdgePayload as GitHubEdgePayload, + NodePayload as GithubNodePayload, + EdgePayload as GithubEdgePayload, } from "../../github/githubPlugin"; import {ArtifactList} from "./ArtifactList"; import {ContributionList} from "./ContributionList"; -import {GitHubGraphFetcher} from "./GitHubGraphFetcher"; +import {GithubGraphFetcher} from "./GithubGraphFetcher"; import standardAdapterSet from "./standardAdapterSet"; type Props = {}; type State = { artifacts: Node[], - githubGraph: ?Graph, + githubGraph: ?Graph, }; function createSampleArtifact(name) { @@ -49,7 +49,7 @@ export default class App extends React.Component {

Artifact editor

- { this.setState({githubGraph}); }} diff --git a/src/plugins/artifact/editor/GitHubGraphFetcher.js b/src/plugins/artifact/editor/GithubGraphFetcher.js similarity index 85% rename from src/plugins/artifact/editor/GitHubGraphFetcher.js rename to src/plugins/artifact/editor/GithubGraphFetcher.js index d4f7e6f..7161870 100644 --- a/src/plugins/artifact/editor/GitHubGraphFetcher.js +++ b/src/plugins/artifact/editor/GithubGraphFetcher.js @@ -4,15 +4,15 @@ import React from "react"; import type {Graph} from "../../../core/graph"; import LocalStore from "./LocalStore"; -import fetchGitHubRepo from "../../github/fetchGitHubRepo"; +import fetchGithubRepo from "../../github/fetchGithubRepo"; import type { - NodePayload as GitHubNodePayload, - EdgePayload as GitHubEdgePayload, + NodePayload as GithubNodePayload, + EdgePayload as GithubEdgePayload, } from "../../github/githubPlugin"; import {GithubParser} from "../../github/githubPlugin"; type Props = { - onCreateGraph: (graph: Graph) => void, + onCreateGraph: (graph: Graph) => void, }; type State = { apiToken: string, @@ -20,9 +20,9 @@ type State = { repoName: string, }; -const SETTINGS_KEY = "GitHubGraphFetcher.settings"; +const SETTINGS_KEY = "GithubGraphFetcher.settings"; -export class GitHubGraphFetcher extends React.Component { +export class GithubGraphFetcher extends React.Component { constructor() { super(); const defaultState = { @@ -83,7 +83,7 @@ export class GitHubGraphFetcher extends React.Component { fetchGraph() { const {repoOwner, repoName, apiToken} = this.state; LocalStore.set(SETTINGS_KEY, {apiToken, repoOwner, repoName}); - fetchGitHubRepo(repoOwner, repoName, apiToken) + fetchGithubRepo(repoOwner, repoName, apiToken) .then((json) => { const parser = new GithubParser(`${repoOwner}/${repoName}`); parser.addData(json.data); diff --git a/src/plugins/artifact/editor/adapters/githubPluginAdapter.js b/src/plugins/artifact/editor/adapters/githubPluginAdapter.js index e4f903a..a5d745e 100644 --- a/src/plugins/artifact/editor/adapters/githubPluginAdapter.js +++ b/src/plugins/artifact/editor/adapters/githubPluginAdapter.js @@ -22,7 +22,7 @@ import {GITHUB_PLUGIN_NAME, getNodeType} from "../../../github/githubPlugin"; const adapter: PluginAdapter = { pluginName: GITHUB_PLUGIN_NAME, - renderer: class GitHubNodeRenderer extends React.Component<{ + renderer: class GithubNodeRenderer extends React.Component<{ graph: Graph, node: Node, }> { diff --git a/src/plugins/github/bin/fetchAndPrintGitHubRepo.js b/src/plugins/github/bin/fetchAndPrintGithubRepo.js similarity index 81% rename from src/plugins/github/bin/fetchAndPrintGitHubRepo.js rename to src/plugins/github/bin/fetchAndPrintGithubRepo.js index 41493f3..5daace8 100644 --- a/src/plugins/github/bin/fetchAndPrintGitHubRepo.js +++ b/src/plugins/github/bin/fetchAndPrintGithubRepo.js @@ -1,17 +1,17 @@ /* * Command-line utility to fetch GitHub data using the API in - * ../fetchGitHubRepo, and print it to stdout. Useful for testing or + * ../fetchGithubRepo, and print it to stdout. Useful for testing or * saving some data to disk. * * Usage: * - * node bin/fetchAndPrintGitHubRepo.js REPO_OWNER REPO_NAME [TOKEN] + * node bin/fetchAndPrintGithubRepo.js REPO_OWNER REPO_NAME [TOKEN] * * where TOKEN is an optional GitHub authentication token, as generated * from https://github.com/settings/tokens/new. */ -import fetchGitHubRepo from "../fetchGitHubRepo"; +import fetchGithubRepo from "../fetchGithubRepo"; import stringify from "json-stable-stringify"; function parseArgs() { @@ -35,7 +35,7 @@ function parseArgs() { function main() { const args = parseArgs(); - fetchGitHubRepo(args.repoOwner, args.repoName, args.token) + fetchGithubRepo(args.repoOwner, args.repoName, args.token) .then((data) => { console.log(stringify(data, {space: 4})); }) diff --git a/src/plugins/github/fetchGitHubRepo.js b/src/plugins/github/fetchGithubRepo.js similarity index 99% rename from src/plugins/github/fetchGitHubRepo.js rename to src/plugins/github/fetchGithubRepo.js index da90684..d09a8e0 100644 --- a/src/plugins/github/fetchGitHubRepo.js +++ b/src/plugins/github/fetchGithubRepo.js @@ -24,7 +24,7 @@ import * as GraphQLQueries from "../../graphql/queries"; * scraped from the repository, with data format to be specified * later */ -export default function fetchGitHubRepo( +export default function fetchGithubRepo( repoOwner: string, repoName: string, token: string diff --git a/src/plugins/github/fetchGitHubRepoTest.sh b/src/plugins/github/fetchGithubRepoTest.sh similarity index 93% rename from src/plugins/github/fetchGitHubRepoTest.sh rename to src/plugins/github/fetchGithubRepoTest.sh index 402cc61..b026943 100755 --- a/src/plugins/github/fetchGitHubRepoTest.sh +++ b/src/plugins/github/fetchGithubRepoTest.sh @@ -14,7 +14,7 @@ main() { return 1 fi output="$(mktemp)" - node bin/fetchAndPrintGitHubRepo.js \ + node bin/fetchAndPrintGithubRepo.js \ sourcecred example-repo "${GITHUB_TOKEN}" \ >"${output}" \ ;