-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate plugin to 10.x Sonarqube version
- Loading branch information
1 parent
9547901
commit 22a13b8
Showing
132 changed files
with
23,111 additions
and
1,709 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
container: | ||
image: maven:3.9.4-eclipse-temurin-11 | ||
|
||
build_task: | ||
maven_cache: | ||
folder: ~/.m2/repository | ||
build_script: mvn clean package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/.yarn/releases/** binary | ||
/.yarn/plugins/** binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,22 @@ | ||
.idea/ | ||
*.iml | ||
*.ipr | ||
*.iws | ||
node_modules | ||
.DS_Store | ||
target/ | ||
atlassian-ide-plugin.xml | ||
node/ | ||
.idea/ | ||
sonar-example-plugin.iml | ||
.java-version | ||
local-docker-image/extensions/plugins/* | ||
|
||
# Eclipse | ||
.classpath | ||
.project | ||
.settings/ | ||
.java-version | ||
.DS_Store | ||
|
||
# yarn | ||
.yarn/* | ||
!.yarn/cache | ||
!.yarn/patches | ||
!.yarn/plugins | ||
!.yarn/releases | ||
!.yarn/sdks | ||
!.yarn/versions |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
nodeLinker: node-modules | ||
|
||
yarnPath: .yarn/releases/yarn-4.5.0.cjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (C) 2009-2020 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. | ||
*/ | ||
// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be | ||
// injected into the application via DefinePlugin in Webpack configuration. | ||
|
||
const REACT_APP = /^REACT_APP_/i; | ||
|
||
function getClientEnvironment() { | ||
return Object.keys(process.env).filter(key => REACT_APP.test(key)).reduce((env, key) => { | ||
env['process.env.' + key] = JSON.stringify(process.env[key]); | ||
return env; | ||
}, { | ||
// Useful for determining whether we’re running in production mode. | ||
// Most importantly, it switches React into the correct mode. | ||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development') | ||
}); | ||
} | ||
|
||
module.exports = getClientEnvironment; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright (C) 2009-2020 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 = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright (C) 2009-2020 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 = 'test-file-stub'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright (C) 2009-2020 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. | ||
*/ | ||
window.baseUrl = ''; | ||
|
||
window.t = (window.tp = function() { | ||
const args = Array.prototype.slice.call(arguments, 0); | ||
return args.join('.'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (C) 2009-2020 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. | ||
*/ | ||
const webpack = require('webpack'); | ||
const config = require('./webpack.config'); | ||
|
||
config.devtool = 'eval'; | ||
|
||
config.output.publicPath = '/static/example/'; | ||
|
||
config.output.pathinfo = true; | ||
|
||
Object.keys(config.entry).forEach(key => { | ||
config.entry[key].unshift(require.resolve('react-dev-utils/webpackHotDevClient')); | ||
}); | ||
|
||
config.plugins = [new webpack.HotModuleReplacementPlugin()]; | ||
|
||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* Copyright (C) 2009-2020 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. | ||
*/ | ||
const path = require("path"); | ||
const autoprefixer = require("autoprefixer"); | ||
|
||
module.exports = { | ||
// Define the entry points here. They MUST have the same name as the page_id | ||
// defined in src/main/java/org/sonarsource/plugins/example/web/MyPluginPageDefinition.java | ||
entry: { | ||
// Using Vanilla JS: | ||
global_page: ["./src/main/js/global_page/index.js"], | ||
|
||
// Using Backbone JS: | ||
project_page: ["./src/main/js/project_page/index.js"], | ||
|
||
// Using React: | ||
portfolio_page: ["./src/main/js/portfolio_page/index.js"], | ||
admin_page: ["./src/main/js/admin_page/index.js"] | ||
}, | ||
output: { | ||
// The entry point files MUST be shipped inside the final JAR's static/ | ||
// directory. | ||
path: path.join(__dirname, "../../target/classes/static"), | ||
filename: "[name].js" | ||
}, | ||
resolve: { | ||
root: path.join(__dirname, "src/main/js") | ||
}, | ||
externals: { | ||
// React 16.8 ships with SonarQube, and should be re-used to avoid | ||
// collisions at runtime. | ||
react: "React", | ||
"react-dom": "ReactDOM", | ||
// Register the Sonar* globals as packages, to simplify importing. | ||
// See src/main/js/common/api.js for more information on what is exposed | ||
// in SonarRequest. | ||
"sonar-request": "SonarRequest", | ||
}, | ||
module: { | ||
// Our example uses Babel to transpile our code. | ||
loaders: [ | ||
{ | ||
test: /\.js$/, | ||
loader: "babel", | ||
exclude: /(node_modules)/ | ||
}, | ||
{ | ||
test: /\.css/, | ||
loader: "style-loader!css-loader!postcss-loader" | ||
}, | ||
{ test: /\.json$/, loader: "json" } | ||
] | ||
}, | ||
postcss() { | ||
return [ | ||
autoprefixer({ | ||
browsers: [ | ||
"last 3 Chrome versions", | ||
"last 3 Firefox versions", | ||
"last 3 Safari versions", | ||
"last 3 Edge versions", | ||
"IE 11" | ||
] | ||
}) | ||
]; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright (C) 2009-2020 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. | ||
*/ | ||
const webpack = require('webpack'); | ||
const config = require('./webpack.config'); | ||
const getClientEnvironment = require('../env'); | ||
|
||
// Get environment variables to inject into our app. | ||
const env = getClientEnvironment(); | ||
|
||
// Assert this just to be safe. | ||
// Development builds of React are slow and not intended for production. | ||
if (env['process.env.NODE_ENV'] !== '"production"') { | ||
throw new Error('Production builds must have NODE_ENV=production.'); | ||
} | ||
|
||
const noUglify = process.argv.some(arg => arg.indexOf('--no-uglify') > -1); | ||
|
||
// Don't attempt to continue if there are any errors. | ||
config.bail = true; | ||
|
||
config.plugins = [ | ||
// Makes some environment variables available to the JS code, for example: | ||
// if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`. | ||
// It is absolutely essential that NODE_ENV was set to production here. | ||
// Otherwise React will be compiled in the very slow development mode. | ||
new webpack.DefinePlugin(env), | ||
|
||
// This helps ensure the builds are consistent if source hasn't changed: | ||
new webpack.optimize.OccurrenceOrderPlugin(), | ||
|
||
// Try to dedupe duplicated modules, if any: | ||
new webpack.optimize.DedupePlugin() | ||
]; | ||
|
||
if (!noUglify) { | ||
config.plugins.push( | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compress: { | ||
screw_ie8: true, // React doesn't support IE8 | ||
warnings: false | ||
}, | ||
mangle: { | ||
screw_ie8: true | ||
}, | ||
output: { | ||
comments: false, | ||
screw_ie8: true | ||
} | ||
}) | ||
); | ||
} | ||
|
||
module.exports = config; |
Oops, something went wrong.