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

Add scalastyle dtos #8

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
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 @@ -11,6 +11,8 @@
import org.springframework.stereotype.Service;

import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
Expand Down Expand Up @@ -48,8 +50,8 @@ public List<CodeAnalysisResultDto> analyzeCode(AnalyzerConfigurationDetailDto ru

String errorOutput = runtimeExecResult.getErrorOutput();
String successOutput = runtimeExecResult.getSuccessOutput();

// List<CodeAnalysisIssueDto> codeAnalysisIssueDtoList = CppcheckResultConverter.convertResult(errorOutput);
String payload = Files.readString(Path.of(tmpConfigDownloadFolder.getAbsolutePath()));
List<CodeAnalysisIssueDto> codeAnalysisIssueDtoList = ScalastyleConverter.convertResult(payload);
// if(codeAnalysisIssueDtoList == null || codeAnalysisIssueDtoList.isEmpty()){
// return list;
// }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package io.codety.scanner.analyzer.scalastyle;

import io.codety.scanner.reporter.dto.CodeAnalysisIssueDto;

import java.util.ArrayList;
import java.util.List;

public class ScalastyleConverter {


public static List<CodeAnalysisIssueDto> convertResult(String payload) {
ArrayList<CodeAnalysisIssueDto> codeAnalysisIssueDtos = new ArrayList<>();



return codeAnalysisIssueDtos;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package io.codety.scanner.analyzer.scalastyle.dto;

import java.util.List;

public class ScalastyleCheckstyle {
private List<ScalastyleFile> file;
private double version;

public List<ScalastyleFile> getFile() {
return file;
}

public void setFile(List<ScalastyleFile> file) {
this.file = file;
}

public double getVersion() {
return version;
}

public void setVersion(double version) {
this.version = version;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package io.codety.scanner.analyzer.scalastyle.dto;

public class ScalastyleError {
private int line;
private String source;
private String severity;
private String message;
private int column;

public int getLine() {
return line;
}

public void setLine(int line) {
this.line = line;
}

public String getSource() {
return source;
}

public void setSource(String source) {
this.source = source;
}

public String getSeverity() {
return severity;
}

public void setSeverity(String severity) {
this.severity = severity;
}

public String getMessage() {
return message;
}

public void setMessage(String message) {
this.message = message;
}

public int getColumn() {
return column;
}

public void setColumn(int column) {
this.column = column;
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package io.codety.scanner.analyzer.scalastyle.dto;

import java.util.List;

public class ScalastyleFile {
private List<ScalastyleError> error;
private String name;

public List<ScalastyleError> getError() {
return error;
}

public void setError(List<ScalastyleError> error) {
this.error = error;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}
12 changes: 12 additions & 0 deletions analyzer-scalastyle/src/test/resources/output-example.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="5.0">
<file name="/Users/user/git/codety-scanner/code-issue-examples/scala/emptyclass.scala">
<error line="1" source="org.scalastyle.file.HeaderMatchesChecker" severity="warning" message="Header does not match expected text"/>
<error source="org.scalastyle.file.NewLineAtEofChecker" severity="warning" message="File must end with newline character"/>
<error column="7" line="1" source="org.scalastyle.scalariform.EmptyClassChecker" severity="warning" message="Redundant braces after class definition"/>
</file>
<file name="/Users/user/git/codety-scanner/code-issue-examples/scala/test.scala">
<error line="1" source="org.scalastyle.file.HeaderMatchesChecker" severity="warning" message="Header does not match expected text"/>
<error source="org.scalastyle.file.NewLineAtEofChecker" severity="warning" message="File must end with newline character"/>
</file>
</checkstyle>