Skip to content

Conversation

@nureka-rodrigo
Copy link
Contributor

@nureka-rodrigo nureka-rodrigo commented Sep 25, 2025

Purpose

Fixes: #75

In the original implementation, it took a considerable amount of time for the 'Running scans' text to appear in the console, because several time-consuming operations were performed beforehand.

  1. Loading project configurations
  2. Getting external analyzers
  3. Loading platform plugins
  4. Processing rules to include/exclude

Approach

This change moved the "Running Scans" message much earlier in the execution flow, right after the basic validation but before the heavy operations.

image

Check List

This change moved the "Running Scans" message much earlier in the execution flow, right after the basic validation but before the heavy operations.
@nureka-rodrigo
Copy link
Contributor Author

@azinneera @keizer619 PRAM

Comment on lines 188 to 189
outputStream.println();
outputStream.println("Running Scans");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
outputStream.println();
outputStream.println("Running Scans");
outputStream.println("\nRunning Scans");

Better we can add this as a constant variable and use

Copy link
Contributor Author

@nureka-rodrigo nureka-rodrigo Sep 26, 2025

Choose a reason for hiding this comment

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

Fix: 801dbf9

Copy link
Contributor Author

@nureka-rodrigo nureka-rodrigo Sep 26, 2025

Choose a reason for hiding this comment

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

@SasinduDilshara I think using println() instead of \n is the better approach. The println() method is platform-independent and explicitly terminates the line using the system’s line separator, which is safer than hardcoding \n. As the official Java PrintStream documentation states,

Terminates the current line by writing the line separator string. The line separator string is defined by the system property line.separator, and is not necessarily a single newline character ('\n').

While \n works on Unix-like systems, it may not represent the correct line ending on Windows or other environments. Using println() also makes the intent to end the line clearer to readers and avoids subtle inconsistencies in cross-platform code, which is why I think it is the better option here.

Updated the output message for running scans to use a constant from ScanToolConstants, improving maintainability and readability of the code.
Updated the constant name for improved clarity and consistency
@sonarqubecloud
Copy link

@keizer619 keizer619 merged commit 37cb368 into ballerina-platform:main Oct 22, 2025
4 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.

The "Running Scans" message takes a while to appear after executing the command

4 participants