ethereum/mist

View on GitHub

Showing 443 of 443 total issues

Function menuTempl has 589 lines of code (exceeds 25 allowed). Consider refactoring.
Open

let menuTempl = function(webviews) {
  const menu = [];
  webviews = webviews || [];

  // APP
Severity: Major
Found in modules/menuItems.js - About 2 days to fix

    File menuItems.js has 685 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    const {
      app,
      BrowserWindow,
      ipcMain: ipc,
      Menu,
    Severity: Major
    Found in modules/menuItems.js - About 1 day to fix

      Function menuTempl has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
      Open

      let menuTempl = function(webviews) {
        const menu = [];
        webviews = webviews || [];
      
        // APP
      Severity: Minor
      Found in modules/menuItems.js - About 1 day 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 ethereumNode.js has 549 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      const _ = require('./utils/underscore.js');
      const fs = require('fs');
      const Q = require('bluebird');
      const spawn = require('child_process').spawn;
      const { dialog } = require('electron');
      Severity: Major
      Found in modules/ethereumNode.js - About 1 day to fix

        File windows.js has 542 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        const { app, BrowserWindow, ipcMain: ipc } = require('electron');
        const Settings = require('./settings');
        const log = require('./utils/logger').create('Windows');
        const EventEmitter = require('events').EventEmitter;
        import {
        Severity: Major
        Found in modules/windows.js - About 1 day to fix

          Function _checkForNewConfig has 203 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            _checkForNewConfig(restart) {
              const nodeType = 'Geth';
              let binariesDownloaded = false;
              let nodeInfo;
          
          
          Severity: Major
          Found in modules/clientBinaryManager.js - About 1 day to fix

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

            /**
            The IPC provider backend filter and tunnel all incoming request to the ethereum node.
            
            @module ipcProviderBackend
            */
            Severity: Minor
            Found in modules/ipc/ipcProviderBackend.js - About 7 hrs to fix

              Function getDefaultOptionsForType has 153 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                getDefaultOptionsForType(type) {
                  const mainWebPreferences = {
                    mist: {
                      nodeIntegration: true /* necessary for webviews;
                                  require will be removed through preloader */,
              Severity: Major
              Found in modules/windows.js - About 6 hrs to fix

                Function exports has 145 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = () => {
                  let queue = [];
                  const prefix = 'entry_';
                  const MIST_SUBMENU_LIMIT = 100;
                
                
                Severity: Major
                Found in modules/preloader/include/mistAPI.js - About 5 hrs to fix

                  Function renderMoreDetails has 142 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    renderMoreDetails() {
                      const {
                        estimatedGas,
                        executionFunction,
                        gasError,
                  Severity: Major
                  Found in interface/components/SendTx/ExecutionContext.js - About 5 hrs to fix

                    File settings.js has 399 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    const { app } = require('electron');
                    const path = require('path');
                    const fs = require('fs');
                    const packageJson = require('../package.json');
                    const _ = require('./utils/underscore');
                    Severity: Minor
                    Found in modules/settings.js - About 5 hrs to fix

                      Function exports has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
                      Open

                      module.exports = () => {
                        let queue = [];
                        const prefix = 'entry_';
                        const MIST_SUBMENU_LIMIT = 100;
                      
                      
                      Severity: Minor
                      Found in modules/preloader/include/mistAPI.js - About 5 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

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

                          if (options.sendData) {
                            if (_.isString(options.sendData)) {
                              this.send(options.sendData);
                            } else if (_.isObject(options.sendData)) {
                              for (const key in options.sendData) {
                      Severity: Major
                      Found in modules/windows.js and 1 other location - About 4 hrs to fix
                      modules/windows.js on lines 173..183

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

                      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

                            if (opts.sendData) {
                              if (_.isString(opts.sendData)) {
                                this.send(opts.sendData);
                              } else if (_.isObject(opts.sendData)) {
                                for (const key in opts.sendData) {
                      Severity: Major
                      Found in modules/windows.js and 1 other location - About 4 hrs to fix
                      modules/windows.js on lines 102..112

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

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

                        __startProcess(nodeType, network, binPath, _syncMode) {
                          let syncMode = _syncMode;
                          if (nodeType === 'geth' && !syncMode) {
                            syncMode = DEFAULT_SYNCMODE;
                          }
                      Severity: Major
                      Found in modules/ethereumNode.js - About 4 hrs to fix

                        Settings has 35 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class Settings {
                          constructor() {
                            if (!instance) {
                              instance = this;
                            }
                        Severity: Minor
                        Found in modules/settings.js - About 4 hrs to fix

                          File actions.js has 345 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          export function setWindowSize(height) {
                            return dispatch => {
                              dispatch({ type: '[CLIENT]:SET_WINDOW_SIZE:START', payload: { height } });
                              ipc.send('backendAction_setWindowSize', 580, height + 20);
                            };
                          Severity: Minor
                          Found in interface/actions.js - About 4 hrs to fix

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

                                  select(id) {
                                    const filteredId = prefix + filterId(id);
                                    queue.push({ action: 'selectMenu', id: filteredId });
                            
                                    for (const e in this.entries) {
                            Severity: Major
                            Found in modules/preloader/include/mistAPI.js and 1 other location - About 4 hrs to fix
                            modules/preloader/injected/mistAPI.js on lines 213..222

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

                            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

                                  select(id) {
                                    const filteredId = prefix + filterId(id);
                                    queue.push({ action: 'selectMenu', id: filteredId });
                            
                                    for (const e in this.entries) {
                            Severity: Major
                            Found in modules/preloader/injected/mistAPI.js and 1 other location - About 4 hrs to fix
                            modules/preloader/include/mistAPI.js on lines 196..205

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

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

                              render() {
                                const tx = this.props.tx;
                                const networkString = this.props.networkString(tx.networkId);
                                let network = '';
                                if (networkString !== 'Main') {
                            Severity: Major
                            Found in interface/components/TxHistory/TxRow.js - About 4 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language