ethereum/mist

View on GitHub

Showing 443 of 443 total issues

Function submit form has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  'submit form': function(e, template) {
    var pw = template.find('input.password').value;

    ipc.send('backendAction_importWalletFile', TemplateVar.get('filePath'), pw);

Severity: Minor
Found in interface/client/templates/popupWindows/importAccount.js - About 1 hr to fix

    Function enableSwarmProtocol has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function enableSwarmProtocol() {
      protocol.registerHttpProtocol(
        'bzz',
        (request, callback) => {
          if (
    Severity: Minor
    Found in main.js - About 1 hr to fix

      Function connect has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        connect(connectConfig, options) {
          this._log.info(`Connect to ${JSON.stringify(connectConfig)}`);
      
          options = _.extend(
            {
      Severity: Minor
      Found in modules/sockets/base.js - About 1 hr to fix

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

                local: Object.assign({}, state.local, {
                  blockNumber: 0,
                  timestamp: 0,
                  peerCount: 0,
                  sync: {
        Severity: Major
        Found in modules/core/nodes/reducer.js and 1 other location - About 1 hr to fix
        modules/core/nodes/reducer.js on lines 92..103

        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 67.

        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

                local: Object.assign({}, state.local, {
                  blockNumber: 0,
                  timestamp: 0,
                  peerCount: 0,
                  sync: {
        Severity: Major
        Found in modules/core/nodes/reducer.js and 1 other location - About 1 hr to fix
        modules/core/nodes/reducer.js on lines 49..60

        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 67.

        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 3 locations. Consider refactoring.
        Open

                  <div className="peer-count row-icon">
                    <i className="icon icon-users" />
                    {` ${this.props.local.peerCount} ${i18n.t('mist.nodeInfo.peers')}`}
                  </div>
        Severity: Major
        Found in interface/components/NodeInfo/index.js and 2 other locations - About 1 hr to fix
        interface/components/NodeInfo/index.js on lines 95..98
        interface/components/NodeInfo/index.js on lines 126..129

        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 67.

        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 3 locations. Consider refactoring.
        Open

                <div className="peer-count row-icon">
                  <i className="icon icon-users" />
                  {` ${this.props.local.peerCount} ${i18n.t('mist.nodeInfo.peers')}`}
                </div>
        Severity: Major
        Found in interface/components/NodeInfo/index.js and 2 other locations - About 1 hr to fix
        interface/components/NodeInfo/index.js on lines 126..129
        interface/components/NodeInfo/index.js on lines 171..174

        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 67.

        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 3 locations. Consider refactoring.
        Open

                <div className="peer-count row-icon">
                  <i className="icon icon-users" />
                  {` ${this.props.local.peerCount} ${i18n.t('mist.nodeInfo.peers')}`}
                </div>
        Severity: Major
        Found in interface/components/NodeInfo/index.js and 2 other locations - About 1 hr to fix
        interface/components/NodeInfo/index.js on lines 95..98
        interface/components/NodeInfo/index.js on lines 171..174

        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 67.

        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

            case '[MAIN]:LOCAL_NODE:UPDATE_NEW_BLOCK':
              return Object.assign({}, state, {
                local: Object.assign({}, state.local, {
                  blockNumber: action.payload.blockNumber,
                  timestamp: action.payload.timestamp
        Severity: Major
        Found in modules/core/nodes/reducer.js and 1 other location - About 1 hr to fix
        modules/core/nodes/reducer.js on lines 69..75

        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 66.

        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

            case '[MAIN]:REMOTE_NODE:BLOCK_HEADER_RECEIVED':
              return Object.assign({}, state, {
                remote: Object.assign({}, state.remote, {
                  blockNumber: action.payload.blockNumber,
                  timestamp: action.payload.timestamp
        Severity: Major
        Found in modules/core/nodes/reducer.js and 1 other location - About 1 hr to fix
        modules/core/nodes/reducer.js on lines 40..46

        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 66.

        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 exec has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

          exec(conn, payload) {
            return new Q((resolve, reject) => {
              this._log.info('Ask user for password');
        
              this._log.info(payload.params[0]);
        Severity: Minor
        Found in modules/ipc/methods/eth_sendTransaction.js - About 1 hr 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 renderTo has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          renderTo() {
            const {
              to,
              toIsContract,
              isNewContract,
        Severity: Minor
        Found in interface/components/SendTx/TxParties.js - About 1 hr to fix

          Function starting has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              return (this.starting = new Promise((resolve, reject) => {
                this.network = store.getState().nodes.network;
          
                ethereumNodeRemoteLog.trace(
                  `Connecting to remote node on ${this.network}...`
          Severity: Minor
          Found in modules/ethereumNodeRemote.js - About 1 hr to fix

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

                    if (!_.isUndefined(eventArg.entry.position)) {
                      query.$set['menu.' + eventArg.entry.id + '.position'] =
                        eventArg.entry.position;
                    }
            Severity: Major
            Found in interface/client/mistAPIBackend.js and 2 other locations - About 1 hr to fix
            interface/client/mistAPIBackend.js on lines 119..122
            interface/client/mistAPIBackend.js on lines 123..126

            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 64.

            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 3 locations. Consider refactoring.
            Open

                    if (!_.isUndefined(eventArg.entry.badge)) {
                      query.$set['menu.' + eventArg.entry.id + '.badge'] =
                        eventArg.entry.badge;
                    }
            Severity: Major
            Found in interface/client/mistAPIBackend.js and 2 other locations - About 1 hr to fix
            interface/client/mistAPIBackend.js on lines 115..118
            interface/client/mistAPIBackend.js on lines 119..122

            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 64.

            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 3 locations. Consider refactoring.
            Open

                    if (!_.isUndefined(eventArg.entry.name)) {
                      query.$set['menu.' + eventArg.entry.id + '.name'] =
                        eventArg.entry.name;
                    }
            Severity: Major
            Found in interface/client/mistAPIBackend.js and 2 other locations - About 1 hr to fix
            interface/client/mistAPIBackend.js on lines 115..118
            interface/client/mistAPIBackend.js on lines 123..126

            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 64.

            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

                    <div>
                      {i18n.t('mist.txHistory.gasLimit')}:{' '}
                      <span className="bold">{web3.utils.hexToNumberString(tx.gas)}</span>
                    </div>
            Severity: Major
            Found in interface/components/TxHistory/TxRow.js and 1 other location - About 1 hr to fix
            interface/components/TxHistory/TxRow.js on lines 100..103

            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 64.

            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

                    <div>
                      {i18n.t('mist.txHistory.nonce')}:{' '}
                      <span className="bold">{web3.utils.hexToNumberString(tx.nonce)}</span>
                    </div>
            Severity: Major
            Found in interface/components/TxHistory/TxRow.js and 1 other location - About 1 hr to fix
            interface/components/TxHistory/TxRow.js on lines 104..107

            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 64.

            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 initTabs has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function initTabs() {
              console.debug('Init tabs');
            
              Tabs.onceSynced.then(function() {
                if (location.search.indexOf('reset-tabs') >= 0) {
            Severity: Minor
            Found in interface/client/appStart.js - About 1 hr to fix

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

                  return Q.try(() => {
                    if (STATE.CONNECTED === this._state) {
                      this._log.debug('Disconnecting prior to reset');
              
                      return this.disconnect();
              Severity: Major
              Found in modules/sockets/web3Ipc.js and 1 other location - About 1 hr to fix
              modules/sockets/web3Http.js on lines 90..126

              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 63.

              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

              Severity
              Category
              Status
              Source
              Language