From c68ca2e93075e63a3d0ec67c295c5eb391dfdcb6 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Mon, 24 Feb 2020 16:57:41 +0100
Subject: [PATCH] chore: lgtm ignores (#5566)

---
 lib/datasource/docker/index.ts      | 15 ++++++++++-----
 lib/datasource/metadata.ts          |  5 +++--
 lib/datasource/rubygems/releases.ts |  3 ++-
 3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/lib/datasource/docker/index.ts b/lib/datasource/docker/index.ts
index 9396fad454..3fe4e61f08 100644
--- a/lib/datasource/docker/index.ts
+++ b/lib/datasource/docker/index.ts
@@ -166,10 +166,12 @@ async function getAuthHeaders(
       logger.debug({ err });
       return null;
     }
-    if (err.name === 'RequestError' && registry.endsWith('docker.io')) {
+    // prettier-ignore
+    if (err.name === 'RequestError' && registry.endsWith('docker.io')) { // lgtm [js/incomplete-url-substring-sanitization]
       throw new DatasourceError(err);
     }
-    if (err.statusCode === 429 && registry.endsWith('docker.io')) {
+    // prettier-ignore
+    if (err.statusCode === 429 && registry.endsWith('docker.io')) { // lgtm [js/incomplete-url-substring-sanitization]
       throw new DatasourceError(err);
     }
     if (err.statusCode >= 500 && err.statusCode < 600) {
@@ -236,7 +238,8 @@ async function getManifestResponse(
       );
       return null;
     }
-    if (err.statusCode === 429 && registry.endsWith('docker.io')) {
+    // prettier-ignore
+    if (err.statusCode === 429 && registry.endsWith('docker.io')) { // lgtm [js/incomplete-url-substring-sanitization]
       throw new DatasourceError(err);
     }
     if (err.statusCode >= 500 && err.statusCode < 600) {
@@ -381,7 +384,8 @@ async function getTags(
       );
       return null;
     }
-    if (err.statusCode === 429 && registry.endsWith('docker.io')) {
+    // prettier-ignore
+    if (err.statusCode === 429 && registry.endsWith('docker.io')) { // lgtm [js/incomplete-url-substring-sanitization]
       logger.warn(
         { registry, dockerRepository: repository, err },
         'docker registry failure: too many requests'
@@ -427,7 +431,8 @@ export function getConfigResponseBeforeRedirectHook(options: any): void {
 
   if (options.href && options.headers?.authorization) {
     const { host } = URL.parse(options.href);
-    if (host && host.endsWith('blob.core.windows.net')) {
+    // prettier-ignore
+    if (host && host.endsWith('blob.core.windows.net')) { // lgtm [js/incomplete-url-substring-sanitization]
       // docker registry is hosted on Azure blob, redirect url includes authentication.
       // eslint-disable-next-line no-param-reassign
       delete options.headers.authorization;
diff --git a/lib/datasource/metadata.ts b/lib/datasource/metadata.ts
index 947ff33375..dbbfb36a02 100644
--- a/lib/datasource/metadata.ts
+++ b/lib/datasource/metadata.ts
@@ -98,12 +98,13 @@ export function addMetaData(
   };
   if (
     dep.changelogUrl &&
-    dep.changelogUrl.includes('github.com') &&
+    dep.changelogUrl.includes('github.com') && // lgtm [js/incomplete-url-substring-sanitization]
     !dep.sourceUrl
   ) {
     dep.sourceUrl = dep.changelogUrl;
   }
-  if (dep.homepage && dep.homepage.includes('github.com')) {
+  // prettier-ignore
+  if (dep.homepage && dep.homepage.includes('github.com')) { // lgtm [js/incomplete-url-substring-sanitization]
     if (!dep.sourceUrl) {
       dep.sourceUrl = dep.homepage;
     }
diff --git a/lib/datasource/rubygems/releases.ts b/lib/datasource/rubygems/releases.ts
index a7dd6e48ab..b4405774c6 100644
--- a/lib/datasource/rubygems/releases.ts
+++ b/lib/datasource/rubygems/releases.ts
@@ -14,7 +14,8 @@ export async function getPkgReleases({
 
   for (const registry of registries) {
     let pkg: ReleaseResult;
-    if (registry.endsWith('rubygems.org')) {
+    // prettier-ignore
+    if (registry.endsWith('rubygems.org')) { // lgtm [js/incomplete-url-substring-sanitization]
       pkg = await getRubygemsOrgDependency(lookupName);
     } else {
       pkg = await getDependency({ dependency: lookupName, registry });
-- 
GitLab