From 1693f024e1e8b76db97aa24bc785516181c97d81 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gr=C3=A9goire=20Aubert?= Date: Thu, 16 Aug 2018 16:21:32 +0200 Subject: [PATCH] Move bitbucket cloud connect app in private module --- server/sonar-bitbucketcloud/.babelrc | 43 - server/sonar-bitbucketcloud/.eslintrc | 8 - server/sonar-bitbucketcloud/.gitignore | 29 - server/sonar-bitbucketcloud/README.md | 1 - server/sonar-bitbucketcloud/build.gradle | 34 - .../config/InterpolateHtmlPlugin.js | 55 - .../config/jest/CSSStub.js | 20 - .../config/jest/FileStub.js | 20 - .../config/jest/SetupEnzyme.js | 23 - .../config/jest/SetupTestEnvironment.js | 24 - server/sonar-bitbucketcloud/config/paths.js | 28 - .../sonar-bitbucketcloud/config/polyfills.js | 21 - server/sonar-bitbucketcloud/config/utils.js | 66 - .../config/webpack.config.js | 95 - server/sonar-bitbucketcloud/package.json | 138 - .../public/after_login.html | 22 - .../public/images/sonarcloud-icon.png | Bin 4069 -> 0 bytes server/sonar-bitbucketcloud/public/index.html | 30 - server/sonar-bitbucketcloud/scripts/build.js | 56 - server/sonar-bitbucketcloud/scripts/start.js | 126 - server/sonar-bitbucketcloud/scripts/test.js | 34 - .../sonar-bitbucketcloud/src/main/ts/App.tsx | 70 - .../src/main/ts/__tests__/App-test.tsx | 41 - .../__tests__/__snapshots__/App-test.tsx.snap | 26 - .../sonar-bitbucketcloud/src/main/ts/api.ts | 126 - .../src/main/ts/components/Config.tsx | 303 - .../src/main/ts/components/HelpLink.tsx | 33 - .../src/main/ts/components/LoginButton.tsx | 60 - .../src/main/ts/components/LoginForm.tsx | 104 - .../src/main/ts/components/ProjectCard.tsx | 44 - .../main/ts/components/ProjectCardHeader.tsx | 60 - .../ts/components/ProjectCardMeasures.tsx | 54 - .../main/ts/components/PullRequestWidget.tsx | 180 - .../src/main/ts/components/RepoWidget.tsx | 87 - .../ts/components/RepoWidgetNotConfigured.tsx | 93 - .../src/main/ts/components/SonarCloudIcon.tsx | 39 - .../ts/components/__tests__/Config-test.tsx | 131 - .../components/__tests__/LoginButton-test.tsx | 57 - .../components/__tests__/LoginForm-test.tsx | 62 - .../components/__tests__/ProjectCard-test.tsx | 39 - .../__tests__/ProjectCardHeader-test.tsx | 39 - .../__tests__/ProjectCardMeasures-test.tsx | 41 - .../__tests__/PullRequestWidget-test.tsx | 97 - .../components/__tests__/RepoWidget-test.tsx | 72 - .../RepoWidgetNotConfigured-test.tsx | 53 - .../__snapshots__/Config-test.tsx.snap | 397 - .../__snapshots__/LoginButton-test.tsx.snap | 26 - .../__snapshots__/LoginForm-test.tsx.snap | 77 - .../__snapshots__/ProjectCard-test.tsx.snap | 50 - .../ProjectCardHeader-test.tsx.snap | 75 - .../ProjectCardMeasures-test.tsx.snap | 134 - .../PullRequestWidget-test.tsx.snap | 119 - .../__snapshots__/RepoWidget-test.tsx.snap | 54 - .../RepoWidgetNotConfigured-test.tsx.snap | 133 - .../ts/components/measures/MeasureBugs.tsx | 46 - .../components/measures/MeasureCodeSmells.tsx | 46 - .../components/measures/MeasureCoverage.tsx | 41 - .../measures/MeasureDuplication.tsx | 45 - .../components/measures/MeasureLanguages.tsx | 60 - .../measures/MeasureVulnerabilities.tsx | 46 - .../measures/__tests__/MeasureBugs-test.tsx | 29 - .../__tests__/MeasureCodeSmells-test.tsx | 29 - .../__tests__/MeasureCoverage-test.tsx | 29 - .../__tests__/MeasureDuplication-test.tsx | 29 - .../__tests__/MeasureLanguages-test.tsx | 29 - .../__tests__/MeasureVulnerabilities-test.tsx | 29 - .../__snapshots__/MeasureBugs-test.tsx.snap | 27 - .../MeasureCodeSmells-test.tsx.snap | 27 - .../MeasureCoverage-test.tsx.snap | 29 - .../MeasureDuplication-test.tsx.snap | 29 - .../MeasureLanguages-test.tsx.snap | 26 - .../MeasureVulnerabilities-test.tsx.snap | 27 - .../src/main/ts/index.tsx | 36 - .../src/main/ts/l10nbundle.ts | 10 - .../src/main/ts/style.css | 276 - .../sonar-bitbucketcloud/src/main/ts/types.ts | 77 - .../src/main/ts/typings/@atlaskit.d.ts | 149 - .../sonar-bitbucketcloud/src/main/ts/utils.ts | 174 - server/sonar-bitbucketcloud/tsconfig.json | 23 - server/sonar-bitbucketcloud/yarn.lock | 8377 ----------------- settings.gradle | 1 - sonar-application/build.gradle | 2 +- travis.sh | 1 - 83 files changed, 1 insertion(+), 13597 deletions(-) delete mode 100644 server/sonar-bitbucketcloud/.babelrc delete mode 100644 server/sonar-bitbucketcloud/.eslintrc delete mode 100644 server/sonar-bitbucketcloud/.gitignore delete mode 120000 server/sonar-bitbucketcloud/README.md delete mode 100644 server/sonar-bitbucketcloud/build.gradle delete mode 100644 server/sonar-bitbucketcloud/config/InterpolateHtmlPlugin.js delete mode 100644 server/sonar-bitbucketcloud/config/jest/CSSStub.js delete mode 100644 server/sonar-bitbucketcloud/config/jest/FileStub.js delete mode 100644 server/sonar-bitbucketcloud/config/jest/SetupEnzyme.js delete mode 100644 server/sonar-bitbucketcloud/config/jest/SetupTestEnvironment.js delete mode 100644 server/sonar-bitbucketcloud/config/paths.js delete mode 100644 server/sonar-bitbucketcloud/config/polyfills.js delete mode 100644 server/sonar-bitbucketcloud/config/utils.js delete mode 100644 server/sonar-bitbucketcloud/config/webpack.config.js delete mode 100644 server/sonar-bitbucketcloud/package.json delete mode 100644 server/sonar-bitbucketcloud/public/after_login.html delete mode 100644 server/sonar-bitbucketcloud/public/images/sonarcloud-icon.png delete mode 100644 server/sonar-bitbucketcloud/public/index.html delete mode 100644 server/sonar-bitbucketcloud/scripts/build.js delete mode 100644 server/sonar-bitbucketcloud/scripts/start.js delete mode 100644 server/sonar-bitbucketcloud/scripts/test.js delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/App.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/__tests__/App-test.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/__tests__/__snapshots__/App-test.tsx.snap delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/api.ts delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/Config.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/HelpLink.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/LoginButton.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/LoginForm.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/ProjectCard.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/ProjectCardHeader.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/ProjectCardMeasures.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/PullRequestWidget.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/RepoWidget.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/RepoWidgetNotConfigured.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/SonarCloudIcon.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/__tests__/Config-test.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/__tests__/LoginButton-test.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/__tests__/LoginForm-test.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/__tests__/ProjectCard-test.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/__tests__/ProjectCardHeader-test.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/__tests__/ProjectCardMeasures-test.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/__tests__/PullRequestWidget-test.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/__tests__/RepoWidget-test.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/__tests__/RepoWidgetNotConfigured-test.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/__tests__/__snapshots__/Config-test.tsx.snap delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/__tests__/__snapshots__/LoginButton-test.tsx.snap delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/__tests__/__snapshots__/LoginForm-test.tsx.snap delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/__tests__/__snapshots__/ProjectCard-test.tsx.snap delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/__tests__/__snapshots__/ProjectCardHeader-test.tsx.snap delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/__tests__/__snapshots__/ProjectCardMeasures-test.tsx.snap delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/__tests__/__snapshots__/PullRequestWidget-test.tsx.snap delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/__tests__/__snapshots__/RepoWidget-test.tsx.snap delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/__tests__/__snapshots__/RepoWidgetNotConfigured-test.tsx.snap delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/measures/MeasureBugs.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/measures/MeasureCodeSmells.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/measures/MeasureCoverage.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/measures/MeasureDuplication.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/measures/MeasureLanguages.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/measures/MeasureVulnerabilities.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/measures/__tests__/MeasureBugs-test.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/measures/__tests__/MeasureCodeSmells-test.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/measures/__tests__/MeasureCoverage-test.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/measures/__tests__/MeasureDuplication-test.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/measures/__tests__/MeasureLanguages-test.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/measures/__tests__/MeasureVulnerabilities-test.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/measures/__tests__/__snapshots__/MeasureBugs-test.tsx.snap delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/measures/__tests__/__snapshots__/MeasureCodeSmells-test.tsx.snap delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/measures/__tests__/__snapshots__/MeasureCoverage-test.tsx.snap delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/measures/__tests__/__snapshots__/MeasureDuplication-test.tsx.snap delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/measures/__tests__/__snapshots__/MeasureLanguages-test.tsx.snap delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/components/measures/__tests__/__snapshots__/MeasureVulnerabilities-test.tsx.snap delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/index.tsx delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/l10nbundle.ts delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/style.css delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/types.ts delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/typings/@atlaskit.d.ts delete mode 100644 server/sonar-bitbucketcloud/src/main/ts/utils.ts delete mode 100644 server/sonar-bitbucketcloud/tsconfig.json delete mode 100644 server/sonar-bitbucketcloud/yarn.lock diff --git a/server/sonar-bitbucketcloud/.babelrc b/server/sonar-bitbucketcloud/.babelrc deleted file mode 100644 index 5dae4d228af..00000000000 --- a/server/sonar-bitbucketcloud/.babelrc +++ /dev/null @@ -1,43 +0,0 @@ -{ - "presets": [ - [ - "env", - { - "modules": false, - "targets": { - "browsers": [ - "last 3 Chrome versions", - "last 3 Firefox versions", - "last 3 Safari versions", - "last 3 Edge versions", - "IE 11" - ] - }, - "useBuiltIns": true - } - ], - "react" - ], - "plugins": [ - "transform-class-properties", - ["transform-object-rest-spread", { "useBuiltIns": true }], - "lodash" - ], - "env": { - "production": { - "plugins": ["syntax-dynamic-import", "transform-react-constant-elements"] - }, - "development": { - "plugins": ["syntax-dynamic-import", "transform-react-jsx-source", "transform-react-jsx-self"] - }, - "test": { - "plugins": [ - "transform-es2015-modules-commonjs", - "dynamic-import-node", - "transform-react-jsx-source", - "transform-react-jsx-self" - ] - } - }, - "ignore": ["**/libs/**"] -} diff --git a/server/sonar-bitbucketcloud/.eslintrc b/server/sonar-bitbucketcloud/.eslintrc deleted file mode 100644 index a9cd649305f..00000000000 --- a/server/sonar-bitbucketcloud/.eslintrc +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "sonarqube", - - "rules": { - // some dependencies are provided by the platform, therefore not installed in a plugin - "import/no-extraneous-dependencies": "off" - } -} diff --git a/server/sonar-bitbucketcloud/.gitignore b/server/sonar-bitbucketcloud/.gitignore deleted file mode 100644 index 170910afa26..00000000000 --- a/server/sonar-bitbucketcloud/.gitignore +++ /dev/null @@ -1,29 +0,0 @@ -# nodeJS downloaded by Maven -node/ - -# nodeJS dependencies -node_modules/ -package-lock.json - -# npm logs -npm-debug.log* -npm.tar.gz -yarn-debug.log* -yarn-error.log* - -# VS Code -.vscode/ - -#webpack -.awcache/ - -# build -build/ - -# tests -src/test/json/**/*.png -lcov.info -.nyc_output - -# eslint -eslint-report.json diff --git a/server/sonar-bitbucketcloud/README.md b/server/sonar-bitbucketcloud/README.md deleted file mode 120000 index fe840054137..00000000000 --- a/server/sonar-bitbucketcloud/README.md +++ /dev/null @@ -1 +0,0 @@ -../../README.md \ No newline at end of file diff --git a/server/sonar-bitbucketcloud/build.gradle b/server/sonar-bitbucketcloud/build.gradle deleted file mode 100644 index 107953588d2..00000000000 --- a/server/sonar-bitbucketcloud/build.gradle +++ /dev/null @@ -1,34 +0,0 @@ -sonarqube { - properties { - property "sonar.projectName", "${projectTitle} :: Bitbucket Cloud" - property "sonar.sources", "src/main/ts" - property "sonar.tests", "src/main/ts" - property "sonar.test.inclusions", "src/main/ts/**/__tests__/**" - property "sonar.exclusions", "src/main/ts/**/__tests__/**" - property "sonar.eslint.reportPaths", "eslint-report.json" - } -} - -apply plugin: 'com.moowork.node' - -node { - version = '8.10.0' - yarnVersion = '1.7.0' - download = true -} - -yarn_run { - ['config', 'public', 'scripts', 'src'].each { - inputs.dir(it).withPathSensitivity(PathSensitivity.RELATIVE) - } - ['.babelrc', 'package.json', 'tsconfig.json', 'yarn.lock'].each { - inputs.file(it).withPathSensitivity(PathSensitivity.RELATIVE) - } - outputs.dir('build/webapp') - outputs.cacheIf { true } - - args = ['build'] -} - -yarn_run.dependsOn ':server:sonar-web:yarn_run' - diff --git a/server/sonar-bitbucketcloud/config/InterpolateHtmlPlugin.js b/server/sonar-bitbucketcloud/config/InterpolateHtmlPlugin.js deleted file mode 100644 index 6e318f38e10..00000000000 --- a/server/sonar-bitbucketcloud/config/InterpolateHtmlPlugin.js +++ /dev/null @@ -1,55 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -// Copied from https://github.com/facebook/create-react-app/blob/master/packages/react-dev-utils/InterpolateHtmlPlugin.js - -// This Webpack plugin lets us interpolate custom variables into `index.html`. -// Usage: `new InterpolateHtmlPlugin({ 'MY_VARIABLE': 42 })` -// Then, you can use %MY_VARIABLE% in your `index.html`. - -// It works in tandem with HtmlWebpackPlugin. -// Learn more about creating plugins like this: -// https://github.com/ampedandwired/html-webpack-plugin#events - -'use strict'; -const escapeStringRegexp = require('escape-string-regexp'); - -class InterpolateHtmlPlugin { - constructor(replacements) { - this.replacements = replacements; - } - - apply(compiler) { - compiler.hooks.compilation.tap('InterpolateHtmlPlugin', compilation => { - compilation.hooks.htmlWebpackPluginBeforeHtmlProcessing.tap('InterpolateHtmlPlugin', data => { - // Run HTML through a series of user-specified string replacements. - Object.keys(this.replacements).forEach(key => { - const value = this.replacements[key]; - data.html = data.html.replace( - new RegExp('%' + escapeStringRegexp(key) + '%', 'g'), - value - ); - }); - }); - }); - } -} - -module.exports = InterpolateHtmlPlugin; diff --git a/server/sonar-bitbucketcloud/config/jest/CSSStub.js b/server/sonar-bitbucketcloud/config/jest/CSSStub.js deleted file mode 100644 index 91a4e0d8842..00000000000 --- a/server/sonar-bitbucketcloud/config/jest/CSSStub.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -module.exports = {}; diff --git a/server/sonar-bitbucketcloud/config/jest/FileStub.js b/server/sonar-bitbucketcloud/config/jest/FileStub.js deleted file mode 100644 index bff56dc8933..00000000000 --- a/server/sonar-bitbucketcloud/config/jest/FileStub.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -module.exports = 'test-file-stub'; diff --git a/server/sonar-bitbucketcloud/config/jest/SetupEnzyme.js b/server/sonar-bitbucketcloud/config/jest/SetupEnzyme.js deleted file mode 100644 index ec2ff5f0561..00000000000 --- a/server/sonar-bitbucketcloud/config/jest/SetupEnzyme.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import Enzyme from 'enzyme'; -import Adapter from 'enzyme-adapter-react-16'; - -Enzyme.configure({ adapter: new Adapter() }); diff --git a/server/sonar-bitbucketcloud/config/jest/SetupTestEnvironment.js b/server/sonar-bitbucketcloud/config/jest/SetupTestEnvironment.js deleted file mode 100644 index 64c8d0c15aa..00000000000 --- a/server/sonar-bitbucketcloud/config/jest/SetupTestEnvironment.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -window.baseUrl = ''; -window.t = window.tp = function() { - const args = Array.prototype.slice.call(arguments, 0); - return args.join('.'); -}; diff --git a/server/sonar-bitbucketcloud/config/paths.js b/server/sonar-bitbucketcloud/config/paths.js deleted file mode 100644 index 65572298971..00000000000 --- a/server/sonar-bitbucketcloud/config/paths.js +++ /dev/null @@ -1,28 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -const path = require('path'); - -module.exports = { - appBuild: path.join(__dirname, '../build/webapp/integration/bitbucketcloud'), - appHtml: path.join(__dirname, '../public/index.html'), - appPublic: path.join(__dirname, '../public'), - jsBuild: path.join(__dirname, '../build/webapp/integration/bitbucketcloud/js'), - publicPath: '/integration/bitbucketcloud/' -}; diff --git a/server/sonar-bitbucketcloud/config/polyfills.js b/server/sonar-bitbucketcloud/config/polyfills.js deleted file mode 100644 index fdb2b100715..00000000000 --- a/server/sonar-bitbucketcloud/config/polyfills.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import 'babel-polyfill'; -import 'whatwg-fetch'; diff --git a/server/sonar-bitbucketcloud/config/utils.js b/server/sonar-bitbucketcloud/config/utils.js deleted file mode 100644 index e82b4ec5526..00000000000 --- a/server/sonar-bitbucketcloud/config/utils.js +++ /dev/null @@ -1,66 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -const cssMinimizeOptions = { - discardComments: { removeAll: true } -}; - -const cssLoader = ({ production }) => ({ - loader: 'css-loader', - options: { - importLoaders: 1, - minimize: production && cssMinimizeOptions, - url: false - } -}); - -const postcssLoader = () => ({ - loader: 'postcss-loader', - options: { - ident: 'postcss', - plugins: () => [ - require('autoprefixer'), - require('postcss-custom-properties')({ - variables: require('../../sonar-web/src/main/js/app/theme'), - preserve: false - }), - require('postcss-calc') - ] - } -}); - -const minifyParams = ({ production }) => - production && { - removeComments: true, - collapseWhitespace: true, - removeRedundantAttributes: true, - useShortDoctype: true, - removeEmptyAttributes: true, - removeStyleLinkTypeAttributes: true, - keepClosingSlash: true, - minifyJS: true, - minifyCSS: true, - minifyURLs: true - }; - -module.exports = { - cssLoader, - postcssLoader, - minifyParams -}; diff --git a/server/sonar-bitbucketcloud/config/webpack.config.js b/server/sonar-bitbucketcloud/config/webpack.config.js deleted file mode 100644 index e4d00d3c26d..00000000000 --- a/server/sonar-bitbucketcloud/config/webpack.config.js +++ /dev/null @@ -1,95 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -/* eslint-disable import/no-extraneous-dependencies */ -const path = require('path'); -const CleanWebpackPlugin = require('clean-webpack-plugin'); -const CopyWebpackPlugin = require('copy-webpack-plugin'); -const HtmlWebpackPlugin = require('html-webpack-plugin'); -const webpack = require('webpack'); -const InterpolateHtmlPlugin = require('./InterpolateHtmlPlugin'); -const paths = require('./paths'); -const utils = require('./utils'); - -module.exports = ({ production = true }) => ({ - mode: production ? 'production' : 'development', - devtool: production ? 'source-map' : 'cheap-module-source-map', - resolve: { - extensions: ['.ts', '.tsx', '.js', '.json'], - alias: { - '@sqcore': path.resolve(__dirname, '../../sonar-web/src/main/js') - } - }, - entry: [ - !production && require.resolve('react-dev-utils/webpackHotDevClient'), - require.resolve('./polyfills'), - !production && require.resolve('react-error-overlay'), - './src/main/ts/index.tsx' - ].filter(Boolean), - output: { - path: paths.appBuild, - pathinfo: !production, - publicPath: paths.publicPath, - filename: production ? 'js/[name].[chunkhash:8].js' : 'js/[name].js', - chunkFilename: production ? 'js/[name].[chunkhash:8].chunk.js' : 'js/[name].chunk.js' - }, - module: { - rules: [ - { - test: /(\.js$|\.ts(x?)$)/, - exclude: /node_modules/, - use: [ - { loader: 'babel-loader' }, - { - loader: 'ts-loader', - options: { transpileOnly: true } - } - ] - }, - { - test: /\.css$/, - use: ['style-loader', utils.cssLoader({ production }), utils.postcssLoader()] - } - ] - }, - plugins: [ - // `allowExternal: true` to remove files outside of the current dir - production && new CleanWebpackPlugin([paths.appBuild], { allowExternal: true, verbose: false }), - - new CopyWebpackPlugin([{ from: paths.appPublic, to: paths.appBuild, ignore: [paths.appHtml] }]), - - new HtmlWebpackPlugin({ - inject: false, - template: paths.appHtml, - minify: utils.minifyParams({ production }) - }), - - // keep `InterpolateHtmlPlugin` after `HtmlWebpackPlugin` - !production && - new InterpolateHtmlPlugin({ - WEB_CONTEXT: '', - BBC_APP_KEY: '', - BBC_JWT: '', - BBC_WIDGET_KEY: '', - BBC_PROJECT_KEY: '' - }), - - !production && new webpack.HotModuleReplacementPlugin() - ].filter(Boolean) -}); diff --git a/server/sonar-bitbucketcloud/package.json b/server/sonar-bitbucketcloud/package.json deleted file mode 100644 index 6bb09917d0b..00000000000 --- a/server/sonar-bitbucketcloud/package.json +++ /dev/null @@ -1,138 +0,0 @@ -{ - "name": "sonarcloud-bitbucketcloud", - "version": "0.0.1", - "description": "Bitbucket Cloud integration for SonarCloud", - "repository": "SonarSource/sonarqube", - "license": "LGPL-3.0", - "private": true, - "dependencies": { - "@atlaskit/button": "8.2.7", - "@atlaskit/checkbox": "3.1.3", - "@atlaskit/css-reset": "2.0.8", - "@atlaskit/icon": "12.8.0", - "@atlaskit/logo": "8.1.3", - "@atlaskit/reduced-ui-pack": "8.19.0", - "@atlaskit/select": "4.5.2", - "@atlaskit/spinner": "8.0.0", - "@atlaskit/tooltip": "10.3.1", - "babel-polyfill": "6.26.0", - "classnames": "2.2.6", - "lodash": "4.17.10", - "prop-types": "15.6.1", - "react": "16.4.2", - "react-dom": "16.4.2", - "react-intl": "2.4.0", - "styled-components": "3.3.3", - "whatwg-fetch": "2.0.4" - }, - "devDependencies": { - "@types/classnames": "2.2.4", - "@types/enzyme": "3.1.11", - "@types/jest": "23.3.1", - "@types/lodash": "4.14.111", - "@types/react": "16.4.8", - "@types/react-dom": "16.0.7", - "@types/react-intl": "2.3.8", - "autoprefixer": "7.1.6", - "babel-core": "6.26.3", - "babel-jest": "23.4.2", - "babel-loader": "7.1.5", - "babel-plugin-dynamic-import-node": "1.2.0", - "babel-plugin-lodash": "3.3.4", - "babel-plugin-syntax-dynamic-import": "6.18.0", - "babel-plugin-transform-class-properties": "6.24.1", - "babel-plugin-transform-object-rest-spread": "6.26.0", - "babel-plugin-transform-react-constant-elements": "6.23.0", - "babel-plugin-transform-react-jsx-self": "6.22.0", - "babel-plugin-transform-react-jsx-source": "6.22.0", - "babel-preset-env": "1.6.1", - "babel-preset-react": "6.22.0", - "chalk": "2.4.1", - "clean-webpack-plugin": "0.1.19", - "copy-webpack-plugin": "4.5.2", - "css-loader": "0.28.11", - "enzyme": "3.3.0", - "enzyme-adapter-react-16": "1.1.1", - "enzyme-to-json": "3.3.4", - "escape-string-regexp": "1.0.5", - "eslint": "4.17.0", - "eslint-config-sonarqube": "0.1.0", - "eslint-plugin-import": "2.13.0", - "eslint-plugin-jsx-a11y": "6.1.0", - "eslint-plugin-promise": "3.8.0", - "eslint-plugin-react": "7.7.0", - "eslint-plugin-sonarjs": "0.1.0", - "html-webpack-plugin": "3.0.6", - "jest": "23.4.2", - "postcss-calc": "6.0.1", - "postcss-custom-properties": "6.2.0", - "postcss-loader": "2.1.6", - "prettier": "1.14.0", - "react-dev-utils": "5.0.1", - "react-error-overlay": "1.0.7", - "react-test-renderer": "16.4.2", - "request": "2.87.0", - "style-loader": "0.21.0", - "ts-jest": "23.1.3", - "ts-loader": "4.4.2", - "typescript": "3.0.1", - "typescript-eslint-parser": "18.0.0", - "webpack": "4.16.0", - "webpack-bundle-analyzer": "2.13.1", - "webpack-dev-server": "3.1.4" - }, - "scripts": { - "start": "node scripts/start.js", - "build": "node scripts/build.js", - "test": "jest", - "coverage": "yarn jest --coverage", - "format": "yarn prettier --write --list-different 'src/main/ts/**/*.{js,ts,tsx,css}'", - "lint": "yarn eslint --ext js,ts,tsx --quiet src/main/ts", - "lint-report": "eslint --ext js,ts,tsx -f json -o eslint-report.json src/main/ts", - "prettier-check": "yarn prettier --list-different 'src/main/ts/**/*.{js,ts,tsx,css}'", - "ts-check": "yarn tsc --noEmit", - "validate": "yarn lint && yarn ts-check && yarn prettier-check && yarn test" - }, - "engines": { - "node": ">=6" - }, - "browserslist": [ - "last 3 Chrome versions", - "last 3 Firefox versions", - "last 3 Safari versions", - "last 3 Edge versions", - "IE 11" - ], - "jest": { - "coverageDirectory": "/target/coverage", - "coveragePathIgnorePatterns": ["/node_modules", "/tests"], - "moduleFileExtensions": ["ts", "tsx", "js", "json"], - "moduleNameMapper": { - "^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": - "/config/jest/FileStub.js", - "^.+\\.css$": "/config/jest/CSSStub.js", - "^@sqcore(.*)$": "/../sonar-web/src/main/js$1" - }, - "setupFiles": [ - "/config/polyfills.js", - "/config/jest/SetupTestEnvironment.js", - "/config/jest/SetupEnzyme.js" - ], - "snapshotSerializers": ["enzyme-to-json/serializer"], - "testPathIgnorePatterns": [ - "/node_modules", - "/src/main/webapp", - "/scripts" - ], - "testRegex": "(/__tests__/.*|\\-test)\\.(ts|tsx|js)$", - "transform": { - "^.+\\.js$": "/node_modules/babel-jest", - ".(ts|tsx)$": "/node_modules/ts-jest/preprocessor.js" - } - }, - "prettier": { - "jsxBracketSameLine": true, - "printWidth": 100, - "singleQuote": true - } -} diff --git a/server/sonar-bitbucketcloud/public/after_login.html b/server/sonar-bitbucketcloud/public/after_login.html deleted file mode 100644 index f746a2ff729..00000000000 --- a/server/sonar-bitbucketcloud/public/after_login.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - SonarCloud extension for Bitbucket Cloud - - - - - - - diff --git a/server/sonar-bitbucketcloud/public/images/sonarcloud-icon.png b/server/sonar-bitbucketcloud/public/images/sonarcloud-icon.png deleted file mode 100644 index bad957a1b2141febd1face9a5775ae27cbca4d39..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4069 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 diff --git a/server/sonar-bitbucketcloud/public/index.html b/server/sonar-bitbucketcloud/public/index.html deleted file mode 100644 index 097f9b472aa..00000000000 --- a/server/sonar-bitbucketcloud/public/index.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - SonarCloud extension for Bitbucket Cloud - - - -
- - - <% for (var chunk in htmlWebpackPlugin.files.chunks) { %> - - <% } %> - - - diff --git a/server/sonar-bitbucketcloud/scripts/build.js b/server/sonar-bitbucketcloud/scripts/build.js deleted file mode 100644 index 1bdb4c78d87..00000000000 --- a/server/sonar-bitbucketcloud/scripts/build.js +++ /dev/null @@ -1,56 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -/* eslint-disable no-console*/ -process.env.NODE_ENV = 'production'; - -const chalk = require('chalk'); -const webpack = require('webpack'); -const sortBy = require('lodash/sortBy'); -const getConfig = require('../config/webpack.config'); - -const config = getConfig({ production: true }); - -function build() { - console.log(chalk.cyan.bold('Creating optimized production build...')); - console.log(); - - webpack(config, (err, stats) => { - if (err) { - console.log(chalk.red.bold('Failed to create a production build!')); - console.log(chalk.red(err.message || err)); - process.exit(1); - } - - if (stats.compilation.errors && stats.compilation.errors.length) { - console.log(chalk.red.bold('Failed to create a production build!')); - stats.compilation.errors.forEach(err => console.log(chalk.red(err.message || err))); - process.exit(1); - } - - const jsonStats = stats.toJson(); - const seconds = jsonStats.time / 1000; - console.log('Duration: ' + seconds.toFixed(2) + 's'); - console.log(); - - console.log(chalk.green.bold('Compiled successfully!')); - }); -} - -build(); diff --git a/server/sonar-bitbucketcloud/scripts/start.js b/server/sonar-bitbucketcloud/scripts/start.js deleted file mode 100644 index e02b40a0f7d..00000000000 --- a/server/sonar-bitbucketcloud/scripts/start.js +++ /dev/null @@ -1,126 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -/* eslint-disable no-console */ -process.env.NODE_ENV = 'development'; - -const chalk = require('chalk'); -const webpack = require('webpack'); -const WebpackDevServer = require('webpack-dev-server'); -const clearConsole = require('react-dev-utils/clearConsole'); -const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages'); -const errorOverlayMiddleware = require('react-error-overlay/middleware'); -const request = require('request'); -const getConfig = require('../config/webpack.config'); -const paths = require('../config/paths'); - -const config = getConfig({ production: false }); - -const port = process.env.PORT || 3000; -const protocol = process.env.HTTPS === 'true' ? 'https' : 'http'; -const host = process.env.HOST || 'localhost'; -const proxy = process.env.PROXY || 'http://localhost:9000'; - -const compiler = setupCompiler(host, port, protocol); - -runDevServer(compiler, host, port, protocol); - -function setupCompiler(host, port, protocol) { - const compiler = webpack(config); - - compiler.plugin('invalid', () => { - clearConsole(); - console.log('Compiling...'); - }); - - compiler.plugin('done', stats => { - clearConsole(); - - const jsonStats = stats.toJson({}, true); - const messages = formatWebpackMessages(jsonStats); - const seconds = jsonStats.time / 1000; - if (!messages.errors.length && !messages.warnings.length) { - console.log(chalk.green('Compiled successfully!')); - console.log('Duration: ' + seconds.toFixed(2) + 's'); - console.log(); - console.log('The app is running at:'); - console.log(); - console.log(' ' + chalk.cyan(protocol + '://' + host + ':' + port + '/')); - console.log(); - } - - if (messages.errors.length) { - console.log(chalk.red('Failed to compile.')); - console.log(); - messages.errors.forEach(message => { - console.log(message); - console.log(); - }); - } - }); - - return compiler; -} - -function runDevServer(compiler, host, port, protocol) { - const devServer = new WebpackDevServer(compiler, { - before(app) { - app.use(errorOverlayMiddleware()); - app.get('/integration/bitbucketcloud/js/main.*.js', (req, res) => { - console.log('redirect:', req.url, ' to dev main.js'); - request - .get(`${protocol}://${host}:${port}/integration/bitbucketcloud/js/main.js`) - .pipe(res); - }); - }, - compress: true, - clientLogLevel: 'none', - contentBase: paths.appPublic, - disableHostCheck: true, - hot: true, - publicPath: config.output.publicPath, - quiet: true, - watchOptions: { ignored: /node_modules/ }, - https: protocol === 'https', - host, - overlay: false, - proxy: [ - { - context: [ - '/', - '/integration/bitbucketcloud/install', - '/integration/bitbucketcloud/uninstall', - '/integration/bitbucketcloud/descriptor' - ], - target: proxy - } - ] - }); - - devServer.listen(port, err => { - if (err) { - console.log(err); - return; - } - - clearConsole(); - console.log(chalk.cyan('Starting the development server...')); - console.log(); - }); -} diff --git a/server/sonar-bitbucketcloud/scripts/test.js b/server/sonar-bitbucketcloud/scripts/test.js deleted file mode 100644 index 2b6156cd2c4..00000000000 --- a/server/sonar-bitbucketcloud/scripts/test.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -process.env.NODE_ENV = 'test'; -process.env.PUBLIC_URL = ''; - -const jest = require('jest'); - -const argv = process.argv.slice(2); - -// Watch unless on CI -if (!process.env.CI) { - argv.push('--watch'); -} else { - argv.push('--ci'); -} - -jest.run(argv); diff --git a/server/sonar-bitbucketcloud/src/main/ts/App.tsx b/server/sonar-bitbucketcloud/src/main/ts/App.tsx deleted file mode 100644 index a5819891faf..00000000000 --- a/server/sonar-bitbucketcloud/src/main/ts/App.tsx +++ /dev/null @@ -1,70 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import * as React from 'react'; -import Config from './components/Config'; -import PullRequestWidget from './components/PullRequestWidget'; -import RepoWidget from './components/RepoWidget'; -import { getProjectKey, getPullRequestContext, getDisabled } from './utils'; -import { WidgetType, AppContext } from './types'; - -interface Props { - context: AppContext; - page: WidgetType; -} - -interface State { - disabled: boolean; - projectKey: string | undefined; -} - -export default class App extends React.PureComponent { - state: State = { disabled: getDisabled(), projectKey: getProjectKey() }; - - handleUpdateDisabled = (disabled: boolean) => { - this.setState({ disabled }); - }; - - handleUpdateProjectKey = (projectKey: string) => { - this.setState({ projectKey }); - }; - - render() { - const { context, page } = this.props; - const { disabled, projectKey } = this.state; - - if (page === 'repository-config') { - return ( - - ); - } - - if (page === 'pullrequest-code-quality') { - return ; - } - - return ; - } -} diff --git a/server/sonar-bitbucketcloud/src/main/ts/__tests__/App-test.tsx b/server/sonar-bitbucketcloud/src/main/ts/__tests__/App-test.tsx deleted file mode 100644 index c688d66e939..00000000000 --- a/server/sonar-bitbucketcloud/src/main/ts/__tests__/App-test.tsx +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import * as React from 'react'; -import { shallow } from 'enzyme'; -import App from '../App'; - -jest.mock('../utils', () => ({ - getDisabled: jest.fn(() => false), - getProjectKey: jest.fn(() => 'projectfoo'), - getPullRequestContext: jest.fn(() => ({ repoUuid: 'repo_uuid', prId: '1' })) -})); - -it('should display the config page', () => { - const wrapper = shallow(); - expect(wrapper).toMatchSnapshot(); - - (wrapper.find('Config').prop('updateProjectKey') as Function)('projectbar'); - expect((wrapper.instance() as App).state.projectKey).toEqual('projectbar'); -}); - -it('should display the pullrequest page', () => { - const wrapper = shallow(); - expect(wrapper).toMatchSnapshot(); -}); diff --git a/server/sonar-bitbucketcloud/src/main/ts/__tests__/__snapshots__/App-test.tsx.snap b/server/sonar-bitbucketcloud/src/main/ts/__tests__/__snapshots__/App-test.tsx.snap deleted file mode 100644 index d67016f0b4d..00000000000 --- a/server/sonar-bitbucketcloud/src/main/ts/__tests__/__snapshots__/App-test.tsx.snap +++ /dev/null @@ -1,26 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should display the config page 1`] = ` - -`; - -exports[`should display the pullrequest page 1`] = ` - -`; diff --git a/server/sonar-bitbucketcloud/src/main/ts/api.ts b/server/sonar-bitbucketcloud/src/main/ts/api.ts deleted file mode 100644 index 8e364b490c5..00000000000 --- a/server/sonar-bitbucketcloud/src/main/ts/api.ts +++ /dev/null @@ -1,126 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { parseError, parseJSON, request, RequestData } from '@sqcore/helpers/request'; -import { Paging, MyProject, IdentityProvider } from '@sqcore/app/types'; -import { - AppContext, - ProjectData, - RepositoryData, - RepositoryMeasure, - PullRequestData, - PullRequestContext -} from './types'; -import { displayMessage, proxyRequest, apiRequest, getAppKey, getRepoUuid } from './utils'; - -export function bindProject(data: AppContext & { projectKey: string }): Promise { - return post('/integration/bitbucketcloud/bind_repo', data).catch(displayWSError); -} - -export function displayWSError({ response }: { response: Response }): Promise { - parseError({ response }).then( - msg => { - displayMessage('error', 'SonarCloud Error', msg); - }, - () => {} - ); - return Promise.reject(response); -} - -export function getIdentityProviders(): Promise<{ identityProviders: IdentityProvider[] }> { - return getJSON('/api/users/identity_providers'); -} - -export function getMyProjects(data: { - p?: number; - ps?: number; -}): Promise<{ paging: Paging; projects: MyProject[] }> { - return getJSON('/api/projects/search_my_projects', data); -} - -export function getRepositoryData(data: AppContext): Promise { - return getJSON('/integration/bitbucketcloud/repo_widget_data', data).then( - (repoData: RepositoryData) => { - const measures: { [key: string]: string } = {}; - repoData.measures.forEach((measure: RepositoryMeasure) => { - if (measure.value !== undefined) { - measures[measure.metric] = measure.value; - } - }); - return { ...repoData, measures }; - } - ); -} - -export function getStoredProperty(property: string) { - return apiRequest({ - cache: false, - type: 'GET', - url: `/2.0/repositories/{}/${getRepoUuid()}/properties/${getAppKey()}/${property}` - }); -} - -export function putStoredProperty(property: string, value: Object | string | boolean | number) { - return apiRequest({ - cache: false, - contentType: 'application/json', - data: JSON.stringify(value), - type: 'PUT', - url: `/2.0/repositories/{}/${getRepoUuid()}/properties/${getAppKey()}/${property}` - }); -} - -export function getPullRequestData(context: PullRequestContext): Promise { - return getProxyJSON( - `/repositories/${context.repoUuid}/pullrequests/${context.prId}/code_quality` - ); -} - -function checkStatus(response: Response): Promise { - return new Promise((resolve, reject) => { - if (response.status >= 200 && response.status < 300) { - resolve(response); - } else { - reject({ response }); - } - }); -} - -function getProxyJSON(url: string): Promise { - return proxyRequest({ cache: false, type: 'GET', url }); -} - -function getJSON(url: string, data?: RequestData): Promise { - return request(url) - .setData(data) - .submit() - .then(checkStatus) - .then(parseJSON); -} - -function post(url: string, data?: RequestData): Promise { - return new Promise((resolve, reject) => { - request(url) - .setMethod('POST') - .setData(data) - .submit() - .then(checkStatus) - .then(() => resolve(), reject); - }); -} diff --git a/server/sonar-bitbucketcloud/src/main/ts/components/Config.tsx b/server/sonar-bitbucketcloud/src/main/ts/components/Config.tsx deleted file mode 100644 index 87415e966df..00000000000 --- a/server/sonar-bitbucketcloud/src/main/ts/components/Config.tsx +++ /dev/null @@ -1,303 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import * as React from 'react'; -import Button from '@atlaskit/button'; -import { CheckboxStateless } from '@atlaskit/checkbox'; -import Select, { createFilter } from '@atlaskit/select'; -import Spinner from '@atlaskit/spinner'; -import { getBaseUrl } from '@sqcore/helpers/urls'; -import HelpLink from './HelpLink'; -import LoginForm from './LoginForm'; -import SonarCloudIcon from './SonarCloudIcon'; -import { AppContext } from '../types'; -import { bindProject, displayWSError, getMyProjects, putStoredProperty } from '../api'; -import { displayMessage, isManualBindingAllowed } from '../utils'; - -interface ProjectOption { - label: string; - value: string; -} - -interface Props { - context: AppContext; - disabled: boolean; - projectKey?: string; - updateDisabled: (disabled: boolean) => void; - updateProjectKey: (projectKey: string) => void; -} - -interface State { - authenticated: boolean; - saving: boolean; - bindSuccess?: boolean; - disabled: boolean; - loading: boolean; - projects: ProjectOption[]; - selectedProject?: ProjectOption; -} - -export default class Config extends React.PureComponent { - filterOption = createFilter({ - ignoreCase: true, - ignoreAccents: true, - stringify: (option: ProjectOption) => `${option.label} ${option.value}`, - trim: true, - matchFrom: 'any' - }); - - mounted = false; - - constructor(props: Props) { - super(props); - this.state = { - authenticated: false, - saving: false, - disabled: props.disabled, - loading: isManualBindingAllowed(), - projects: [] - }; - } - - componentDidMount() { - this.mounted = true; - if (isManualBindingAllowed()) { - this.fetchMyProjects(); - } - } - - componentWillUnmount() { - this.mounted = false; - } - - get selectedProject() { - return ( - this.state.selectedProject || this.state.projects.find(p => p.value === this.props.projectKey) - ); - } - - fetchMyProjects = () => { - getMyProjects({ ps: 500 }).then( - ({ projects }) => { - if (this.mounted) { - const projectOptions = projects.map(p => ({ label: p.name, value: p.key })); - this.setState({ - authenticated: true, - loading: false, - projects: projectOptions - }); - } - }, - ({ response }) => { - if (this.mounted && response && response.status === 401) { - this.setState({ authenticated: false, loading: false }); - } else { - displayWSError({ response }); - } - } - ); - }; - - handleDisabledChange = () => { - this.setState(state => ({ disabled: !state.disabled })); - }; - - handleReload = () => { - window.location.reload(); - }; - - handleChange = (selectedProject?: ProjectOption) => { - if (selectedProject && !Array.isArray(selectedProject)) { - this.setState({ selectedProject }); - } - }; - - handleSubmit = (event: React.FormEvent) => { - event.preventDefault(); - const { disabled } = this.state; - - let updateBinding = false; - const promises: Promise[] = []; - if (disabled !== this.props.disabled) { - promises.push( - putStoredProperty('disabled', disabled).then(() => { - this.props.updateDisabled(disabled); - }) - ); - } - - const { selectedProject } = this; - if ( - isManualBindingAllowed() && - selectedProject && - selectedProject.value !== this.props.projectKey - ) { - updateBinding = true; - promises.push( - bindProject({ ...this.props.context, projectKey: selectedProject.value }).then(() => { - this.props.updateProjectKey(selectedProject.value); - }) - ); - } - - if (promises.length > 0) { - (document.activeElement as HTMLElement).blur(); - this.setState({ saving: true }); - Promise.all(promises).then( - () => { - if (this.mounted) { - displayMessage( - 'success', - 'SonarCloud', - updateBinding - ? 'SonarCloud project successfully linked, check the new Code Quality widget on your repository overview.' - : 'Widget visibility successfully changed.' - ); - this.setState({ saving: false }); - } - }, - () => { - if (this.mounted) { - this.setState({ saving: false }); - } - } - ); - } - }; - - renderContainer = (children: React.ReactNode) => { - const { projectKey } = this.props; - let descriptionComponent: React.ReactNode = ( - <> - To display the quality of your repository, you have to{' '} - - provision - {' '} - a project on SonarCloud and trigger an analysis. - - ); - - if (isManualBindingAllowed()) { - descriptionComponent = - 'To display the quality of your repository, you have to link it with a project analyzed on SonarCloud.'; - } else if (projectKey) { - descriptionComponent = ( - <> - This repository is already bound to a{' '} - - SonarCloud project - - - ); - } - - return ( - <> -

SonarCloud Settings

-
-
- -
-

{descriptionComponent}

- {children} -
- - ); - }; - - renderProjectsSelect = () => { - const { projects } = this.state; - - if (!projects || projects.length <= 0) { - return ( - <> -

- You don't have any project on SonarCloud yet:{' '} - - Create a project - -

- - ); - } - - return ( -
- -