Showing 6 of 14 total issues
Function pollLoadBalancer
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
export const pollLoadBalancer = async (
clusterId: string,
checkState: string = "active",
reporter: (msg: string, status?: StatusMessage["state"]) => void = () => {}
): Promise<void> => {
- 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 pollCluster
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export const pollCluster = async (
clusterId: string,
checkState: string = "running",
reporter: (msg: string, status?: StatusMessage["state"]) => void = () => {}
): Promise<void | { kubernetes_cluster: Cluster }> => {
- 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 saveConfig
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const saveConfig = async (req: Request, refId: string, prState: string) => {
//
let deployment = await getDeployment({ refId: refId });
Function main
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const main = async (req: Request, res: Response) => {
const refId = enforceRefId(req, res);
const eventInfo = handleEvent(req);
const defaultMessage = "✅ event received";
Function main
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const main = async (req: Request, res: Response) => {
const refId = enforceRefId(req, res);
const eventInfo = handleEvent(req);
const defaultMessage = "✅ event received";
- 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 getRefId
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const getRefId = (event: RequestBody): false | string => {
let refId: false | string = false;
if (!validateFields(event)) {
return false;
- 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"