Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
#337 Performance: Replace noHttpStringRule regex with indexOf
Browse files Browse the repository at this point in the history
closes #337
closes #336
  • Loading branch information
Josh Goldberg authored and HamletDRC committed Feb 2, 2017
1 parent a05a003 commit be8c298
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/noHttpStringRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export class Rule extends Lint.Rules.AbstractRule {
class NoHttpStringWalker extends ErrorTolerantWalker {
protected visitStringLiteral(node: ts.StringLiteral): void {
const stringText : string = (<ts.LiteralExpression>node).text;
if (/.*http:.*/.test(stringText)) {
// tslint:disable no-http-string
if (stringText.indexOf('http:') !== -1) {
if (!this.isSuppressed(stringText)) {
const failureString = Rule.FAILURE_STRING + '\'' + stringText + '\'';
const failure = this.createFailure(node.getStart(), node.getWidth(), failureString);
Expand Down

0 comments on commit be8c298

Please sign in to comment.