grommet/grommet-ferret

View on GitHub

Showing 151 of 386 total issues

Avoid deeply nested control flow statements.
Open

          if (credentials) {
            this.setState({ needCredentials: false, credentials: null,
              editBase: false, busy: 'Verifying' });
            this.props.dispatch(verifyDirectory(directory, credentials));
          } else {
Severity: Major
Found in src/js/components/settings/DirectoryEdit.js - About 45 mins to fix

    Function render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      render () {
        const { index, role } = this.props;
        const { filterActive, searchText } = this.state;
        const result = index.result || {};
    
    
    Severity: Minor
    Found in src/js/components/virtualMachine/VirtualMachineIndex.js - About 45 mins 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

    Function _renderNodeFields has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      _renderNodeFields (node, index) {
        const { nodes } = this.state;
        const errors = this.state.errors.nodes[index] || {};
    
        let addressField;
    Severity: Minor
    Found in src/js/components/settings/NodesEdit.js - About 45 mins 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

    Avoid deeply nested control flow statements.
    Open

              if (item.associationContext.parentUri) {
                reducedItem = reducedItemsMap[item.associationContext.parentUri];
                if (! reducedItem) {
                  reducedItem = {
                    association: {
    Severity: Major
    Found in server/map.js - About 45 mins to fix

      Function render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        render () {
          const { index } = this.props;
          const { filterActive, searchText, selection } = this.state;
          const result = index.result || {};
      
      
      Severity: Minor
      Found in src/js/components/activity/ActivityIndex.js - About 45 mins 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

      Function buildItem has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      function buildItem (options) { //categoryName, index, name, date) {
        const category = options.category;
      
        const resource = {
          name: options.name,
      Severity: Minor
      Found in server/generator.js - About 45 mins 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

      Avoid deeply nested control flow statements.
      Open

                    if (childIndex < children.length) {
                      const child = children[childIndex];
                      addAssociation(name, parent.uri, child.uri);
                      if (schema.childUriAttribute) {
                        child[schema.childUriAttribute] = parent.uri;
      Severity: Major
      Found in server/generator.js - About 45 mins to fix

        Function componentWillReceiveProps has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          componentWillReceiveProps (nextProps) {
            const { context, notifications } = this.props;
            const { context: nextContext, notifications: nextNotifications,
              preservePriorRunningTasks} = nextProps;
            if (context.uri !== nextContext.uri ||
        Severity: Minor
        Found in src/js/components/Notifications.js - About 45 mins 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

        Function render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          render () {
            const { virtualMachine, nav, notifications, role, category } = this.props;
        
            let state;
            if (! notifications.alert && ! notifications.aggregate &&
        Severity: Minor
        Found in src/js/components/virtualMachine/VirtualMachineShow.js - About 45 mins 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

        Function normalize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          normalize (options) {
            let result = { ...options };
            while (result.value >= 1000) {
              result.value = Math.round(result.value / 100) / 10;
              if (result.units) {
        Severity: Minor
        Found in src/js/utils/Units.js - About 45 mins 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

        Consider simplifying this complex logical expression.
        Open

          if (! req.body.userName || ! req.body.password ||
            'error' === req.body.userName ||
            ('Gru' === req.body.userName && 'freeze ray' !== req.body.password)) {
            res.status(401, "Invalid username or password.").send();
          } else {
        Severity: Major
        Found in server/rest.js - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

            if (resource.status && 'OK' !== resource.status &&
              'Disabled' !== resource.status &&
              'alerts' !== category.name && 'tasks' !== category.name &&
              'appliances' !== category.name) {
              alertForResource(resource, options.index);
          Severity: Major
          Found in server/generator.js - About 40 mins to fix

            Function sessionLoginSuccess has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            export function sessionLoginSuccess (host, userName, token, role,
              needPasswordReset) {
            Severity: Minor
            Found in src/js/actions/session.js - About 35 mins to fix

              Function add has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              function add(name, uri, result, associations, callback) {
              Severity: Minor
              Found in server/map.js - About 35 mins to fix

                Function distribute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                function distribute (values) {
                  let result;
                  for (var i = 0; i < values.length; i++) {
                    if (Array.isArray(values[i])) {
                      if (random(values[i][1]) === 0) {
                Severity: Minor
                Found in server/generator.js - About 35 mins 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

                Function updateAggregateCounts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                function updateAggregateCounts (counts, resource, value, intervals) {
                  let count = null;
                  for (let i = 0; i < counts.length; i++) {
                    if (value === counts[i].value) {
                      count = counts[i];
                Severity: Minor
                Found in server/rest.js - About 35 mins 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

                Function _renderNameFields has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  _renderNameFields () {
                    const { count, naming, template, errors } = this.state;
                    let nameFields;
                    if (1 === count) {
                
                
                Severity: Minor
                Found in src/js/components/virtualMachine/VirtualMachineAdd.js - About 35 mins 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

                Function render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  render () {
                    const { status } = this.props;
                
                    let progress;
                    if (status.progress) {
                Severity: Minor
                Found in src/js/components/Status.js - About 35 mins 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

                Function render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  render () {
                    const { productName, role, software, onAction } = this.props;
                
                    let menu, details;
                
                
                Severity: Minor
                Found in src/js/components/settings/SoftwareNotification.js - About 35 mins 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

                Avoid too many return statements within this function.
                Open

                    return Math.round(delta / 86400000).toString() + 'd';
                Severity: Major
                Found in src/js/utils/Duration.js - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language