From: Duarte Meneses Date: Fri, 2 Sep 2016 12:06:49 +0000 (+0200) Subject: SONAR-7722 The project name should not be mandatory X-Git-Tag: 6.1-RC1~236 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e0372972bea10819d0e4f04867e523a8460bcf51;p=sonarqube.git SONAR-7722 The project name should not be mandatory --- diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java index 95953da2422..aab2c11c278 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectDefinition.java @@ -208,7 +208,7 @@ public class ProjectDefinition { public String getName() { String name = properties.get(CoreProperties.PROJECT_NAME_PROPERTY); if (StringUtils.isBlank(name)) { - name = "Unnamed - " + getKey(); + name = getKey(); } return name; } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/bootstrap/ProjectDefinitionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/bootstrap/ProjectDefinitionTest.java index 9cee607615c..94ddaa4cc40 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/bootstrap/ProjectDefinitionTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/bootstrap/ProjectDefinitionTest.java @@ -62,7 +62,7 @@ public class ProjectDefinitionTest { public void shouldSupportDefaultName() { ProjectDefinition def = ProjectDefinition.create(); def.setKey("myKey"); - assertThat(def.getName()).isEqualTo("Unnamed - myKey"); + assertThat(def.getName()).isEqualTo("myKey"); } @Test diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorBuilderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorBuilderTest.java index 84ad528f2df..6f7d8502e17 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorBuilderTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorBuilderTest.java @@ -464,7 +464,7 @@ public class ProjectReactorBuilderTest { public void shouldAcceptNoProjectName() { ProjectDefinition rootProject = loadProjectDefinition("simple-project-with-missing-project-name"); assertThat(rootProject.getOriginalName()).isNull(); - assertThat(rootProject.getName()).isEqualTo("Unnamed - com.foo.project"); + assertThat(rootProject.getName()).isEqualTo("com.foo.project"); } @Test