Skip to content

Commit

Permalink
Update doc comments and project file namings
Browse files Browse the repository at this point in the history
  • Loading branch information
Xenowa committed Apr 16, 2024
1 parent 1e78020 commit ab0bd34
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 27 deletions.
11 changes: 5 additions & 6 deletions ScanCommand/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import org.apache.tools.ant.taskdefs.condition.Os

import java.nio.file.Paths

plugins {
id 'java'
id 'application'
Expand Down Expand Up @@ -159,12 +161,6 @@ task validateSpotbugs() {

spotbugsMain.finalizedBy validateSpotbugs

tasks.test {
useTestNG() {
suites 'src/test/resources/testng.xml'
}
}

// Configurations to automatically build and deploy scan tool
def packageName = "tool_scan"
def tomlVersion = "${project.scanToolVersion}"
Expand Down Expand Up @@ -277,6 +273,9 @@ build {

// Configuring tests
tasks.test {
systemProperty "ballerina.home", Paths.get(System.getenv("BALLERINA_HOME")).resolve("distributions")
.resolve("ballerina-${ballerinaLangVersion}").toString()

useTestNG() {
suites 'src/test/resources/testng.xml'
}
Expand Down
4 changes: 2 additions & 2 deletions ScanCommand/src/main/java/io/ballerina/scan/Reporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import io.ballerina.tools.diagnostics.Location;

/**
* This class represents the reporter used for reporting {@link Issue} instances during analysis.
* This class represents the reporter used for reporting {@link Issue} instances during static code analysis.
*
* @since 0.1.0
* */
Expand All @@ -37,7 +37,7 @@ public interface Reporter {
void reportIssue(Document reportedDocument, Location location, int ruleId);

/**
* This method is used for reporting an analysis issue.
* This method is used for reporting an issue identified during static code analysis.
*
* @param reportedDocument Ballerina document
* @param location location of reported issue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
package io.ballerina.scan;

/**
* {@code ScannerContext} represents a generic context that provides functionalities relevant to the scan process.
* {@code ScannerContext} represents a context that exposes properties required by scanner plugins from the scan tool.
*
* @since 0.1.0
* */
public interface ScannerContext {
/**
* Returns the {@link Reporter} associated with the scanner context.
* Returns the {@link Reporter} that needs to be used to report issues identified.
*
* @return reporter associated with the scanner context
* @return reporter that needs to be used to report issues identified.
* */
Reporter getReporter();
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,33 @@
import io.ballerina.scan.Rule;
import io.ballerina.scan.Source;
import io.ballerina.tools.diagnostics.Location;
import io.ballerina.tools.text.LineRange;
import io.ballerina.tools.text.TextRange;
import org.wso2.ballerinalang.compiler.diagnostic.BLangDiagnosticLocation;

/**
* This class implements the {@link Issue} interface.
*
* @since 0.1.0
* */
public class IssueIml implements Issue {
public class IssueImpl implements Issue {
private final BLangDiagnosticLocation location;
private final RuleIml rule;
private final RuleImpl rule;
private final Source source;
private final String fileName;
private final String filePath;

IssueIml(Location location,
Rule rule,
Source source,
String fileName,
String filePath) {
this.location = new BLangDiagnosticLocation(location.lineRange().fileName(),
location.lineRange().startLine().line(), location.lineRange().endLine().line(),
location.lineRange().startLine().offset(), location.lineRange().endLine().offset(),
location.textRange().startOffset(), location.textRange().length());
this.rule = (RuleIml) rule;
IssueImpl(Location location,
Rule rule,
Source source,
String fileName,
String filePath) {
LineRange lineRange = location.lineRange();
TextRange textRange = location.textRange();
this.location = new BLangDiagnosticLocation(lineRange.fileName(), lineRange.startLine().line(),
lineRange.endLine().line(), lineRange.startLine().offset(), lineRange.endLine().offset(),
textRange.startOffset(), textRange.length());
this.rule = (RuleImpl) rule;
this.source = source;
this.fileName = fileName;
this.filePath = filePath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import java.util.List;

/**
* This class represents the reporter implementation used for reporting {@link Issue} instances during analysis.
* This class implements the {@link Reporter} interface .
*
* @since 0.1.0
* */
Expand All @@ -48,7 +48,7 @@ public void reportIssue(Document reportedDocument, Location location, Rule rule)
Path issuesFilePath = reportedDocument.module().project().documentPath(reportedDocument.documentId())
.orElse(Path.of(documentName));

IssueIml issue = new IssueIml(location, rule, Source.BUILT_IN,
IssueImpl issue = new IssueImpl(location, rule, Source.BUILT_IN,
moduleName + System.lineSeparator() + documentName, issuesFilePath.toString());

issues.add(issue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
*
* @since 0.1.0
* */
public class RuleIml implements Rule {
public class RuleImpl implements Rule {

private final String id;
private final int numericId;
private final String description;
private final Severity severity;

RuleIml(String id, int numericId, String description, Severity severity) {
RuleImpl(String id, int numericId, String description, Severity severity) {
this.id = id;
this.numericId = numericId;
this.description = description;
Expand Down

0 comments on commit ab0bd34

Please sign in to comment.