refactor(dev-infra): several code style and typo fixes (#39135)

This commit addresses comments from [my review][1] on PR #38656 (which
was merged without comments addressed). The changes are mostly related
to code style and typos.

[1]: https://github.com/angular/angular/pull/38656#pullrequestreview-482129333

PR Close #39135
This commit is contained in:
George Kalpakas
2020-10-10 22:02:47 +03:00
committed by atscott
parent 5471789664
commit 6947ceaf44
23 changed files with 73 additions and 82 deletions

View File

@ -12,16 +12,16 @@ import {GithubConfig} from '../config';
import {GitClient} from './index';
/** URL to the Github page where personal access tokens can be managed. */
export const GITHUB_TOKEN_SETTINGS_URL = `https://github.com/settings/tokens`;
export const GITHUB_TOKEN_SETTINGS_URL = 'https://github.com/settings/tokens';
/** URL to the Github page where personal access tokens can be generated. */
export const GITHUB_TOKEN_GENERATE_URL = `https://github.com/settings/tokens/new`;
export const GITHUB_TOKEN_GENERATE_URL = 'https://github.com/settings/tokens/new';
/** Adds the provided token to the given Github HTTPs remote url. */
export function addTokenToGitHttpsUrl(githubHttpsUrl: string, token: string) {
const url = new URL(githubHttpsUrl);
url.username = token;
return url.toString();
return url.href;
}
/** Gets the repository Git URL for the given github config. */
@ -36,7 +36,7 @@ export function getRepositoryGitUrl(config: GithubConfig, githubToken?: string):
return baseHttpUrl;
}
/** Gets a Github URL that refers to a lists of recent commits within a specified branch. */
/** Gets a Github URL that refers to a list of recent commits within a specified branch. */
export function getListCommitsInBranchUrl({remoteParams}: GitClient, branchName: string) {
return `https://github.com/${remoteParams.owner}/${remoteParams.repo}/commits/${branchName}`;
}

View File

@ -88,8 +88,8 @@ export class GitClient {
*/
runGraceful(args: string[], options: SpawnSyncOptions = {}): SpawnSyncReturns<string> {
// To improve the debugging experience in case something fails, we print all executed Git
// commands unless the `stdio` is explicitly to `ignore` (which is equivalent to silent).
// Note that we do not want to print the token if is contained in the command. It's common
// commands unless the `stdio` is explicitly set to `ignore` (which is equivalent to silent).
// Note that we do not want to print the token if it is contained in the command. It's common
// to share errors with others if the tool failed, and we do not want to leak tokens.
// TODO: Add support for configuring this on a per-client basis. Some tools do not want
// to print the Git command messages to the console at all (e.g. to maintain clean output).
@ -202,7 +202,7 @@ export class GitClient {
/**
* Retrieve the OAuth scopes for the loaded Github token.
**/
private async getAuthScopesForToken() {
private getAuthScopesForToken() {
// If the OAuth scopes have already been loaded, return the Promise containing them.
if (this._cachedOauthScopes !== null) {
return this._cachedOauthScopes;