[sonar] Java 11, use -nsu, exclude maven/online projects (#7459)

This commit is contained in:
Jim Schubert 2020-09-20 16:02:29 -04:00 committed by GitHub
parent 35d42728d9
commit 3ca6bc2518
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 8 deletions

View File

@ -13,13 +13,13 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11
- name: Compile with Maven
run: mvn clean package jacoco:report
run: mvn -B -q clean install jacoco:report
- name: Jacoco Aggregate
run: mvn jacoco:report-aggregate
- name: Publish to Sonar
run: mvn -B -q sonar:sonar -Dsonar.projectKey=OpenAPITools_openapi-generator -Dsonar.organization=openapitools -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${{ secrets.SONAR_LOGIN }} -Dsonar.branch.name=${GITHUB_REF##*/}
run: mvn -B -q -nsu sonar:sonar -Dsonar.projectKey=OpenAPITools_openapi-generator -Dsonar.organization=openapitools -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${{ secrets.SONAR_LOGIN }} -Dsonar.branch.name=${GITHUB_REF##*/}

View File

@ -39,15 +39,16 @@ import java.util.stream.Collectors;
import static org.apache.commons.lang3.StringEscapeUtils.escapeHtml4;
import static org.apache.commons.lang3.StringUtils.isEmpty;
@SuppressWarnings({"unused","java:S106"})
@SuppressWarnings({"unused","java:S106", "java:S1192"})
@Command(name = "config-help", description = "Config help for chosen lang")
public class ConfigHelp extends OpenApiGeneratorCommand {
private static final Logger LOGGER = LoggerFactory.getLogger(Generate.class);
private static final Logger LOGGER = LoggerFactory.getLogger(ConfigHelp.class);
private static final String FORMAT_TEXT = "text";
private static final String FORMAT_MARKDOWN = "markdown";
private static final String FORMAT_YAMLSAMPLE = "yamlsample";
private static final int FEATURE_SET_DISPLAY_WIDTH= 20;
@Option(name = {"-g",
"--generator-name"}, title = "generator name", description = "generator to get config help for")
@ -147,7 +148,7 @@ public class ConfigHelp extends OpenApiGeneratorCommand {
LOGGER.error("[error] Check the spelling of the generator's name and try again.");
System.exit(1);
} catch (IOException e) {
e.printStackTrace();
LOGGER.error("Unexpected error", e);
}
}
@ -396,7 +397,7 @@ public class ConfigHelp extends OpenApiGeneratorCommand {
String definedByKey = "Defined By";
int maxNameLength = flattened.stream().map(FeatureSet.FeatureSetFlattened::getFeatureName).mapToInt(String::length).max().orElse(nameKey.length());
int maxSupportedLength = supportedKey.length();
int definedInLength = 20;
int definedInLength = FEATURE_SET_DISPLAY_WIDTH;
String format = "%-" + maxNameLength + "s\t%-" + maxSupportedLength + "s\t%-" + definedInLength + "s";
flattened.forEach(featureSet -> {

View File

@ -15,6 +15,7 @@
<description>maven plugin to build modules from OpenAPI Generator</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.exclusions>**/src/main/java/org/openapitools/codegen/plugin/**/*</sonar.exclusions>
</properties>
<dependencies>
<dependency>

View File

@ -19,6 +19,7 @@
<springfox-version>3.0.0</springfox-version>
<junit-version>4.13</junit-version>
<jackson-version>2.10.2</jackson-version>
<sonar.exclusions>**/org/openapitools/codegen/online/**/*</sonar.exclusions>
</properties>
<dependencyManagement>
<dependencies>