ethereum/mist

View on GitHub
interface/actions.js

Summary

Maintainability
D
2 days
Test Coverage

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

    Function confirmTx has 96 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function confirmTx(data) {
      return async (dispatch, getState) => {
        dispatch({ type: '[CLIENT]:CONFIRM_TX:START', payload: { data } });
    
        // reject if sending to itself
    Severity: Major
    Found in interface/actions.js - About 3 hrs to fix

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

        export function getTokenDetails() {
          return (dispatch, getState) => {
            dispatch({ type: '[CLIENT]:GET_TOKEN_DETAILS:START' });
        
            const contractAddress = getState().newTx.to;
        Severity: Minor
        Found in interface/actions.js - About 1 hr to fix

          Function lookupSignature has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function lookupSignature(data) {
            return dispatch => {
              dispatch({ type: '[CLIENT]:LOOKUP_SIGNATURE:START' });
          
              if (!data || data.length <= 8) {
          Severity: Minor
          Found in interface/actions.js - About 1 hr to fix

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

                    } else if (
                      error.message.includes('could not decrypt key with given passphrase')
                    ) {
                      displayNotification('wrongPassword', 3);
                    } else if (error.message.includes('multiple keys match address')) {
            Severity: Major
            Found in interface/actions.js and 1 other location - About 2 hrs to fix
            interface/actions.js on lines 262..273

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

            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 (error.message.includes('Unable to connect to socket: timeout')) {
                      displayNotification('connectionTimeout', 5);
                    } else if (
                      error.message.includes('Insufficient funds for gas * price + value')
                    ) {
            Severity: Major
            Found in interface/actions.js and 1 other location - About 2 hrs to fix
            interface/actions.js on lines 234..245

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

            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

            Parsing error: 'import' and 'export' may appear only with 'sourceType: module'
            Open

            export function setWindowSize(height) {
            Severity: Minor
            Found in interface/actions.js by eslint

            For more information visit Source: http://eslint.org/docs/rules/

            There are no issues that match your filters.

            Category
            Status