Showing 8 of 29 total issues
Function _getOrders
has a Cognitive Complexity of 22 (exceeds 15 allowed). Consider refactoring. Open
export const _getOrders = async (config, filters) => {
try {
const pool = await sqlPool.connect(config.mssqlConfig);
let sql = "select o.orderID, o.orderNumber, o.orderTime," +
" o.shippingName, o.shippingAddress1, o.shippingAddress2, o.shippingCity, o.shippingProvince, o.shippingCountry, o.shippingPostalCode," +
- 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 _getOrders
has a Cognitive Complexity of 22 (exceeds 15 allowed). Consider refactoring. Open
export const _getOrders = async (config: MiniShopConfig,
filters: GetOrderFilters): Promise<Order[]> => {
try {
const pool = await sqlPool.connect(config.mssqlConfig);
- 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 _getOrders
has 106 lines of code (exceeds 100 allowed). Consider refactoring. Open
export const _getOrders = async (config, filters) => {
try {
const pool = await sqlPool.connect(config.mssqlConfig);
let sql = "select o.orderID, o.orderNumber, o.orderTime," +
" o.shippingName, o.shippingAddress1, o.shippingAddress2, o.shippingCity, o.shippingProvince, o.shippingCountry, o.shippingPostalCode," +
Function _getOrders
has 105 lines of code (exceeds 100 allowed). Consider refactoring. Open
export const _getOrders = async (config: MiniShopConfig,
filters: GetOrderFilters): Promise<Order[]> => {
try {
const pool = await sqlPool.connect(config.mssqlConfig);
Function _getOrder
has a Cognitive Complexity of 19 (exceeds 15 allowed). Consider refactoring. Open
export const _getOrder = async (config, orderNumber, orderSecret, orderIsPaid, enforceExpiry = true) => {
try {
const pool = await sqlPool.connect(config.mssqlConfig);
const orderResult = await pool.request()
.input("orderNumber", orderNumber)
- 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 _getOrder
has a Cognitive Complexity of 19 (exceeds 15 allowed). Consider refactoring. Open
export const _getOrder = async (config: MiniShopConfig,
orderNumber: string, orderSecret: string, orderIsPaid: boolean, enforceExpiry = true) => {
try {
const pool = await sqlPool.connect(config.mssqlConfig);
- 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
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return false;