-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bad code #11
Bad code #11
Conversation
@@ -41,6 +41,24 @@ async function getPRDetails(): Promise<PRDetails> { | |||
}; | |||
} | |||
|
|||
function terribleCode() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function terribleCode
is poorly named and does not convey its purpose. Consider renaming it to something more descriptive.
@@ -41,6 +41,24 @@ async function getPRDetails(): Promise<PRDetails> { | |||
}; | |||
} | |||
|
|||
function terribleCode() { | |||
for (let i=0; i<10; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The nested loops create a time complexity of O(n^5), which is highly inefficient. This should be refactored to avoid deep nesting.
@@ -41,6 +41,24 @@ async function getPRDetails(): Promise<PRDetails> { | |||
}; | |||
} | |||
|
|||
function terribleCode() { | |||
for (let i=0; i<10; i++) { | |||
console.log("i loop"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using console.log
in a loop can lead to performance issues and cluttered output. Consider removing these logs or using a more efficient logging strategy.
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function terribleCode
is defined but never called. If it is not needed, it should be removed to clean up the code.
console.log("l loop"); | ||
for (let m=0; m<10; m++) { | ||
console.log('m loop'); | ||
for (let n=0; n<10; n++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The nested loop structure here is unnecessary and can lead to performance issues. Consider whether this nested loop is needed or if it can be simplified.
No description provided.