ethereum/mist

View on GitHub

Showing 443 of 443 total issues

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

      {
        label: i18n.t('mist.applicationMenu.develop.syncModeLight'),
        enabled: ethereumNode.isOwnNode && !ethereumNode.isDevNetwork,
        checked: store.getState().nodes.local.syncMode === 'light',
        type: 'checkbox',
Severity: Major
Found in modules/menuItems.js and 2 other locations - About 2 hrs to fix
modules/menuItems.js on lines 621..629
modules/menuItems.js on lines 639..647

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

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

      {
        label: i18n.t('mist.applicationMenu.develop.syncModeNoSync'),
        enabled: ethereumNode.isOwnNode && !ethereumNode.isDevNetwork,
        checked: store.getState().nodes.local.syncMode === 'nosync',
        type: 'checkbox',
Severity: Major
Found in modules/menuItems.js and 2 other locations - About 2 hrs to fix
modules/menuItems.js on lines 612..620
modules/menuItems.js on lines 621..629

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

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

      {
        label: i18n.t('mist.applicationMenu.develop.syncModeFast'),
        enabled: ethereumNode.isOwnNode && !ethereumNode.isDevNetwork,
        checked: store.getState().nodes.local.syncMode === 'fast',
        type: 'checkbox',
Severity: Major
Found in modules/menuItems.js and 2 other locations - About 2 hrs to fix
modules/menuItems.js on lines 612..620
modules/menuItems.js on lines 639..647

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

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

  createPopup(type, options, callback) {
    const defaultPopupOpts = {
      url: `${global.interfacePopupsUrl}#${type}`,
      show: true,
      ownerId: null,
Severity: Major
Found in modules/windows.js - About 2 hrs to fix

    File clientBinaryManager.js has 274 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    const _ = require('./utils/underscore.js');
    const Q = require('bluebird');
    const fs = require('fs');
    const { app, dialog } = require('electron');
    const got = require('got');
    Severity: Minor
    Found in modules/clientBinaryManager.js - About 2 hrs to fix

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

      const postMessage = function(payload) {
        if (typeof payload === 'object') {
          payload = JSON.stringify(payload);
        }
      
      
      Severity: Major
      Found in modules/preloader/browser.js and 2 other locations - About 2 hrs to fix
      modules/preloader/injected/EthereumProvider.js on lines 4..13
      modules/preloader/injected/mistAPI.js on lines 8..17

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

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

        var postMessage = function(payload) {
          if (typeof payload === 'object') {
            payload = JSON.stringify(payload);
          }
      
      
      Severity: Major
      Found in modules/preloader/injected/EthereumProvider.js and 2 other locations - About 2 hrs to fix
      modules/preloader/browser.js on lines 95..104
      modules/preloader/injected/mistAPI.js on lines 8..17

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

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

        var postMessage = function(payload) {
          if (typeof payload === 'object') {
            payload = JSON.stringify(payload);
          }
      
      
      Severity: Major
      Found in modules/preloader/injected/mistAPI.js and 2 other locations - About 2 hrs to fix
      modules/preloader/browser.js on lines 95..104
      modules/preloader/injected/EthereumProvider.js on lines 4..13

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

      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

            {
              label: 'Ropsten - Test network',
              accelerator: 'CommandOrControl+Alt+2',
              checked: store.getState().nodes.network === 'ropsten',
              enabled: store.getState().nodes.network !== 'private',
      Severity: Major
      Found in modules/menuItems.js and 1 other location - About 2 hrs to fix
      modules/menuItems.js on lines 585..594

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

      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

            {
              label: 'Rinkeby - Test network',
              accelerator: 'CommandOrControl+Alt+3',
              checked: store.getState().nodes.network === 'rinkeby',
              enabled: store.getState().nodes.network !== 'private',
      Severity: Major
      Found in modules/menuItems.js and 1 other location - About 2 hrs to fix
      modules/menuItems.js on lines 575..584

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

      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 62 lines of code (exceeds 25 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: Major
      Found in modules/ipc/methods/eth_sendTransaction.js - About 2 hrs to fix

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

                case 'rinkeby':
                  args = [
                    '--rinkeby',
                    '--cache',
                    process.arch === 'x64' ? '1024' : '512',
        Severity: Major
        Found in modules/ethereumNode.js and 1 other location - About 2 hrs to fix
        modules/ethereumNode.js on lines 450..463

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

        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 'test':
                  args = [
                    '--testnet',
                    '--cache',
                    process.arch === 'x64' ? '1024' : '512',
        Severity: Major
        Found in modules/ethereumNode.js and 1 other location - About 2 hrs to fix
        modules/ethereumNode.js on lines 466..479

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

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

          renderFormBody() {
            if (this.state.creating) {
              return <h2>{i18n.t('mist.popupWindows.requestAccount.creating')}</h2>;
            } else {
              return (
        Severity: Major
        Found in interface/components/RequestAccount.js - About 2 hrs to fix

          Function send has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async send(method, params = [], retry = false) {
              if (!Array.isArray(params)) {
                params = [params];
              }
          
          
          Severity: Major
          Found in modules/ethereumNodeRemote.js - About 2 hrs to fix

            Function initializeListeners has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            exports.initializeListeners = function() {
              let log = require('./utils/logger').create('dbSync'),
                db = require('./db'),
                ipc = ipcMain;
            
            
            Severity: Major
            Found in modules/dbSync.js - About 2 hrs to fix

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

                      <div className="execution-context__details-row">
                        <span className="execution-context__details-title">
                          {i18n.t('mist.sendTx.gasPriceStandard')}
                        </span>
                        <span className="execution-context__details-value">{`${gasPriceGweiStandard} Gwei`}</span>
              Severity: Major
              Found in interface/components/SendTx/ExecutionContext.js and 1 other location - About 2 hrs to fix
              interface/components/SendTx/ExecutionContext.js on lines 129..134

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

              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 className="execution-context__details-row">
                        <span className="execution-context__details-title">
                          {i18n.t('mist.sendTx.gasPricePriority')}
                        </span>
                        <span className="execution-context__details-value">{`${gasPriceGweiPriority} Gwei`}</span>
              Severity: Major
              Found in interface/components/SendTx/ExecutionContext.js and 1 other location - About 2 hrs to fix
              interface/components/SendTx/ExecutionContext.js on lines 122..127

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

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

                EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
                  var evt = prefix ? prefix + event : event;
              
                  if (!this._events[evt]) return false;
              
              
              Severity: Major
              Found in modules/preloader/injected/EventEmitter3.js - About 2 hrs to fix

                Function toggleSwarm has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function toggleSwarm(event) {
                  return (dispatch, getState) => {
                    if (
                      [SwarmState.Enabled, SwarmState.Enabling].includes(
                        getState().settings.swarmState
                Severity: Major
                Found in modules/core/settings/actions.js - About 2 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language