Skip to content

Commit

Permalink
Renames *RegEx to *Regex for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed Dec 6, 2018
1 parent d64a1f8 commit ce8abd6
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/annotations/annotations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ interface IRenderOptions extends DecorationInstanceRenderOptions, ThemableDecora

const defaultHeatmapHotColor = '#f66a0a';
const defaultHeatmapColdColor = '#0a60f6';
const escapeMarkdownRegEx = /[`\>\#\*\_\-\+\.]/g;
const escapeMarkdownRegex = /[`\>\#\*\_\-\+\.]/g;
// const sampleMarkdown = '## message `not code` *not important* _no underline_ \n> don\'t quote me \n- don\'t list me \n+ don\'t list me \n1. don\'t list me \nnot h1 \n=== \nnot h2 \n---\n***\n---\n___';
const markdownHeaderReplacement = `${GlyphChars.ZeroWidthSpace}===`;

Expand Down Expand Up @@ -153,7 +153,7 @@ export class Annotations {

message
// Escape markdown
.replace(escapeMarkdownRegEx, '\\$&')
.replace(escapeMarkdownRegex, '\\$&')
// Escape markdown header (since the above regex won't match it)
.replace(/^===/gm, markdownHeaderReplacement)
// Keep under the same block-quote
Expand Down
8 changes: 4 additions & 4 deletions src/git/remotes/bitbucket-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { Range } from 'vscode';
import { RemoteProvider } from './provider';

const issueEnricherRegEx = /(^|\s)(issue #([0-9]+))\b/gi;
const prEnricherRegEx = /(^|\s)(pull request #([0-9]+))\b/gi;
const issueEnricherRegex = /(^|\s)(issue #([0-9]+))\b/gi;
const prEnricherRegex = /(^|\s)(pull request #([0-9]+))\b/gi;

export class BitbucketServerRemote extends RemoteProvider {
constructor(domain: string, path: string, protocol?: string, name?: string, custom: boolean = false) {
Expand All @@ -27,9 +27,9 @@ export class BitbucketServerRemote extends RemoteProvider {
return (
message
// Matches issue #123
.replace(issueEnricherRegEx, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`)
.replace(issueEnricherRegex, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`)
// Matches pull request #123
.replace(prEnricherRegEx, `$1[$2](${this.baseUrl}/pull-requests/$3 "Open PR $2")`)
.replace(prEnricherRegex, `$1[$2](${this.baseUrl}/pull-requests/$3 "Open PR $2")`)
);
}

Expand Down
8 changes: 4 additions & 4 deletions src/git/remotes/bitbucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { Range } from 'vscode';
import { RemoteProvider } from './provider';

const issueEnricherRegEx = /(^|\s)(issue #([0-9]+))\b/gi;
const prEnricherRegEx = /(^|\s)(pull request #([0-9]+))\b/gi;
const issueEnricherRegex = /(^|\s)(issue #([0-9]+))\b/gi;
const prEnricherRegex = /(^|\s)(pull request #([0-9]+))\b/gi;

export class BitbucketRemote extends RemoteProvider {
constructor(domain: string, path: string, protocol?: string, name?: string, custom: boolean = false) {
Expand All @@ -22,9 +22,9 @@ export class BitbucketRemote extends RemoteProvider {
return (
message
// Matches issue #123
.replace(issueEnricherRegEx, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`)
.replace(issueEnricherRegex, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`)
// Matches pull request #123
.replace(prEnricherRegEx, `$1[$2](${this.baseUrl}/pull-requests/$3 "Open PR $2")`)
.replace(prEnricherRegex, `$1[$2](${this.baseUrl}/pull-requests/$3 "Open PR $2")`)
);
}

Expand Down
8 changes: 4 additions & 4 deletions src/git/remotes/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { Range } from 'vscode';
import { RemoteProvider } from './provider';

const issueEnricherRegEx = /(^|\s)((?:#|gh-)([0-9]+))\b/gi;
const issueEnricher3rdParyRegEx = /\b((\w+-?\w+(?!-)\/\w+-?\w+(?!-))#([0-9]+))\b/g;
const issueEnricherRegex = /(^|\s)((?:#|gh-)([0-9]+))\b/gi;
const issueEnricher3rdParyRegex = /\b((\w+-?\w+(?!-)\/\w+-?\w+(?!-))#([0-9]+))\b/g;

export class GitHubRemote extends RemoteProvider {
constructor(domain: string, path: string, protocol?: string, name?: string, custom: boolean = false) {
Expand All @@ -22,10 +22,10 @@ export class GitHubRemote extends RemoteProvider {
return (
message
// Matches #123 or gh-123 or GH-123
.replace(issueEnricherRegEx, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`)
.replace(issueEnricherRegex, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`)
// Matches eamodio/vscode-gitlens#123
.replace(
issueEnricher3rdParyRegEx,
issueEnricher3rdParyRegex,
`[$1](${this.protocol}://${this.domain}/$2/issues/$3 "Open Issue #$3 from $2")`
)
);
Expand Down
4 changes: 2 additions & 2 deletions src/git/remotes/gitlab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Range } from 'vscode';
import { RemoteProvider } from './provider';

const issueEnricherRegEx = /(^|\s)(#([0-9]+))\b/gi;
const issueEnricherRegex = /(^|\s)(#([0-9]+))\b/gi;

export class GitLabRemote extends RemoteProvider {
constructor(domain: string, path: string, protocol?: string, name?: string, custom: boolean = false) {
Expand All @@ -19,7 +19,7 @@ export class GitLabRemote extends RemoteProvider {

enrichMessage(message: string): string {
// Matches #123
return message.replace(issueEnricherRegEx, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`);
return message.replace(issueEnricherRegex, `$1[$2](${this.baseUrl}/issues/$3 "Open Issue $2")`);
}

protected getUrlForBranches(): string {
Expand Down
4 changes: 2 additions & 2 deletions src/system/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ export namespace Strings {
}

// Removes \ / : * ? " < > | and C0 and C1 control codes
const illegalCharsForFSRegEx = /[\\/:*?"<>|\x00-\x1f\x80-\x9f]/g;
const illegalCharsForFSRegex = /[\\/:*?"<>|\x00-\x1f\x80-\x9f]/g;

export function sanitizeForFileSystem(s: string, replacement: string = '_') {
if (!s) return s;
return s.replace(illegalCharsForFSRegEx, replacement);
return s.replace(illegalCharsForFSRegex, replacement);
}

export function sha1(s: string, encoding: HexBase64Latin1Encoding = 'base64'): string {
Expand Down
4 changes: 2 additions & 2 deletions src/ui/shared/colors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const cssColorRegEx = /^(?:(#?)([0-9a-f]{3}|[0-9a-f]{6})|((?:rgb|hsl)a?)\((-?\d+%?)[,\s]+(-?\d+%?)[,\s]+(-?\d+%?)[,\s]*(-?[\d\.]+%?)?\))$/i;
const cssColorRegex = /^(?:(#?)([0-9a-f]{3}|[0-9a-f]{6})|((?:rgb|hsl)a?)\((-?\d+%?)[,\s]+(-?\d+%?)[,\s]+(-?\d+%?)[,\s]*(-?[\d\.]+%?)?\))$/i;

function adjustLight(color: number, amount: number) {
const cc = color + amount;
Expand Down Expand Up @@ -31,7 +31,7 @@ export function opacity(color: string, percentage: number) {
export function toRgba(color: string) {
color = color.trim();

const result = cssColorRegEx.exec(color);
const result = cssColorRegex.exec(color);
if (result == null) return null;

if (result[1] === '#') {
Expand Down

0 comments on commit ce8abd6

Please sign in to comment.