From 22be6f79ed4c8446fd1298e5eb6b45bb9222d225 Mon Sep 17 00:00:00 2001 From: Mathieu Suen Date: Thu, 30 Sep 2021 17:54:40 +0200 Subject: [PATCH] SONAR-15466 Add link for SonarLint connected mode --- .../sonar-docs/src/EmbedDocsSuggestions.json | 68 ++++--------------- .../src/__tests__/BrokenLinkSafetyNet.test.js | 17 +++-- 2 files changed, 22 insertions(+), 63 deletions(-) diff --git a/server/sonar-docs/src/EmbedDocsSuggestions.json b/server/sonar-docs/src/EmbedDocsSuggestions.json index bdcee059a7d..2eb7800dd64 100644 --- a/server/sonar-docs/src/EmbedDocsSuggestions.json +++ b/server/sonar-docs/src/EmbedDocsSuggestions.json @@ -24,43 +24,9 @@ "text": "Metric Definitions" } ], - "extension_billing": [ - { - "link": "/documentation/sonarcloud-pricing/", - "text": "Pricing", - "scope": "sonarcloud" - } - ], - "global_permissions": [ - { - "link": "/documentation/organizations/manage-team/", - "text": "Manage a Team", - "scope": "sonarcloud" - } - ], + "global_permissions": [], "issues": [], "marketplace": [], - "organization_members": [ - { - "link": "/documentation/organizations/manage-team/", - "text": "Manage a Team", - "scope": "sonarcloud" - } - ], - "organization_projects": [ - { - "link": "/documentation/organizations/manage-team/", - "text": "Manage a Team", - "scope": "sonarcloud" - } - ], - "organization_space": [ - { - "link": "/documentation/organizations/overview/", - "text": "Organizations", - "scope": "sonarcloud" - } - ], "overview": [ { "link": "/documentation/analysis/pull-request/", @@ -73,6 +39,10 @@ { "link": "/documentation/user-guide/clean-as-you-code/", "text": "Clean as You Code" + }, + { + "link": "/documentation/user-guide/connected-mode/", + "text": "SonarLint connected mode" } ], "permission_templates": [], @@ -101,20 +71,8 @@ "text": "About Quality Profiles" } ], - "projects_management": [ - { - "link": "/documentation/analysis/overview/", - "text": "Analyze a Project", - "scope": "sonarcloud" - } - ], - "projects": [ - { - "link": "/documentation/analysis/overview/", - "text": "Analyze a Project", - "scope": "sonarcloud" - } - ], + "projects_management": [], + "projects": [], "pull_requests": [ { "link": "/documentation/user-guide/clean-as-you-code/", @@ -123,6 +81,10 @@ { "link": "/documentation/analysis/pull-request/", "text": "Analyzing Pull Requests" + }, + { + "link": "/documentation/user-guide/connected-mode/", + "text": "SonarLint connected mode" } ], "quality_gates": [ @@ -145,13 +107,7 @@ ], "settings": [], "system_info": [], - "user_groups": [ - { - "link": "/documentation/organizations/manage-team/", - "text": "Manage a Team", - "scope": "sonarcloud" - } - ], + "user_groups": [], "users": [], "webhooks": [ { diff --git a/server/sonar-docs/src/__tests__/BrokenLinkSafetyNet.test.js b/server/sonar-docs/src/__tests__/BrokenLinkSafetyNet.test.js index d1d31eb30c9..74c4598bd57 100644 --- a/server/sonar-docs/src/__tests__/BrokenLinkSafetyNet.test.js +++ b/server/sonar-docs/src/__tests__/BrokenLinkSafetyNet.test.js @@ -72,16 +72,19 @@ it('should have valid links in trees files', () => { it('should have valid links in suggestions file', () => { const file = 'EmbedDocsSuggestions.json'; const suggestions = JSON.parse(fs.readFileSync(path.join(rootPath, file), 'utf8')); - let hasErrors = false; - Object.keys(suggestions).forEach(key => { - suggestions[key].forEach(suggestion => { + const hasErrors = Object.keys(suggestions).some(key => { + return suggestions[key].some(suggestion => { if (!suggestion.link.startsWith('/documentation/')) { - console.log(`[${suggestion.link}] should starts with "/documentation/", in ${file}`); - hasErrors = true; - } else if (!urlExists(parsedFiles, suggestion.link.replace('/documentation', ''))) { + console.log( + `[${suggestion.link}] should starts with "/documentation/" or be a valid url, in ${file}` + ); + return true; + } + if (!urlExists(parsedFiles, suggestion.link.replace('/documentation', ''))) { console.log(`[${suggestion.link}] is not a valid link, in ${file}`); - hasErrors = true; + return true; } + return false; }); }); expect(hasErrors).toBe(false); -- 2.39.5