Send-Tribute/tribute-utils

View on GitHub

Showing 6 of 10 total issues

Function startFlow has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  async startFlow(recipientAddress, amountToFlowString) {
    const DAI_DECIMALS = await this.get_DAI_DECIMALS();

    // decimals length cannot be bigger than allowed DAI_DECIMALS
    const decimalSize = amountToFlowString.split(".")[1].length;
Severity: Major
Found in src/Tribute.js - About 2 hrs to fix

    Function endFlow has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      async endFlow(addressToRemove) {
        const DAI_DECIMALS = await this.get_DAI_DECIMALS();
    
        const balance_BN = await this.rDAIContract.balanceOf(this.userAddress);
    
    
    Severity: Minor
    Found in src/Tribute.js - About 1 hr to fix

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

        async getInfo(address) {
          const balance_BN = await this.rDAIContract.balanceOf(address);
          const unclaimedBalance_BN = await this.rDAIContract.interestPayableOf(
            address
          );
      Severity: Minor
      Found in src/Tribute.js - About 1 hr to fix

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

          async generate(amountToTransferString) {
            const DAI_DECIMALS = await this.get_DAI_DECIMALS();
        
            // decimals length cannot be bigger than allowed DAI_DECIMALS
            const decimalSize = amountToTransferString.split(".")[1].length;
        Severity: Minor
        Found in src/Tribute.js - About 1 hr to fix

          Function startFlow has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            async startFlow(recipientAddress, amountToFlowString) {
              const DAI_DECIMALS = await this.get_DAI_DECIMALS();
          
              // decimals length cannot be bigger than allowed DAI_DECIMALS
              const decimalSize = amountToFlowString.split(".")[1].length;
          Severity: Minor
          Found in src/Tribute.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 endFlow has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            async endFlow(addressToRemove) {
              const DAI_DECIMALS = await this.get_DAI_DECIMALS();
          
              const balance_BN = await this.rDAIContract.balanceOf(this.userAddress);
          
          
          Severity: Minor
          Found in src/Tribute.js - About 35 mins 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

          Severity
          Category
          Status
          Source
          Language