-
Notifications
You must be signed in to change notification settings - Fork 757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve performance of no-hardcoded-env-urls
linter rule
#3833
Conversation
"asazure.windows.net", | ||
"region.asazure.windows.net", | ||
"api.loganalytics.iov1", | ||
"api.loganalytics.io", | ||
"asazure.windows.net", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why, but there were a bunch of duplicates here, and api.loganalytics.iov1
looks like a typo. I've removed them.
src/Bicep.Core/Analyzers/Linter/Rules/NoHardcodedEnvironmentUrlsRule.cs
Outdated
Show resolved
Hide resolved
src/Bicep.Core/Analyzers/Linter/Rules/NoHardcodedEnvironmentUrlsRule.cs
Outdated
Show resolved
Hide resolved
|
||
public static IEnumerable<(TextSpan RelativeSpan, string Value)> FindHostnameMatches(string hostname, string srcText) | ||
{ | ||
bool isExactDomainMatch(int index) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// check preceeding and trailing chars to verify we're not dealing with a substring | ||
if (isExactDomainMatch(matchIndex)) | ||
{ | ||
var matchText = srcText.Substring(matchIndex, hostname.Length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continue; | ||
} | ||
|
||
yield return match; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some minor comments, but looks great!
Closes #3636