Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,30 @@ private String getProjectName(File directory, ExecutableTarget pythonExe, File s

String projectName = providedProjectName;

if (tomlParseResult != null) {
TomlTable projectTable = tomlParseResult.getTable(PROJECT_KEY);
if(projectTable.contains(NAME_KEY)) {
projectName = projectTable.getString(NAME_KEY);
try {
if (tomlParseResult != null && (tomlParseResult.getTable(PROJECT_KEY) != null)) {
TomlTable projectTable = tomlParseResult.getTable(PROJECT_KEY);
if (projectTable != null && projectTable.contains(NAME_KEY)) {
projectName = projectTable.getString(NAME_KEY);
return projectName;
}
}
} else if (setupFile != null && setupFile.exists()) {
List<String> pythonArguments = Arrays.asList(setupFile.getAbsolutePath(), "--name");
ExecutableOutput executableOutput = executableRunner.execute(ExecutableUtils.createFromTarget(directory, pythonExe, pythonArguments));
if (executableOutput.getReturnCode() == 0) {
List<String> output = executableOutput.getStandardOutputAsList();
projectName = output.get(output.size() - 1).replace('_', '-').trim();
} catch (Exception e) {
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

Catching generic Exception is overly broad. Consider catching more specific exception types (e.g., NullPointerException, TomlParseException) to avoid masking unexpected errors that should be handled differently or propagated.

Copilot uses AI. Check for mistakes.
logger.debug("Failed to parse project name from pyproject.toml.");
Comment on lines +133 to +134
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

The error message should include the exception details to aid debugging. Consider logging the exception message or using logger.debug with the exception parameter: logger.debug(\"Failed to parse project name from pyproject.toml.\", e)

Copilot uses AI. Check for mistakes.
}


try {
if (setupFile != null && setupFile.exists()) {
List<String> pythonArguments = Arrays.asList(setupFile.getAbsolutePath(), "--name");
ExecutableOutput executableOutput = executableRunner.execute(ExecutableUtils.createFromTarget(directory, pythonExe, pythonArguments));
if (executableOutput.getReturnCode() == 0) {
List<String> output = executableOutput.getStandardOutputAsList();
projectName = output.get(output.size() - 1).replace('_', '-').trim();
}
}
} catch (Exception e) {
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

Catching generic Exception is overly broad. Consider catching more specific exception types (e.g., ExecutableRunnerException, IOException) to avoid masking unexpected errors that should be handled differently or propagated.

Suggested change
} catch (Exception e) {
} catch (ExecutableRunnerException e) {

Copilot uses AI. Check for mistakes.
logger.debug("Failed to parse project name from setup.py.");
Comment on lines +147 to +148
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

The error message should include the exception details to aid debugging. Consider logging the exception message or using logger.debug with the exception parameter: logger.debug(\"Failed to parse project name from setup.py.\", e)

Copilot uses AI. Check for mistakes.
}

return projectName;
Expand Down