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

Issue #42: Rollback classpath.jar logic #43

Merged
merged 2 commits into from
Nov 12, 2024
Merged

Conversation

sebastianbarrozo
Copy link
Contributor

ETP-729

Copy link
Contributor

Choose a reason for hiding this comment

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

GPT Review for ResolverDependencyLoader.groovy

Review

  • Estimated effort to review [1-5]:
    3, because the changes involve significant modifications to the file handling and classpath management logic, which require careful review to ensure correctness and compatibility with different operating systems.
  • Score: 85

Code feedback

  • File:
    src/main/groovy/com/etendoerp/legacy/dependencies/ResolverDependencyLoader.groovy
  • Language:
    groovy
  • Suggestion:
    Consider using StringBuilder for constructing the strClasspath string. This can improve performance, especially when dealing with a large number of files, as StringBuilder is more efficient for concatenating strings in a loop. [medium]
  • Label:
    performance
  • Existing code:
String strClasspath = ''
files.forEach { String file ->
    if (OperatingSystem.current().isWindows()) {
        // Windows paths need to be file:/// and replace \ with /
        strClasspath += 'file:///' + file.toString().replaceAll('\\\\', '/') + CLASSPATH_SEPARATOR
    } else {
        strClasspath += file.toString() + CLASSPATH_SEPARATOR
    }
}
  • Improved code:
StringBuilder strClasspathBuilder = new StringBuilder()
files.forEach { String file ->
    if (OperatingSystem.current().isWindows()) {
        // Windows paths need to be file:/// and replace \ with /
        strClasspathBuilder.append('file:///').append(file.toString().replaceAll('\\\\', '/')).append(CLASSPATH_SEPARATOR)
    } else {
        strClasspathBuilder.append(file.toString()).append(CLASSPATH_SEPARATOR)
    }
}
String strClasspath = strClasspathBuilder.toString()

This comment has been minimized.

@sebastianbarrozo sebastianbarrozo changed the title Issue #42: Remove log output Issue #42: Rollback classpath.jar logic Nov 11, 2024
Copy link
Contributor

Choose a reason for hiding this comment

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

GPT Review for ResolverDependencyLoader.groovy

Review

  • Estimated effort to review [1-5]:
    4, because the PR involves significant changes to the ResolverDependencyLoader.groovy file, including refactoring and restructuring of the code. The changes are extensive and require careful review to ensure that the functionality remains intact and that no new issues are introduced.
  • Score: 85

Code feedback

  • File:
    src/main/groovy/com/etendoerp/legacy/dependencies/ResolverDependencyLoader.groovy
  • Language:
    groovy
  • Suggestion:
    Consider using StringBuilder for constructing the strClasspath string to improve performance, especially when dealing with a large number of files. [medium]
  • Label:
    performance
  • Existing code:
String strClasspath = ''
files.forEach { String file ->
  if (OperatingSystem.current().isWindows()) {
    // Windows paths need to be file:/// and replace \ with /
    strClasspath += 'file:///' + file.toString().replaceAll('\\\\', '/') + CLASSPATH_SEPARATOR
  } else {
    strClasspath += file.toString() + CLASSPATH_SEPARATOR
  }
}
  • Improved code:
StringBuilder strClasspathBuilder = new StringBuilder()
files.forEach { String file ->
  if (OperatingSystem.current().isWindows()) {
    // Windows paths need to be file:/// and replace \ with /
    strClasspathBuilder.append('file:///').append(file.toString().replaceAll('\\\\', '/')).append(CLASSPATH_SEPARATOR)
  } else {
    strClasspathBuilder.append(file.toString()).append(CLASSPATH_SEPARATOR)
  }
}
String strClasspath = strClasspathBuilder.toString()

Copy link

Passed

Analysis Details

0 Issues

  • Bug 0 Bugs
  • Vulnerability 0 Vulnerabilities
  • Code Smell 0 Code Smells

Coverage and Duplications

  • Coverage No coverage information (0.00% Estimated after merge)
  • Duplications 0.00% Duplicated Code (1.10% Estimated after merge)

Project ID: etendosoftware_com.etendoerp.gradleplugin_AYwRQSlLznJCQ0DZ4Ymu

View in SonarQube

@valeg-etendo valeg-etendo merged commit db9fff1 into main Nov 12, 2024
2 checks passed
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.

4 participants