grommet/grommet-ferret

View on GitHub

Showing 386 of 386 total issues

File rest.js has 940 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// (C) Copyright 2014-2016 Hewlett Packard Enterprise Development LP

import express from 'express';
let router = express.Router();
import ws from "ws";
Severity: Major
Found in server/rest.js - About 2 days to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    class DashboardTasks extends Component {
    
      constructor () {
        super();
        this._onSelect = this._onSelect.bind(this);
    Severity: Major
    Found in src/js/components/dashboard/DashboardTasks.js and 1 other location - About 2 days to fix
    src/js/components/virtualMachine/VirtualMachineActivity.js on lines 9..51

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 358.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    class VirtualMachineActivity extends Component {
    
      constructor () {
        super();
        this._onSelect = this._onSelect.bind(this);
    Severity: Major
    Found in src/js/components/virtualMachine/VirtualMachineActivity.js and 1 other location - About 2 days to fix
    src/js/components/dashboard/DashboardTasks.js on lines 23..65

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 358.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    class ImageRemove extends Component {
    
      constructor () {
        super();
        this._onRemove = this._onRemove.bind(this);
    Severity: Major
    Found in src/js/components/image/ImageRemove.js and 1 other location - About 1 day to fix
    src/js/components/size/SizeRemove.js on lines 9..38

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 258.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    class SizeRemove extends Component {
    
      constructor () {
        super();
        this._onRemove = this._onRemove.bind(this);
    Severity: Major
    Found in src/js/components/size/SizeRemove.js and 1 other location - About 1 day to fix
    src/js/components/image/ImageRemove.js on lines 9..38

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 258.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

                <Section pad={{ horizontal: 'large', vertical: 'small' }}>
                  <Heading tag='h3'>Status</Heading>
                  <Select inline={true} multiple={true} options={[
                    { label: 'All', value: undefined },
                    { label: <StatusLabel value='critical' label='Critical' />,
    Severity: Major
    Found in src/js/components/virtualMachine/VirtualMachineFilter.js and 1 other location - About 1 day to fix
    src/js/components/activity/ActivityFilter.js on lines 61..76

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 256.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

                <Section pad={{ horizontal: 'large', vertical: 'small' }}>
                  <Heading tag='h3'>Status</Heading>
                  <Select inline={true} multiple={true} options={[
                    { label: 'All', value: undefined },
                    { label: <StatusLabel value='critical' label='Critical' />,
    Severity: Major
    Found in src/js/components/activity/ActivityFilter.js and 1 other location - About 1 day to fix
    src/js/components/virtualMachine/VirtualMachineFilter.js on lines 78..93

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 256.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    class VirtualMachineRestart extends Component {
    
      constructor () {
        super();
        this._onSubmit = this._onSubmit.bind(this);
    Severity: Major
    Found in src/js/components/virtualMachine/VirtualMachineRestart.js and 1 other location - About 1 day to fix
    src/js/components/virtualMachine/VirtualMachinePowerOff.js on lines 9..34

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 223.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    class VirtualMachinePowerOff extends Component {
    
      constructor () {
        super();
        this._onSubmit = this._onSubmit.bind(this);
    Severity: Major
    Found in src/js/components/virtualMachine/VirtualMachinePowerOff.js and 1 other location - About 1 day to fix
    src/js/components/virtualMachine/VirtualMachineRestart.js on lines 9..34

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 223.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        putImage(image, file,
          (event) => {
            // progress handler
            dispatch(updateImageProgress(file.name, event.loaded, event.total));
          },
    Severity: Major
    Found in src/js/actions/image.js and 1 other location - About 7 hrs to fix
    src/js/actions/image.js on lines 49..66

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 189.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        postImage(image, file,
          (event) => {
            // progress handler
            dispatch(addImageProgress(file.name, event.loaded, event.total));
          },
    Severity: Major
    Found in src/js/actions/image.js and 1 other location - About 7 hrs to fix
    src/js/actions/image.js on lines 89..106

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 189.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function reduce has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
    Open

    function reduce(result) {
      for (let name in result.categories) {
        if (result.categories.hasOwnProperty(name)) {
          let items = result.categories[name];
          if (items.length > REDUCE_LIMIT) {
    Severity: Minor
    Found in server/map.js - About 7 hrs to fix

    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

    File VirtualMachineAdd.js has 469 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // (C) Copyright 2014-2016 Hewlett Packard Enterprise Development LP
    
    import React, { Component, PropTypes } from 'react';
    import { connect } from 'react-redux';
    import { addMultipleVms, loadVmSizes, loadVmImages,
    Severity: Minor
    Found in src/js/components/virtualMachine/VirtualMachineAdd.js - About 7 hrs to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        _change (name) {
          return (event) => {
            const { index } = this.props;
            let nextFilter = { ...index.filter };
            if (! event.option.value) {
      Severity: Major
      Found in src/js/components/virtualMachine/VirtualMachineFilter.js and 1 other location - About 7 hrs to fix
      src/js/components/activity/ActivityFilter.js on lines 26..45

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 176.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        _change (name) {
          return (event) => {
            const { index } = this.props;
            let nextFilter = { ...index.filter };
            if (! event.option.value) {
      Severity: Major
      Found in src/js/components/activity/ActivityFilter.js and 1 other location - About 7 hrs to fix
      src/js/components/virtualMachine/VirtualMachineFilter.js on lines 32..51

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 176.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      File generator.js has 454 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // (C) Copyright 2014-2015 Hewlett Packard Enterprise Development LP
      
      import {
        addAssociation, addCategory, addResource, getItems, setSettings, setStatus
      } from './data';
      Severity: Minor
      Found in server/generator.js - About 6 hrs to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            const networks = (virtualMachine.networks || []).map((network, index) => {
              return (
                <ListItem key={index} justify="between" pad="none"
                  separator={index === 0 ? 'horizontal' : 'bottom'}
                  responsive={false}>
        Severity: Major
        Found in src/js/components/virtualMachine/VirtualMachineEdit.js and 1 other location - About 6 hrs to fix
        src/js/components/virtualMachine/VirtualMachineAdd.js on lines 414..428

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 170.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            const networks = template.networks.map((network, index) => {
              return (
                <ListItem key={index} justify="between" pad="none"
                  separator={index === 0 ? 'horizontal' : 'bottom'}
                  responsive={false}>
        Severity: Major
        Found in src/js/components/virtualMachine/VirtualMachineAdd.js and 1 other location - About 6 hrs to fix
        src/js/components/virtualMachine/VirtualMachineEdit.js on lines 232..246

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 170.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function Expression has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
        Open

        function Expression () {
        
          this.op = (op) => {
            if (! this._op) {
              this._op = op;
        Severity: Minor
        Found in server/filter.js - About 6 hrs to fix

        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

        File DirectoryEdit.js has 406 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // (C) Copyright 2014-2016 Hewlett Packard Enterprise Development LP
        
        import React, { Component, PropTypes } from 'react';
        import { connect } from 'react-redux';
        import { changeDirectory, loadDirectoryCertificate, trustDirectory,
        Severity: Minor
        Found in src/js/components/settings/DirectoryEdit.js - About 5 hrs to fix
          Severity
          Category
          Status
          Source
          Language