diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-12-08 12:41:02 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-12-08 12:46:08 +0100 |
commit | 0a3a9ea2a47fe09082d9079fdc89a2a025de79e2 (patch) | |
tree | 9d04bce0eb435adf9a79ea360727798b5b6c4b97 | |
parent | 1a45e47fdeca85e1884775243187e32ab294c8e3 (diff) | |
download | sonarqube-0a3a9ea2a47fe09082d9079fdc89a2a025de79e2.tar.gz sonarqube-0a3a9ea2a47fe09082d9079fdc89a2a025de79e2.zip |
improve code quality
26 files changed, 48 insertions, 219 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/MeasureFilterAsTreemapWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/MeasureFilterAsTreemapWidget.java index 3eb4c9f5895..6ade71d3c62 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/MeasureFilterAsTreemapWidget.java +++ b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/MeasureFilterAsTreemapWidget.java @@ -40,7 +40,7 @@ import static org.sonar.api.web.WidgetScope.GLOBAL; defaultValue = CoreMetrics.COVERAGE_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS, "type:PERCENT,RATING,LEVEL"}), @WidgetProperty(key = MeasureFilterAsTreemapWidget.HEIGHT_PERCENTS_PROPERTY, type = WidgetPropertyType.INTEGER, - optional = true, defaultValue = "55", description = "Height in percents of width"), + defaultValue = "55", description = "Height in percents of width", optional = true), @WidgetProperty(key = MeasureFilterAsTreemapWidget.MAX_ITEMS_PROPERTY, type = WidgetPropertyType.INTEGER, defaultValue = "30") }) diff --git a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/TreemapWidget.java b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/TreemapWidget.java index e70a341b431..3033e013c3e 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/TreemapWidget.java +++ b/server/sonar-server/src/main/java/org/sonar/server/dashboard/widget/TreemapWidget.java @@ -27,10 +27,11 @@ import org.sonar.api.web.WidgetPropertyType; @WidgetProperties({ @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING), - @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.NCLOC_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}), + @WidgetProperty(key = "sizeMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.NCLOC_KEY, + options = {WidgetConstants.FILTER_OUT_NEW_METRICS}), @WidgetProperty(key = "colorMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.COVERAGE_KEY, options = {WidgetConstants.FILTER_OUT_NEW_METRICS, "type:PERCENT,RATING,LEVEL"}), - @WidgetProperty(key = "heightInPercents", type = WidgetPropertyType.INTEGER, optional = true, defaultValue = "55"), + @WidgetProperty(key = "heightInPercents", type = WidgetPropertyType.INTEGER, defaultValue = "55", optional = true), @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "100") }) public class TreemapWidget extends CoreWidget { diff --git a/server/sonar-web/.eslintignore b/server/sonar-web/.eslintignore index d2424ba88a4..1e86f01a222 100644 --- a/server/sonar-web/.eslintignore +++ b/server/sonar-web/.eslintignore @@ -1,2 +1,2 @@ -src/main/js/libs/third-party +src/main/js/libs tests diff --git a/server/sonar-web/.eslintrc b/server/sonar-web/.eslintrc index d37d4bd0082..6a403ba8a2f 100644 --- a/server/sonar-web/.eslintrc +++ b/server/sonar-web/.eslintrc @@ -1,190 +1,17 @@ { + "extends": "eslint:recommended", + + "ecmaFeatures": { + "jsx": true, + "modules": true + }, + "env": { "browser": true, "es6": true, "mocha": true, "node": true }, - "ecmaFeatures": { - "modules": true, - "jsx": true - }, - - "rules": { - ////////// Possible Errors ////////// - - "comma-dangle": 0, // disallow trailing commas in object literals - "no-cond-assign": 2, // disallow assignment in conditional expressions - "no-console": 2, // disallow use of console (off by default in the node environment) - "no-constant-condition": 2, // disallow use of constant expressions in conditions - "no-control-regex": 0, // disallow control characters in regular expressions - "no-debugger": 2, // disallow use of debugger - "no-dupe-keys": 2, // disallow duplicate keys when creating object literals - "no-empty": 2, // disallow empty statements - "no-empty-character-class": 2, // disallow the use of empty character classes in regular expressions - "no-ex-assign": 2, // disallow assigning to the exception in a catch block - "no-extra-boolean-cast": 0, // disallow double-negation boolean casts in a boolean context - "no-extra-parens": 0, // disallow unnecessary parentheses (off by default) - "no-extra-semi": 2, // disallow unnecessary semicolons - "no-func-assign": 2, // disallow overwriting functions written as function declarations - "no-inner-declarations": 2, // disallow function or variable declarations in nested blocks - "no-invalid-regexp": 2, // disallow invalid regular expression strings in the RegExp constructor - "no-irregular-whitespace": 2, // disallow irregular whitespace outside of strings and comments - "no-negated-in-lhs": 2, // disallow negation of the left operand of an in expression - "no-obj-calls": 2, // disallow the use of object properties of the global object (Math and JSON) as functions - "no-regex-spaces": 2, // disallow multiple spaces in a regular expression literal - "quote-props": 2, // disallow reserved words being used as object literal keys (off by default) - "no-sparse-arrays": 2, // disallow sparse arrays - "no-unreachable": 2, // disallow unreachable statements after a return, throw, continue, or break statement - "use-isnan": 2, // disallow comparisons with the value NaN - "valid-jsdoc": 0, // Ensure JSDoc comments are valid (off by default) - "valid-typeof": 2, // Ensure that the results of typeof are compared against a valid string - - - ////////// Best Practices ////////// - - "block-scoped-var": 0, // treat var statements as if they were block scoped (off by default) - "complexity": 0, // specify the maximum cyclomatic complexity allowed in a program (off by default) - "consistent-return": 0, // require return statements to either always or never specify values - "curly": 2, // specify curly brace conventions for all control statements - "default-case": 1, // require default case in switch statements (off by default) - "dot-notation": 0, // encourages use of dot notation whenever possible - "eqeqeq": [2, "allow-null"],// require the use of === and !== - "guard-for-in": 2, // make sure for-in loops have an if statement (off by default) - "no-alert": 1, // disallow the use of alert, confirm, and prompt - "no-caller": 2, // disallow use of arguments.caller or arguments.callee - "no-div-regex": 2, // disallow division operators explicitly at beginning of regular expression (off by default) - "no-else-return": 0, // disallow else after a return in an if (off by default) - "no-empty-label": 2, // disallow use of labels for anything other then loops and switches - "no-eq-null": 0, // disallow comparisons to null without a type-checking operator (off by default) - "no-eval": 2, // disallow use of eval() - "no-extend-native": 2, // disallow adding to native types - "no-extra-bind": 0, // disallow unnecessary function binding - "no-fallthrough": 2, // disallow fallthrough of case statements - "no-floating-decimal": 0, // disallow the use of leading or trailing decimal points in numeric literals (off by default) - "no-implied-eval": 2, // disallow use of eval()-like methods - "no-iterator": 2, // disallow usage of __iterator__ property - "no-labels": 2, // disallow use of labeled statements - "no-lone-blocks": 0, // disallow unnecessary nested blocks - "no-loop-func": 0, // disallow creation of functions within loops - "no-multi-spaces": 2, // disallow use of multiple spaces - "no-multi-str": 0, // disallow use of multiline strings - "no-native-reassign": 0, // disallow reassignments of native objects - "no-new": 0, // disallow use of new operator when not part of the assignment or comparison - "no-new-func": 2, // disallow use of new operator for Function object - "no-new-wrappers": 2, // disallows creating new instances of String, Number, and Boolean - "no-octal": 2, // disallow use of octal literals - "no-octal-escape": 2, // disallow use of octal escape sequences in string literals, such as var foo = "Copyright \251"; - "no-process-env": 2, // disallow use of process.env (off by default) - "no-proto": 2, // disallow usage of __proto__ property - "no-redeclare": 2, // disallow declaring the same variable more then once - "no-return-assign": 2, // disallow use of assignment in return statement - "no-script-url": 2, // disallow use of javascript: urls. - "no-self-compare": 2, // disallow comparisons where both sides are exactly the same (off by default) - "no-sequences": 2, // disallow use of comma operator - "no-unused-expressions": 2, // disallow usage of expressions in statement position - "no-void": 1, // disallow use of void operator (off by default) - "no-warning-comments": 0, // disallow usage of configurable warning terms in comments, e.g. TODO or FIXME (off by default) - "no-with": 2, // disallow use of the with statement - "radix": 2, // require use of the second argument for parseInt() (off by default) - "vars-on-top": 0, // requires to declare all vars on top of their containing scope (off by default) - "wrap-iife": 0, // require immediate function invocation to be wrapped in parentheses (off by default) - "yoda": 0, // require or disallow Yoda conditions - - - ////////// Strict Mode ////////// - - "global-strict": 0, // (deprecated) require or disallow the "use strict" pragma in the global scope (off by default in the node environment) - "no-extra-strict": 0, // (deprecated) disallow unnecessary use of "use strict"; when already in strict mode - "strict": 0, // controls location of Use Strict Directives - - - ////////// Variables ////////// - - "no-catch-shadow": 2, // disallow the catch clause parameter name being the same as a variable in the outer scope (off by default in the node environment) - "no-delete-var": 0, // disallow deletion of variables - "no-label-var": 2, // disallow labels that share a name with a variable - "no-shadow": 1, // disallow declaration of variables already declared in the outer scope - "no-shadow-restricted-names": 1, // disallow shadowing of names such as arguments - "no-undef": 2, // disallow use of undeclared variables unless mentioned in a /*global */ block - "no-undef-init": 2, // disallow use of undefined when initializing variables - "no-undefined": 0, // disallow use of undefined variable (off by default) - "no-unused-vars": 2, // disallow declaration of variables that are not used in the code - "no-use-before-define": 0, // disallow use of variables before they are defined - - - ////////// Node.js ////////// - - "handle-callback-err": 0, // enforces error handling in callbacks (off by default) (on by default in the node environment) - "no-mixed-requires": 0, // disallow mixing regular variable and require declarations (off by default) (on by default in the node environment) - "no-new-require": 0, // disallow use of new operator with the require function (off by default) (on by default in the node environment) - "no-path-concat": 0, // disallow string concatenation with __dirname and __filename (off by default) (on by default in the node environment) - "no-process-exit": 0, // disallow process.exit() (on by default in the node environment) - "no-restricted-modules": 0, // restrict usage of specified node modules (off by default) - "no-sync": 0, // disallow use of synchronous methods (off by default) - - - ////////// Stylistic Issues ////////// - - "brace-style": 0, // enforce one true brace style (off by default) - "camelcase": 0, // require camel case names - "comma-spacing": 0, // enforce spacing before and after comma - "comma-style": 0, // enforce one true comma style (off by default) - "consistent-this": 0, // enforces consistent naming when capturing the current execution context (off by default) - "eol-last": 0, // enforce newline at the end of file, with no multiple empty lines - "func-names": 0, // require function expressions to have a name (off by default) - "func-style": 0, // enforces use of function declarations or expressions (off by default) - "key-spacing": 0, // enforces spacing between keys and values in object literal properties - "max-nested-callbacks": 0, // specify the maximum depth callbacks can be nested (off by default) - "new-cap": 0, // require a capital letter for constructors - "new-parens": 0, // disallow the omission of parentheses when invoking a constructor with no arguments - "no-array-constructor": 2, // disallow use of the Array constructor - "no-inline-comments": 0, // disallow comments inline after code (off by default) - "no-lonely-if": 0, // disallow if as the only statement in an else block (off by default) - "no-mixed-spaces-and-tabs": 2, // disallow mixed spaces and tabs for indentation - "no-multiple-empty-lines": 0, // disallow multiple empty lines (off by default) - "no-nested-ternary": 1, // disallow nested ternary expressions (off by default) - "no-new-object": 0, // disallow use of the Object constructor - "semi-spacing": [2, { "before": false, "after": true }], - "no-spaced-func": 0, // disallow space between function identifier and application - "no-ternary": 0, // disallow the use of ternary operators (off by default) - "no-trailing-spaces": 2, // disallow trailing whitespace at the end of lines - "no-underscore-dangle": 0, // disallow dangling underscores in identifiers - "no-wrap-func": 0, // disallow wrapping of non-IIFE statements in parens - "one-var": 0, // allow just one var statement per function (off by default) - "operator-assignment": 0, // require assignment operator shorthand where possible or prohibit it entirely (off by default) - "padded-blocks": 0, // enforce padding within blocks (off by default) - "quote-props": 0, // require quotes around object literal property names (off by default) - "quotes": [2, "single"], // specify whether double or single quotes should be used - "semi": 2, // require or disallow use of semicolons instead of ASI - "sort-vars": 0, // sort variables within the same declaration block (off by default) - "space-after-function-name": 0, // require a space after function names (off by default) - "space-after-keywords": 0, // require a space after certain keywords (off by default) - "space-before-blocks": 0, // require or disallow space before blocks (off by default) - "space-in-brackets": 0, // require or disallow spaces inside brackets (off by default) - "space-in-parens": 0, // require or disallow spaces inside parentheses (off by default) - "space-infix-ops": 0, // require spaces around operators - "space-return-throw-case": 2, // require a space after return, throw, and case - "space-unary-ops": 0, // Require or disallow spaces before/after unary operators (words on by default, nonwords off by default) - "spaced-line-comment": 0, // require or disallow a space immediately following the // in a line comment (off by default) - "wrap-regex": 0, // require regex literals to be wrapped in parentheses (off by default) - - - ////////// ECMAScript 6 ////////// - - "no-var": 0, // require let or const instead of var (off by default) - "generator-star": 0, // enforce the position of the * in generator functions (off by default) - - - ////////// Legacy ////////// - - "max-depth": 0, // specify the maximum depth that blocks can be nested (off by default) - "max-len": 0, // specify the maximum length of a line in your program (off by default) - "max-params": 0, // limits the number of parameters that can be used in the function declaration. (off by default) - "max-statements": 0, // specify the maximum number of statement allowed in a function (off by default) - "no-bitwise": 0, // disallow use of bitwise operators (off by default) - "no-plusplus": 0 // disallow use of unary operators, ++ and -- (off by default) - }, "globals": { "define": true, @@ -196,8 +23,16 @@ "t": true, "tp": true }, + + "parser": "babel-eslint", + "plugins": [ "react", "mocha" - ] + ], + + "rules": { + "quotes": [ 2, "single", "avoid-escape" ], + "react/jsx-uses-react": 1 + } } diff --git a/server/sonar-web/package.json b/server/sonar-web/package.json index 46d8eedc290..38d0e420486 100644 --- a/server/sonar-web/package.json +++ b/server/sonar-web/package.json @@ -6,6 +6,7 @@ "license": "LGPL-3.0", "devDependencies": { "babel": "5.8.23", + "babel-eslint": "^4.1.6", "babelify": "6.3.0", "backbone": "1.2.3", "backbone.marionette": "2.4.3", @@ -17,6 +18,9 @@ "clipboard": "1.5.5", "d3": "3.5.6", "del": "2.0.2", + "eslint": "^1.10.3", + "eslint-plugin-mocha": "^1.1.0", + "eslint-plugin-react": "^3.11.3", "event-stream": "3.3.1", "glob": "5.0.15", "gulp": "3.9.0", @@ -56,7 +60,8 @@ "build-fast": "gulp --fast", "build": "gulp", "test": "./node_modules/.bin/mocha --opts tests/mocha.opts tests", - "coverage": "./node_modules/.bin/babel-node ./node_modules/.bin/isparta cover --dir './target/coverage' ./node_modules/.bin/_mocha -- --opts tests/mocha.opts tests" + "coverage": "./node_modules/.bin/babel-node ./node_modules/.bin/isparta cover --dir './target/coverage' ./node_modules/.bin/_mocha -- --opts tests/mocha.opts tests", + "lint": "eslint src/main/js" }, "browserify-shim": { "jquery": "global:jQuery", diff --git a/server/sonar-web/src/main/js/api/metrics.js b/server/sonar-web/src/main/js/api/metrics.js index 66bf7482c00..9bb7cfb67ca 100644 --- a/server/sonar-web/src/main/js/api/metrics.js +++ b/server/sonar-web/src/main/js/api/metrics.js @@ -1,4 +1,3 @@ -import _ from 'underscore'; import { getJSON } from '../helpers/request.js'; export function getMetrics () { diff --git a/server/sonar-web/src/main/js/apps/background-tasks/search.js b/server/sonar-web/src/main/js/apps/background-tasks/search.js index 5d122b614ab..a1624f02aae 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/search.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/search.js @@ -1,9 +1,8 @@ import $ from 'jquery'; -import _ from 'underscore'; import moment from 'moment'; import React from 'react'; import RadioToggle from '../../components/shared/radio-toggle'; -import {STATUSES, CURRENTS, DATE, DATE_FORMAT, DEBOUNCE_DELAY} from './constants'; +import { STATUSES, CURRENTS, DATE, DATE_FORMAT } from './constants'; export default React.createClass({ componentDidUpdate() { diff --git a/server/sonar-web/src/main/js/apps/overview/components/coverage-measures.js b/server/sonar-web/src/main/js/apps/overview/components/coverage-measures.js index 48bab238633..3fdf521a872 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/coverage-measures.js +++ b/server/sonar-web/src/main/js/apps/overview/components/coverage-measures.js @@ -3,7 +3,7 @@ import React from 'react'; import { DetailedMeasure } from './detailed-measure'; import { DonutChart } from '../../../components/charts/donut-chart'; import { DrilldownLink } from '../../../components/shared/drilldown-link'; -import { formatMeasure, formatMeasureVariation, localizeMetric } from '../../../helpers/measures'; +import { formatMeasure, formatMeasureVariation } from '../../../helpers/measures'; export const CoverageMeasures = React.createClass({ diff --git a/server/sonar-web/src/main/js/apps/overview/components/legend.js b/server/sonar-web/src/main/js/apps/overview/components/legend.js index 4e4de8f5882..d738f6df3b4 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/legend.js +++ b/server/sonar-web/src/main/js/apps/overview/components/legend.js @@ -1,5 +1,4 @@ import React from 'react'; -import moment from 'moment'; import { DomainLeakTitle } from '../main/components'; diff --git a/server/sonar-web/src/main/js/apps/overview/domains/coverage-domain.js b/server/sonar-web/src/main/js/apps/overview/domains/coverage-domain.js index f9aabc06ec6..5edafc83856 100644 --- a/server/sonar-web/src/main/js/apps/overview/domains/coverage-domain.js +++ b/server/sonar-web/src/main/js/apps/overview/domains/coverage-domain.js @@ -82,7 +82,7 @@ export const CoverageMain = React.createClass({ }, renderLegend () { - return <DomainLeakTitle inline={true} label={this.state.leakPeriodLabel} date={this.state.leakPeriodDate}/> + return <DomainLeakTitle inline={true} label={this.state.leakPeriodLabel} date={this.state.leakPeriodDate}/>; }, render () { diff --git a/server/sonar-web/src/main/js/apps/overview/domains/debt-domain.js b/server/sonar-web/src/main/js/apps/overview/domains/debt-domain.js index cb539bc9cb4..179520a106f 100644 --- a/server/sonar-web/src/main/js/apps/overview/domains/debt-domain.js +++ b/server/sonar-web/src/main/js/apps/overview/domains/debt-domain.js @@ -15,7 +15,6 @@ import { AddedRemovedMeasure, AddedRemovedDebt, OnNewCodeMeasure, SeverityMeasur import { IssuesTags } from './../components/issues-tags'; import Assignees from './../components/issues-assignees'; import { getFacet, extractAssignees } from '../../../api/issues'; -import StatusHelper from '../../../components/shared/status-helper'; import { Rating } from '../../../components/shared/rating'; import { DrilldownLink } from '../../../components/shared/drilldown-link'; import { DomainLeakTitle } from '../main/components'; @@ -102,7 +101,7 @@ export const IssuesMain = React.createClass({ }, renderLegend () { - return <DomainLeakTitle inline={true} label={this.state.leakPeriodLabel} date={this.state.leakPeriodDate}/> + return <DomainLeakTitle inline={true} label={this.state.leakPeriodLabel} date={this.state.leakPeriodDate}/>; }, renderOtherMeasures() { diff --git a/server/sonar-web/src/main/js/apps/overview/domains/duplications-domain.js b/server/sonar-web/src/main/js/apps/overview/domains/duplications-domain.js index 709fa1b8f86..321595b779d 100644 --- a/server/sonar-web/src/main/js/apps/overview/domains/duplications-domain.js +++ b/server/sonar-web/src/main/js/apps/overview/domains/duplications-domain.js @@ -11,7 +11,7 @@ import { TooltipsMixin } from '../../../components/mixins/tooltips-mixin'; import { filterMetrics, filterMetricsForDomains } from '../helpers/metrics'; import { DomainLeakTitle } from '../main/components'; import { CHART_COLORS_RANGE_PERCENT } from '../../../helpers/constants'; -import { formatMeasure, formatMeasureVariation, localizeMetric } from '../../../helpers/measures'; +import { formatMeasure, formatMeasureVariation } from '../../../helpers/measures'; import { DonutChart } from '../../../components/charts/donut-chart'; import { DrilldownLink } from '../../../components/shared/drilldown-link'; import { getMetricName } from '../helpers/metrics'; @@ -77,7 +77,7 @@ export const DuplicationsMain = React.createClass({ }, renderLegend () { - return <DomainLeakTitle inline={true} label={this.state.leakPeriodLabel} date={this.state.leakPeriodDate}/> + return <DomainLeakTitle inline={true} label={this.state.leakPeriodLabel} date={this.state.leakPeriodDate}/>; }, renderMeasures() { diff --git a/server/sonar-web/src/main/js/apps/overview/domains/size-domain.js b/server/sonar-web/src/main/js/apps/overview/domains/size-domain.js index 18f0f4caddf..26f4af61cb1 100644 --- a/server/sonar-web/src/main/js/apps/overview/domains/size-domain.js +++ b/server/sonar-web/src/main/js/apps/overview/domains/size-domain.js @@ -64,7 +64,7 @@ export const SizeMain = React.createClass({ }, renderLegend () { - return <DomainLeakTitle inline={true} label={this.state.leakPeriodLabel} date={this.state.leakPeriodDate}/> + return <DomainLeakTitle inline={true} label={this.state.leakPeriodLabel} date={this.state.leakPeriodDate}/>; }, renderOtherMeasures(domain, hiddenMetrics) { @@ -102,7 +102,7 @@ export const SizeMain = React.createClass({ if (distribution == null) { return null; } - return <ComplexityDistribution distribution={distribution} {...props}/> + return <ComplexityDistribution distribution={distribution} {...props}/>; }, renderComplexityCard() { diff --git a/server/sonar-web/src/main/js/apps/overview/main/issues.js b/server/sonar-web/src/main/js/apps/overview/main/issues.js index 67b37bd6049..f92e7ce12a9 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/issues.js +++ b/server/sonar-web/src/main/js/apps/overview/main/issues.js @@ -5,7 +5,6 @@ import { Domain, DomainHeader, DomainPanel, DomainNutshell, DomainLeak, Measures import { Rating } from './../../../components/shared/rating'; import { IssuesLink } from '../../../components/shared/issues-link'; import { DrilldownLink } from '../../../components/shared/drilldown-link'; -import SeverityIcon from '../../../components/shared/severity-icon'; import { TooltipsMixin } from '../../../components/mixins/tooltips-mixin'; import { Legend } from '../components/legend'; import { getMetricName } from '../helpers/metrics'; diff --git a/server/sonar-web/src/main/js/apps/overview/main/main.js b/server/sonar-web/src/main/js/apps/overview/main/main.js index 71c45428052..3d458a74c55 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/main.js +++ b/server/sonar-web/src/main/js/apps/overview/main/main.js @@ -9,9 +9,8 @@ import { GeneralSize } from './size'; import { CoverageSelectionMixin } from '../components/coverage-selection-mixin'; import { getPeriodLabel, getPeriodDate } from './../helpers/periods'; import { getMeasuresAndVariations } from '../../../api/measures'; -import { getFacet, getIssuesCount } from '../../../api/issues'; +import { getIssuesCount } from '../../../api/issues'; import { getTimeMachineData } from '../../../api/time-machine'; -import { SEVERITIES } from '../../../helpers/constants'; const METRICS_LIST = [ @@ -36,11 +35,6 @@ const HISTORY_METRICS_LIST = [ ]; -function getFacetValue (facet, key) { - return _.findWhere(facet, { val: key }).count; -} - - export default React.createClass({ mixins: [CoverageSelectionMixin], diff --git a/server/sonar-web/src/main/js/apps/project-permissions/qualifier-filter.js b/server/sonar-web/src/main/js/apps/project-permissions/qualifier-filter.js index 3d121fe50e3..ef1fd1a9fca 100644 --- a/server/sonar-web/src/main/js/apps/project-permissions/qualifier-filter.js +++ b/server/sonar-web/src/main/js/apps/project-permissions/qualifier-filter.js @@ -8,7 +8,7 @@ const rootQualifiersToOptions = (qualifiers) => { return { value: q, label: window.t('qualifiers', q) - } + }; }); }; diff --git a/server/sonar-web/src/main/js/apps/system/item-log-level.js b/server/sonar-web/src/main/js/apps/system/item-log-level.js index 2ca73615e1b..641a6a870c5 100644 --- a/server/sonar-web/src/main/js/apps/system/item-log-level.js +++ b/server/sonar-web/src/main/js/apps/system/item-log-level.js @@ -29,6 +29,6 @@ export default React.createClass({ onChange={this.onChange} value={this.state.level}>{options}</select> {warning} - </div> + </div>; } }); diff --git a/server/sonar-web/src/main/js/apps/users/tokens-view.js b/server/sonar-web/src/main/js/apps/users/tokens-view.js index fccd64a2876..f3277b1fea0 100644 --- a/server/sonar-web/src/main/js/apps/users/tokens-view.js +++ b/server/sonar-web/src/main/js/apps/users/tokens-view.js @@ -29,7 +29,7 @@ export default Modal.extend({ return getTokens(this.model.id).then(tokens => { this.tokens = tokens; this.render(); - }) + }); }, onGenerateTokenFormSubmit (e) { @@ -86,5 +86,3 @@ export default Modal.extend({ } }); - - diff --git a/server/sonar-web/src/main/js/components/charts/treemap.js b/server/sonar-web/src/main/js/components/charts/treemap.js index fe036d3fb9d..f06eda570d0 100644 --- a/server/sonar-web/src/main/js/components/charts/treemap.js +++ b/server/sonar-web/src/main/js/components/charts/treemap.js @@ -98,7 +98,7 @@ export const Treemap = React.createClass({ {window.t('no_data')} </div> <TreemapBreadcrumbs {...this.props}/> - </div> + </div>; }, render () { diff --git a/server/sonar-web/src/main/js/components/common/modals.js b/server/sonar-web/src/main/js/components/common/modals.js index 931ca8e4604..8117b096937 100644 --- a/server/sonar-web/src/main/js/components/common/modals.js +++ b/server/sonar-web/src/main/js/components/common/modals.js @@ -26,7 +26,7 @@ export default Marionette.ItemView.extend({ return false; }); this.show(); - if (!!this.options.large) { + if (this.options.large) { this.$el.addClass('modal-large'); } }, @@ -70,5 +70,3 @@ export default Marionette.ItemView.extend({ }); } }); - - diff --git a/server/sonar-web/src/main/js/components/mixins/resize-mixin.js b/server/sonar-web/src/main/js/components/mixins/resize-mixin.js index ebd7360fe07..da3db656361 100644 --- a/server/sonar-web/src/main/js/components/mixins/resize-mixin.js +++ b/server/sonar-web/src/main/js/components/mixins/resize-mixin.js @@ -1,4 +1,3 @@ -import React from 'react'; import ReactDOM from 'react-dom'; export const ResizeMixin = { diff --git a/server/sonar-web/src/main/js/components/mixins/tooltips-mixin.js b/server/sonar-web/src/main/js/components/mixins/tooltips-mixin.js index 03e9168c2da..3f16dded639 100644 --- a/server/sonar-web/src/main/js/components/mixins/tooltips-mixin.js +++ b/server/sonar-web/src/main/js/components/mixins/tooltips-mixin.js @@ -1,5 +1,4 @@ import $ from 'jquery'; -import React from 'react'; import ReactDOM from 'react-dom'; export const TooltipsMixin = { diff --git a/server/sonar-web/src/main/js/helpers/path.js b/server/sonar-web/src/main/js/helpers/path.js index ea389d48cb8..1468b8a885c 100644 --- a/server/sonar-web/src/main/js/helpers/path.js +++ b/server/sonar-web/src/main/js/helpers/path.js @@ -1,3 +1,6 @@ +import _ from 'underscore'; + + export function collapsePath (path, limit = 30) { if (typeof path !== 'string') { return ''; diff --git a/server/sonar-web/src/main/js/main/nav/app.js b/server/sonar-web/src/main/js/main/nav/app.js index 424294553bf..16d2a04c780 100644 --- a/server/sonar-web/src/main/js/main/nav/app.js +++ b/server/sonar-web/src/main/js/main/nav/app.js @@ -1,3 +1,4 @@ +import _ from 'underscore'; import React from 'react'; import ReactDOM from 'react-dom'; @@ -8,6 +9,7 @@ import { getGlobalNavigation, getComponentNavigation, getSettingsNavigation } fr import '../../components/workspace/main'; import '../../helpers/handlebars-helpers'; + export default class App { start () { let options = window.sonarqube; diff --git a/server/sonar-web/src/main/js/widgets/old/bubble-chart.js b/server/sonar-web/src/main/js/widgets/old/bubble-chart.js index c3d0e2eef73..21890bc3980 100644 --- a/server/sonar-web/src/main/js/widgets/old/bubble-chart.js +++ b/server/sonar-web/src/main/js/widgets/old/bubble-chart.js @@ -122,7 +122,7 @@ window.SonarWidgets = window.SonarWidgets == null ? {} : window.SonarWidgets; this.sizeMetric = this.metricsPriority()[2]; this.getSizeMetric = function(d) { - return !!d.measures[widget.sizeMetric] ? d.measures[widget.sizeMetric].val : 0; + return d.measures[widget.sizeMetric] ? d.measures[widget.sizeMetric].val : 0; }; }; diff --git a/server/sonar-web/src/main/js/widgets/old/pie-chart.js b/server/sonar-web/src/main/js/widgets/old/pie-chart.js index f3d81e7f639..929eb6a08ba 100644 --- a/server/sonar-web/src/main/js/widgets/old/pie-chart.js +++ b/server/sonar-web/src/main/js/widgets/old/pie-chart.js @@ -231,7 +231,7 @@ window.SonarWidgets = window.SonarWidgets == null ? {} : window.SonarWidgets; var metrics = widget.metricsPriority().map(function(m) { return { name: widget.metrics()[m].name, - value: (!!d.measures[m] ? d.measures[m].fval : '–') + value: (d.measures[m] ? d.measures[m].fval : '–') }; }); metrics.unshift({ |