Skip to content

Commit 7cb8336

Browse files
author
Artyom Podymov
committed
test LGTM Alert suppression
1 parent 97c1b43 commit 7cb8336

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

redisinsight/api/src/utils/hosting-provider-helper.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { HostingProvider } from 'src/modules/core/models/database-instance.entity';
22
import { IP_ADDRESS_REGEX, PRIVATE_IP_ADDRESS_REGEX } from 'src/constants';
33

4+
// Ignore LGTM [js/incomplete-url-substring-sanitization] alert.
5+
// Because we do not bind potentially dangerous logic to this.
6+
// We define a hosting provider for telemetry only.
47
export const getHostingProvider = (host: string): HostingProvider => {
58
// Tries to detect the hosting provider from the hostname.
69
if (host === '0.0.0.0' || host === 'localhost') {
@@ -9,12 +12,13 @@ export const getHostingProvider = (host: string): HostingProvider => {
912
if (IP_ADDRESS_REGEX.test(host) && PRIVATE_IP_ADDRESS_REGEX.test(host)) {
1013
return HostingProvider.LOCALHOST;
1114
}
12-
if (host.endsWith('rlrcp.com') || host.endsWith('redislabs.com')) {
15+
if (host.endsWith('rlrcp.com') || host.endsWith('redislabs.com')) { // lgtm[js/incomplete-url-substring-sanitization]
1316
return HostingProvider.RE_CLOUD;
1417
}
15-
if (host.endsWith('cache.amazonaws.com')) {
18+
if (host.endsWith('cache.amazonaws.com')) { // lgtm[js/incomplete-url-substring-sanitization]
1619
return HostingProvider.AWS;
1720
}
21+
// lgtm[js/incomplete-url-substring-sanitization]
1822
if (host.endsWith('cache.windows.net')) {
1923
return HostingProvider.AZURE;
2024
}

0 commit comments

Comments
 (0)