diff options
author | Aurelien Poscia <aurelien.poscia@sonarsource.com> | 2022-10-12 17:12:27 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-10-13 20:03:18 +0000 |
commit | e33830f707d30bfbdbd08a6a58a12f4387b0f5e5 (patch) | |
tree | de29acfa30e513c6c29701935d668c6cb4c32d65 | |
parent | be1fa26026e6713e7eee9094ee9204b73155d214 (diff) | |
download | sonarqube-e33830f707d30bfbdbd08a6a58a12f4387b0f5e5.tar.gz sonarqube-e33830f707d30bfbdbd08a6a58a12f4387b0f5e5.zip |
NO-JIRA fix code smells
4 files changed, 18 insertions, 4 deletions
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/UserUpdater.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/UserUpdater.java index 594de62f0a2..beca143614a 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/UserUpdater.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/UserUpdater.java @@ -68,7 +68,7 @@ public class UserUpdater { private static final String NAME_PARAM = "Name"; private static final String EMAIL_PARAM = "Email"; private static final Pattern START_WITH_SPECIFIC_AUTHORIZED_CHARACTERS = Pattern.compile("^[\\.\\-_@].*$"); - private static final Pattern CONTAINS_ONLY_AUTHORIZED_CHARACTERS = Pattern.compile("\\A\\w[\\w\\.\\-_@]+\\z"); + private static final Pattern CONTAINS_ONLY_AUTHORIZED_CHARACTERS = Pattern.compile("\\A\\w[\\w\\.\\-@]+\\z"); public static final int LOGIN_MIN_LENGTH = 2; public static final int LOGIN_MAX_LENGTH = 255; diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterCreateTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterCreateTest.java index bd9b077a727..7763abaa469 100644 --- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterCreateTest.java +++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterCreateTest.java @@ -325,7 +325,6 @@ public class UserUpdaterCreateTest { .hasMessage("Login is too short (minimum is 2 characters)"); } - @Test public void fail_to_create_user_login_start_with_underscore() { assertThatThrownBy(() -> { @@ -341,6 +340,21 @@ public class UserUpdaterCreateTest { .hasMessage("Login should not start with .-_@"); } + @Test + public void create_user_login_contains_underscore() { + createDefaultGroup(); + String login = "name_with_underscores"; + NewUser newUser = NewUser.builder() + .setLogin(login) + .setName("Marius") + .setEmail("marius@mail.com") + .setPassword("password") + .build(); + + underTest.createAndCommit(db.getSession(), newUser, u -> {}); + + assertThat(dbClient.userDao().selectByLogin(session, login)).isNotNull(); + } @Test public void fail_to_create_user_with_too_long_login() { diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/cache/DefaultAnalysisCacheLoader.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/cache/DefaultAnalysisCacheLoader.java index 319e444026d..ddd52ec73a1 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/cache/DefaultAnalysisCacheLoader.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/cache/DefaultAnalysisCacheLoader.java @@ -23,7 +23,6 @@ import java.io.IOException; import java.io.InputStream; import java.util.Optional; import java.util.zip.GZIPInputStream; -import java.util.zip.InflaterInputStream; import org.sonar.api.scanner.fs.InputProject; import org.sonar.api.utils.MessageException; import org.sonar.api.utils.log.Logger; diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/ProjectFileIndexer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/ProjectFileIndexer.java index e648fe77c79..1219428a305 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/ProjectFileIndexer.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/ProjectFileIndexer.java @@ -79,7 +79,8 @@ public class ProjectFileIndexer { private ProgressReport progressReport; public ProjectFileIndexer(InputComponentStore componentStore, ProjectExclusionFilters exclusionFilters, - SonarGlobalPropertiesFilter sonarGlobalPropertiesFilter, InputModuleHierarchy inputModuleHierarchy, GlobalConfiguration globalConfig, GlobalServerSettings globalServerSettings, ProjectServerSettings projectServerSettings, + SonarGlobalPropertiesFilter sonarGlobalPropertiesFilter, InputModuleHierarchy inputModuleHierarchy, + GlobalConfiguration globalConfig, GlobalServerSettings globalServerSettings, ProjectServerSettings projectServerSettings, FileIndexer fileIndexer, ProjectCoverageAndDuplicationExclusions projectCoverageAndDuplicationExclusions, ScmConfiguration scmConfiguration) { this.componentStore = componentStore; this.sonarGlobalPropertiesFilter = sonarGlobalPropertiesFilter; |