Showing 16 of 64 total issues
Function render
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function () {
const props = this.props;
const state = this.state;
const component = this;
Function exports
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(api) {
var validEnv = ['development', 'test', 'production']
var currentEnv = api.env()
var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production')
Function render
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function () {
var props = this.props;
var page = this.props.page;
var state = this.state;
var category_class = 'category-' + this.dasherize(page.category);
Function render
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function () {
var state = this.state;
var props = this.props;
var self = this;
Function render
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function () {
var props = this.props;
var state = this.state;
return (
Function render
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function () {
var state = this.state;
var props = this.props;
var component = this;
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function () {
var props = this.props;
var state = this.state;
var rendered_pages = state.pages.map(function (page) {
Function render
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function () {
var props = this.props;
var state = this.state;
if(props.show_form) {
Function render
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function () {
var props = this.props;
var state = this.state;
if(props.show_form) {
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function () {
var vm = this;
var render_lists = this.state.lists.map(function (list) {
return (
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function () {
var page = this.props.page;
var info = <div className="page-info">
{ page.category },{ page.unit }
Function render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function () {
return (
<div className={this.props.div_class}
id={this.props.modal_id}
tabIndex="-1"
Function render
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
render: function () {
var props = this.props;
var page = this.props.page;
var state = this.state;
var category_class = 'category-' + this.dasherize(page.category);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function displayPriceRatio
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
displayPriceRatio: function (p, unit) {
if (unit == 'grams' && p >= 1000) {
return (this.displayPrice(p / 1000) + ' / kilograms');
} else if (unit == 'kilograms' && p <= 0.01) {
return (this.displayPrice(p * 1000) + ' / grams');
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this function. Open
return (this.displayPrice(p) + ' / ' + unit);
Function exports
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function(api) {
var validEnv = ['development', 'test', 'production']
var currentEnv = api.env()
var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production')
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"