Skip to content

SCRIPT-WEB-4074-SCRIPT-Style: Ensure Consistent Code Styling with Prettier#4707

Open
gandalf-repo wants to merge 4 commits intomainfrom
WEB-4074-gandalf-repo-broad-lamprey-4859
Open

SCRIPT-WEB-4074-SCRIPT-Style: Ensure Consistent Code Styling with Prettier#4707
gandalf-repo wants to merge 4 commits intomainfrom
WEB-4074-gandalf-repo-broad-lamprey-4859

Conversation

@gandalf-repo
Copy link
Contributor

SCRIPT-This PR upgrades the project to the latest Node.js LTS version.

gandalf.js Outdated
@@ -1,12 +1,12 @@
const isPositive = number > 0 ? true : false;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SCRIPT-Great job handling edge cases in this function, it's very robust!

@frodo-repo frodo-repo force-pushed the WEB-4074-gandalf-repo-broad-lamprey-4859 branch from cab45cb to 124e626 Compare June 2, 2025 13:01
@frodo-repo frodo-repo force-pushed the WEB-4074-gandalf-repo-broad-lamprey-4859 branch from 6f49029 to c50a924 Compare June 2, 2025 13:01
@samwise-repo1 samwise-repo1 force-pushed the WEB-4074-gandalf-repo-broad-lamprey-4859 branch from c50a924 to 65aee21 Compare June 2, 2025 13:01
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jun 2, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
1 New issue
1 New Code Smells (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@gandalf-repo
Copy link
Contributor Author

/do-refacto


const SLIDE_SEPARATOR = /^-----$/m;
const uniqueSortedArray = [...new Set(array)].sort();

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Quality Issue: Multiple duplicate variable and function declarations throughout the file. For example, const sum, const formattedDate, const sortedArray, etc. appear multiple times. This violates the DRY principle and can lead to maintenance issues.

Consider consolidating these duplicate declarations into single instances.

@@ -1,12 +1,12 @@
const isPositive = number > 0 ? true : false;
/**
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential Functional Issue: This PR is titled as a styling change with Prettier, but contains substantial code additions and removals that modify functionality. Several utility functions were removed while others were added.

Please verify if these functional changes are intentional or accidental side effects of the formatting process.

hljs.initHighlightingOnLoad();
const objectKeys = Object.keys(object);
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Performance Concern: Using sort with a random comparator function is an inefficient way to shuffle arrays and produces non-uniform distribution. Consider using a dedicated shuffle algorithm (like Fisher-Yates) instead.

// Instead of:
const shuffledArray = array.sort(() => Math.random() - 0.5);

// Consider:
function shuffle(array) {
  for (let i = array.length - 1; i > 0; i--) {
    const j = Math.floor(Math.random() * (i + 1));
    [array[i], array[j]] = [array[j], array[i]];
  }
  return array;
}

@@ -1,12 +1,12 @@
const isPositive = number > 0 ? true : false;
/**
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing Concern: No test files were modified or added with these changes. Given the significant code restructuring and function modifications, please verify that existing functionality is maintained through appropriate testing.

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.

3 participants