Skip to content

Commit 5f972b5

Browse files
authored
Merge pull request #3 from CfrancCyrille/dev
Dashboard
2 parents 38445cd + d23901d commit 5f972b5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+7382
-5
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ buildNumber.properties
1919
# Avoid ignoring Eclipse project specific configuration if someone use another IDE
2020
# /.project
2121
/bin/
22+
# Web
23+
/node/
24+
/node_modules/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
eclipse.preferences.version=1
22
encoding//src/main/java=UTF-8
33
encoding//src/main/resources=UTF-8
4+
encoding//src/test/java=UTF-8
45
encoding//src/test/resources=UTF-8
56
encoding/<project>=UTF-8

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1+
# sonar-icode-cnes-plugin
2+
[![Build Status](https://travis-ci.org/lequal/sonar-icode-cnes-plugin.svg?branch=master)](https://travis-ci.org/lequal/sonar-icode-cnes-plugin)
3+
[![SonarQube Coverage](https://sonarcloud.io/api/badges/gate?key=fr.cnes.sonarqube.plugins:sonar-icode-plugin)](https://sonarcloud.io/dashboard?id=fr.cnes.sonarqube.plugins%3Asonar-icode-plugin)
4+
========
15
Sonar Plugin for the code analysys tool : ICode

conf/env.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright (C) 2017-2017 SonarSource SA
3+
* All rights reserved
4+
* mailto:info AT sonarsource DOT com
5+
*/
6+
// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
7+
// injected into the application via DefinePlugin in Webpack configuration.
8+
9+
const REACT_APP = /^REACT_APP_/i;
10+
11+
function getClientEnvironment() {
12+
return Object.keys(process.env).filter(key => REACT_APP.test(key)).reduce((env, key) => {
13+
env['process.env.' + key] = JSON.stringify(process.env[key]);
14+
return env;
15+
}, {
16+
// Useful for determining whether we’re running in production mode.
17+
// Most importantly, it switches React into the correct mode.
18+
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
19+
});
20+
}
21+
22+
module.exports = getClientEnvironment;

conf/jest/CSSStub.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*
2+
* Copyright (C) 2017-2017 SonarSource SA
3+
* All rights reserved
4+
* mailto:info AT sonarsource DOT com
5+
*/
6+
module.exports = {};

conf/jest/FileStub.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*
2+
* Copyright (C) 2017-2017 SonarSource SA
3+
* All rights reserved
4+
* mailto:info AT sonarsource DOT com
5+
*/
6+
module.exports = 'test-file-stub';

conf/jest/SetupTestEnvironment.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
* Copyright (C) 2017-2017 SonarSource SA
3+
* All rights reserved
4+
* mailto:info AT sonarsource DOT com
5+
*/
6+
window.baseUrl = '';
7+
8+
window.t = (window.tp = function() {
9+
const args = Array.prototype.slice.call(arguments, 0);
10+
return args.join('.');
11+
});

conf/webpack/webpack.config.dev.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright (C) 2017-2017 SonarSource SA
3+
* All rights reserved
4+
* mailto:info AT sonarsource DOT com
5+
*/
6+
const webpack = require('webpack');
7+
const config = require('./webpack.config');
8+
9+
config.devtool = 'eval';
10+
11+
config.output.publicPath = '/static/icode/';
12+
13+
config.output.pathinfo = true;
14+
15+
Object.keys(config.entry).forEach(key => {
16+
config.entry[key].unshift(require.resolve('react-dev-utils/webpackHotDevClient'));
17+
});
18+
19+
config.plugins = [new webpack.HotModuleReplacementPlugin()];
20+
21+
module.exports = config;

conf/webpack/webpack.config.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright (C) 2017-2017 SonarSource SA
3+
* All rights reserved
4+
* mailto:info AT sonarsource DOT com
5+
*/
6+
const path = require('path');
7+
const autoprefixer = require('autoprefixer');
8+
9+
const autoprefixerOptions = {
10+
browsers: [
11+
'last 3 Chrome versions',
12+
'last 3 Firefox versions',
13+
'Safari >= 8',
14+
'Edge >= 12',
15+
'IE 11'
16+
]
17+
};
18+
19+
const output = path.join(__dirname, '../../target/classes/static');
20+
21+
module.exports = {
22+
entry: {
23+
'icode_metrics_summary': ['./src/main/js/app-metrics_summary.js'],
24+
},
25+
output: {
26+
path: output,
27+
filename: '[name].js'
28+
},
29+
resolve: {
30+
root: path.join(__dirname, 'src/main/js')
31+
},
32+
externals: {
33+
lodash: '_',
34+
react: 'React',
35+
'react-dom': 'ReactDOM',
36+
'react-redux': 'ReactRedux',
37+
'react-router': 'ReactRouter',
38+
'sonar-request': 'SonarRequest',
39+
'sonar-measures': 'SonarMeasures',
40+
'sonar-components': 'SonarComponents'
41+
},
42+
module: {
43+
loaders: [
44+
{
45+
test: /\.js$/,
46+
loader: 'babel',
47+
exclude: /(node_modules)/
48+
},
49+
{
50+
test: /\.css/,
51+
loader: 'style-loader!css-loader!postcss-loader'
52+
},
53+
{ test: /\.json$/, loader: 'json' }
54+
]
55+
},
56+
postcss() {
57+
return [autoprefixer(autoprefixerOptions)];
58+
}
59+
};
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Copyright (C) 2017-2017 SonarSource SA
3+
* All rights reserved
4+
* mailto:info AT sonarsource DOT com
5+
*/
6+
const webpack = require('webpack');
7+
const config = require('./webpack.config');
8+
const getClientEnvironment = require('../env');
9+
10+
// Get environment variables to inject into our app.
11+
const env = getClientEnvironment();
12+
13+
// Assert this just to be safe.
14+
// Development builds of React are slow and not intended for production.
15+
if (env['process.env.NODE_ENV'] !== '"production"') {
16+
throw new Error('Production builds must have NODE_ENV=production.');
17+
}
18+
19+
const noUglify = process.argv.some(arg => arg.indexOf('--no-uglify') > -1);
20+
21+
// Don't attempt to continue if there are any errors.
22+
config.bail = true;
23+
24+
config.plugins = [
25+
// Makes some environment variables available to the JS code, for example:
26+
// if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`.
27+
// It is absolutely essential that NODE_ENV was set to production here.
28+
// Otherwise React will be compiled in the very slow development mode.
29+
new webpack.DefinePlugin(env),
30+
31+
// This helps ensure the builds are consistent if source hasn't changed:
32+
new webpack.optimize.OccurrenceOrderPlugin(),
33+
34+
// Try to dedupe duplicated modules, if any:
35+
new webpack.optimize.DedupePlugin()
36+
];
37+
38+
if (!noUglify) {
39+
config.plugins.push(
40+
new webpack.optimize.UglifyJsPlugin({
41+
compress: {
42+
screw_ie8: true, // React doesn't support IE8
43+
warnings: false
44+
},
45+
mangle: {
46+
screw_ie8: true
47+
},
48+
output: {
49+
comments: false,
50+
screw_ie8: true
51+
}
52+
})
53+
);
54+
}
55+
56+
module.exports = config;

0 commit comments

Comments
 (0)