ethereum/mist

View on GitHub

Showing 443 of 443 total issues

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/web3Http.js and 1 other location - About 1 hr to fix
modules/sockets/web3Ipc.js on lines 16..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 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

Function estimateGasUsage has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function estimateGasUsage() {
  return (dispatch, getState) => {
    dispatch({ type: '[CLIENT]:ESTIMATE_GAS_USAGE:START' });

    const newTx = getState().newTx;
Severity: Minor
Found in interface/actions.js - About 1 hr to fix

    Function syncDataFromBackend has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const syncDataFromBackend = function(coll) {
      const ipc = ipcRenderer;
    
      const collName = coll._name;
    
    
    Severity: Minor
    Found in modules/dbSync.js - About 1 hr to fix

      Function _logNodeData has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        _logNodeData(data) {
          const cleanData = data.toString().replace(/[\r\n]+/, '');
          const nodeType = (this.type || 'node').toUpperCase();
      
          ethereumNodeLog.trace(`${nodeType}: ${cleanData}`);
      Severity: Minor
      Found in modules/ethereumNode.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 renderLocalStats has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        renderLocalStats() {
          const { syncMode } = this.props.local;
          const { currentBlock } = this.props.local.sync;
      
          let syncText;
      Severity: Minor
      Found in interface/components/NodeInfo/index.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 reuse has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        reuse(type, options, callback) {
          this.isAvailable = false;
          this.actingType = type;
          if (callback) {
            this.callback = callback;
      Severity: Minor
      Found in modules/windows.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 setActiveNode has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function setActiveNode() {
        return (dispatch, getState) => {
          // Ensure remote is active if local node is 15 or more blocks behind remote or local node has no peers.
          const { active, network, local, remote } = getState().nodes;
      
      
      Severity: Minor
      Found in modules/core/nodes/actions.js - About 1 hr to fix

        Function check has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const check = (exports.check = () => {
          log.info('Check for update...');
        
          let str = null;
        
        
        Severity: Minor
        Found in modules/updateChecker.js - About 1 hr to fix

          Function stop has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            stop() {
              if (!this._stopPromise) {
                return new Q(resolve => {
                  if (!this._node) {
                    return resolve();
          Severity: Minor
          Found in modules/ethereumNode.js - About 1 hr to fix

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

                  remove(id) {
                    const filteredId = prefix + filterId(id);
            
                    delete this.entries[filteredId];
            
            
            Severity: Major
            Found in modules/preloader/include/mistAPI.js and 1 other location - About 1 hr to fix
            modules/preloader/injected/mistAPI.js on lines 197..206

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

            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

                  if (mist.menu.entries[id] && mist.menu.entries[id].callback) {
                    mist.menu.entries[id].callback();
                  }
            Severity: Major
            Found in modules/preloader/injected/mistAPI.js and 1 other location - About 1 hr to fix
            modules/preloader/include/mistAPI.js on lines 219..221

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

            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

                if (mist.menu.entries[id] && mist.menu.entries[id].callback) {
                  mist.menu.entries[id].callback();
                }
            Severity: Major
            Found in modules/preloader/include/mistAPI.js and 1 other location - About 1 hr to fix
            modules/preloader/injected/mistAPI.js on lines 251..253

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

            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

                  remove(id) {
                    const filteredId = prefix + filterId(id);
            
                    delete this.entries[filteredId];
            
            
            Severity: Major
            Found in modules/preloader/injected/mistAPI.js and 1 other location - About 1 hr to fix
            modules/preloader/include/mistAPI.js on lines 180..189

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

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

              _handleSubscriptions(result) {
                if (result.method === 'eth_subscribe') {
                  // If subscription is created in local, also create the subscription in remote
                  const subscriptionType = result.params[0];
                  const subscriptionId = result.result;
            Severity: Minor
            Found in modules/ipc/ipcProviderBackend.js - About 1 hr to fix

              Function renderRemoteStats has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                renderRemoteStats() {
                  // Hide remote stats if local node is synced
                  if (this.props.active !== 'remote') {
                    return null;
                  }
              Severity: Minor
              Found in interface/components/NodeInfo/index.js - About 1 hr to fix

                Function render has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  render() {
                    const { active, network, local, remote } = this.props;
                
                    let dotColor = network == 'main' ? '#7ed321' : '#00aafa';
                
                
                Severity: Minor
                Found in interface/components/NodeInfo/StatusLight.js - About 1 hr to fix

                  Function render has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    render() {
                      const { gasPrice, gasError, estimatedGas, unlocking } = this.props;
                  
                      if (!estimatedGas || !gasPrice || gasPrice === 0 || gasPrice === '0x0') {
                        return (
                  Severity: Minor
                  Found in interface/components/SendTx/Footer.js - About 1 hr to fix

                    Function frontendSyncInit has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    exports.frontendSyncInit = function(coll) {
                      let ipc = ipcRenderer,
                        syncDoneResolver;
                    
                      const collName = coll._name;
                    Severity: Minor
                    Found in modules/dbSync.js - About 1 hr to fix

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

                            modalWindow.on('hidden', () => {
                              BlurOverlay.disable();
                      
                              // user cancelled?
                              if (!modalWindow.processed) {
                      Severity: Major
                      Found in modules/ipc/methods/eth_sendTransaction.js and 1 other location - About 1 hr to fix
                      modules/ipc/methods/eth_sendTransaction.js on lines 72..79

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

                      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: i18n.t('mist.applicationMenu.develop.devToolsMistUI'),
                              accelerator: 'Alt+CommandOrControl+I',
                              click() {
                                curWindow = BrowserWindow.getFocusedWindow();
                      Severity: Major
                      Found in modules/menuItems.js and 1 other location - About 1 hr to fix
                      modules/menuItems.js on lines 464..473

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

                      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