Skip to content
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

Closed
wants to merge 2 commits into from
Closed

Bad code #11

wants to merge 2 commits into from

Conversation

christina-de-martinez
Copy link
Owner

No description provided.

@@ -41,6 +41,24 @@ async function getPRDetails(): Promise<PRDetails> {
};
}

function terribleCode() {

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++) {

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");

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.

}
}
}
}

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++) {

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant