-
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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. |
||
console.log("i loop"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using |
||
for (let j=0; j<10; j++) { | ||
console.log("j loop"); | ||
for (let k=0; k<10; k++) { | ||
console.log("k loop"); | ||
for (let l=0; l<10; l++) { | ||
console.log("l loop"); | ||
for (let m=0; m<10; m++) { | ||
console.log('m loop'); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The function |
||
|
||
async function getDiff( | ||
owner: string, | ||
repo: string, | ||
|
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.