kpapadatos/efoodgr

View on GitHub

Showing 11 of 29 total issues

Function default has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

export default function (program: CommanderStatic, s: EFood.Session) {
    session = s;

    program
        .command('addcart')
Severity: Minor
Found in src/commands/addcart.ts - About 6 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

Function default has 118 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function (program: CommanderStatic, s: EFood.Session) {
    session = s;

    program
        .command('addcart')
Severity: Major
Found in src/commands/addcart.ts - About 4 hrs to fix

    Function consoleHandler has 105 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            .consoleHandler = async () => {
                console.log(`Getting menu items ...`);
    
                const store = await session.getStore();
                const categories = store.menu.categories;
    Severity: Major
    Found in src/commands/addcart.ts - About 4 hrs to fix

      Function constructor has 86 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        constructor(private args: string[]) {
          super();
      
          const { red, cyan, white, green } = chalk;
          const { version } = require('../package');
      Severity: Major
      Found in src/CLI.ts - About 3 hrs to fix

        Function default has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function (program: CommanderStatic, s: EFood.Session) {
            session = s;
        
            program
                .command('payment')
        Severity: Minor
        Found in src/commands/payment.ts - About 1 hr to fix

          Function constructor has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

            constructor(private args: string[]) {
              super();
          
              const { red, cyan, white, green } = chalk;
              const { version } = require('../package');
          Severity: Minor
          Found in src/CLI.ts - 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 consoleHandler has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  .consoleHandler = async () => {
                      console.log(`Getting payment methods ...`);
          
                      const store = await session.getStore();
                      const choices = [];
          Severity: Minor
          Found in src/commands/payment.ts - About 1 hr to fix

            Function initEfoodConsole has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function initEfoodConsole() {
                  console.log(
                    red('\n                  e-food.gr\n') +
                    white(`                    ${version} \n\n`) +
                    green(
            Severity: Minor
            Found in src/CLI.ts - About 1 hr to fix

              Function default has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function (program: CommanderStatic, s: EFood.Session) {
                  session = s;
              
                  program
                      .command('setstore [storeId]')
              Severity: Minor
              Found in src/commands/setstore.ts - About 1 hr to fix

                Function handler has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                async function handler(cmd: any) {
                    console.log('Placing order...');
                
                    if (session.store.paymentMethod === 'piraeus.creditcard') {
                        const cards = await session.getCreditCards();
                Severity: Minor
                Found in src/commands/mkorder.ts - About 45 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

                Function default has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                export default function (program: CommanderStatic, s: EFood.Session) {
                    session = s;
                
                    program
                        .command('payment')
                Severity: Minor
                Found in src/commands/payment.ts - About 45 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