diff options
author | BenoƮt Gianinetti <benoit.gianinetti@sonarsource.com> | 2019-05-16 14:18:42 +0200 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2019-05-20 20:21:07 +0200 |
commit | bf7776ff7da0661c5a966a869e7dae1760fce038 (patch) | |
tree | f3651d50fbc426694a6094cbd1fca1af644195cf /sonar-scanner-engine/src | |
parent | 919604b531633e97a29964f4e4cf72bf1f058f78 (diff) | |
download | sonarqube-bf7776ff7da0661c5a966a869e7dae1760fce038.tar.gz sonarqube-bf7776ff7da0661c5a966a869e7dae1760fce038.zip |
SONARCLOUD-628 Allow UTF-8 characters in project key
Diffstat (limited to 'sonar-scanner-engine/src')
2 files changed, 3 insertions, 28 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorValidator.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorValidator.java index c49d685c9c3..d16261393e9 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorValidator.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ProjectReactorValidator.java @@ -117,8 +117,7 @@ public class ProjectReactorValidator { private static void validateModule(ProjectDefinition moduleDef, List<String> validationMessages) { if (!ComponentKeys.isValidProjectKey(moduleDef.getKey())) { - validationMessages.add(format("\"%s\" is not a valid project or module key. " - + "Allowed characters are alphanumeric, '-', '_', '.' and ':', with at least one non-digit.", moduleDef.getKey())); + validationMessages.add(format("\"%s\" is not a valid project or module key. It cannot be empty nor contain whitespaces.", moduleDef.getKey())); } } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorValidatorTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorValidatorTest.java index 90ec4d316d3..cfda303ff0d 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorValidatorTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/ProjectReactorValidatorTest.java @@ -91,28 +91,14 @@ public class ProjectReactorValidatorTest { public void allow_slash_issues_mode() { when(mode.isIssues()).thenReturn(true); underTest.validate(createProjectReactor("project/key")); - - when(mode.isIssues()).thenReturn(false); - thrown.expect(MessageException.class); - thrown.expectMessage("is not a valid project or module key"); - underTest.validate(createProjectReactor("project/key")); } @Test public void fail_with_invalid_key() { - ProjectReactor reactor = createProjectReactor("foo$bar"); - - thrown.expect(MessageException.class); - thrown.expectMessage("\"foo$bar\" is not a valid project or module key"); - underTest.validate(reactor); - } - - @Test - public void fail_with_backslash_in_key() { - ProjectReactor reactor = createProjectReactor("foo\\bar"); + ProjectReactor reactor = createProjectReactor(" "); thrown.expect(MessageException.class); - thrown.expectMessage("\"foo\\bar\" is not a valid project or module key"); + thrown.expectMessage("\" \" is not a valid project or module key"); underTest.validate(reactor); } @@ -156,16 +142,6 @@ public class ProjectReactorValidatorTest { } @Test - public void fail_with_only_digits() { - ProjectReactor reactor = createProjectReactor("12345"); - - thrown.expect(MessageException.class); - thrown.expectMessage("\"12345\" is not a valid project or module key"); - - underTest.validate(reactor); - } - - @Test public void fail_when_branch_name_is_specified_but_branch_plugin_not_present() { ProjectDefinition def = ProjectDefinition.create().setProperty(CoreProperties.PROJECT_KEY_PROPERTY, "foo"); ProjectReactor reactor = new ProjectReactor(def); |