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')
- Read upRead up
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')
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;
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');
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')
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');
- Read upRead up
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 = [];
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(
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]')
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();
- Read upRead up
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')
- Read upRead up
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"