id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
16,200 | SonarSource/sonarqube | sonar-plugin-api/src/main/java/org/sonar/api/utils/ParsingUtils.java | ParsingUtils.parseNumber | public static double parseNumber(String number, Locale locale) throws ParseException {
if ("".equals(number)) {
return Double.NaN;
}
return NumberFormat.getNumberInstance(locale).parse(number).doubleValue();
} | java | public static double parseNumber(String number, Locale locale) throws ParseException {
if ("".equals(number)) {
return Double.NaN;
}
return NumberFormat.getNumberInstance(locale).parse(number).doubleValue();
} | [
"public",
"static",
"double",
"parseNumber",
"(",
"String",
"number",
",",
"Locale",
"locale",
")",
"throws",
"ParseException",
"{",
"if",
"(",
"\"\"",
".",
"equals",
"(",
"number",
")",
")",
"{",
"return",
"Double",
".",
"NaN",
";",
"}",
"return",
"Numb... | Parses a string with a locale and returns the corresponding number
@throws ParseException if number cannot be parsed | [
"Parses",
"a",
"string",
"with",
"a",
"locale",
"and",
"returns",
"the",
"corresponding",
"number"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/utils/ParsingUtils.java#L43-L48 |
16,201 | SonarSource/sonarqube | sonar-plugin-api/src/main/java/org/sonar/api/utils/ParsingUtils.java | ParsingUtils.scaleValue | public static double scaleValue(double value, int decimals) {
BigDecimal bd = BigDecimal.valueOf(value);
return bd.setScale(decimals, RoundingMode.HALF_UP).doubleValue();
} | java | public static double scaleValue(double value, int decimals) {
BigDecimal bd = BigDecimal.valueOf(value);
return bd.setScale(decimals, RoundingMode.HALF_UP).doubleValue();
} | [
"public",
"static",
"double",
"scaleValue",
"(",
"double",
"value",
",",
"int",
"decimals",
")",
"{",
"BigDecimal",
"bd",
"=",
"BigDecimal",
".",
"valueOf",
"(",
"value",
")",
";",
"return",
"bd",
".",
"setScale",
"(",
"decimals",
",",
"RoundingMode",
".",... | Scales a double value with decimals | [
"Scales",
"a",
"double",
"value",
"with",
"decimals"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/utils/ParsingUtils.java#L69-L72 |
16,202 | SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/permission/UserPermissionDao.java | UserPermissionDao.selectUserPermissionsByQuery | public List<UserPermissionDto> selectUserPermissionsByQuery(DbSession dbSession, PermissionQuery query, Collection<Integer> userIds) {
if (userIds.isEmpty()) {
return emptyList();
}
checkArgument(userIds.size() <= DatabaseUtils.PARTITION_SIZE_FOR_ORACLE, "Maximum 1'000 users are accepted");
return... | java | public List<UserPermissionDto> selectUserPermissionsByQuery(DbSession dbSession, PermissionQuery query, Collection<Integer> userIds) {
if (userIds.isEmpty()) {
return emptyList();
}
checkArgument(userIds.size() <= DatabaseUtils.PARTITION_SIZE_FOR_ORACLE, "Maximum 1'000 users are accepted");
return... | [
"public",
"List",
"<",
"UserPermissionDto",
">",
"selectUserPermissionsByQuery",
"(",
"DbSession",
"dbSession",
",",
"PermissionQuery",
"query",
",",
"Collection",
"<",
"Integer",
">",
"userIds",
")",
"{",
"if",
"(",
"userIds",
".",
"isEmpty",
"(",
")",
")",
"... | List of user permissions ordered by alphabetical order of user names.
Pagination is NOT applied.
No sort is done.
@param query non-null query including optional filters.
@param userIds Filter on user ids, including disabled users. Must not be empty and maximum size is {@link DatabaseUtils#PARTITION_SIZE_FOR_ORACLE}. | [
"List",
"of",
"user",
"permissions",
"ordered",
"by",
"alphabetical",
"order",
"of",
"user",
"names",
".",
"Pagination",
"is",
"NOT",
"applied",
".",
"No",
"sort",
"is",
"done",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/permission/UserPermissionDao.java#L45-L51 |
16,203 | SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/permission/UserPermissionDao.java | UserPermissionDao.countUsersByProjectPermission | public List<CountPerProjectPermission> countUsersByProjectPermission(DbSession dbSession, Collection<Long> projectIds) {
return executeLargeInputs(projectIds, mapper(dbSession)::countUsersByProjectPermission);
} | java | public List<CountPerProjectPermission> countUsersByProjectPermission(DbSession dbSession, Collection<Long> projectIds) {
return executeLargeInputs(projectIds, mapper(dbSession)::countUsersByProjectPermission);
} | [
"public",
"List",
"<",
"CountPerProjectPermission",
">",
"countUsersByProjectPermission",
"(",
"DbSession",
"dbSession",
",",
"Collection",
"<",
"Long",
">",
"projectIds",
")",
"{",
"return",
"executeLargeInputs",
"(",
"projectIds",
",",
"mapper",
"(",
"dbSession",
... | Count the number of users per permission for a given list of projects
@param projectIds a non-null list of project ids to filter on. If empty then an empty list is returned. | [
"Count",
"the",
"number",
"of",
"users",
"per",
"permission",
"for",
"a",
"given",
"list",
"of",
"projects"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/permission/UserPermissionDao.java#L71-L73 |
16,204 | SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/permission/UserPermissionDao.java | UserPermissionDao.selectGlobalPermissionsOfUser | public List<String> selectGlobalPermissionsOfUser(DbSession dbSession, int userId, String organizationUuid) {
return mapper(dbSession).selectGlobalPermissionsOfUser(userId, organizationUuid);
} | java | public List<String> selectGlobalPermissionsOfUser(DbSession dbSession, int userId, String organizationUuid) {
return mapper(dbSession).selectGlobalPermissionsOfUser(userId, organizationUuid);
} | [
"public",
"List",
"<",
"String",
">",
"selectGlobalPermissionsOfUser",
"(",
"DbSession",
"dbSession",
",",
"int",
"userId",
",",
"String",
"organizationUuid",
")",
"{",
"return",
"mapper",
"(",
"dbSession",
")",
".",
"selectGlobalPermissionsOfUser",
"(",
"userId",
... | Gets all the global permissions granted to user for the specified organization.
@return the global permissions. An empty list is returned if user or organization do not exist. | [
"Gets",
"all",
"the",
"global",
"permissions",
"granted",
"to",
"user",
"for",
"the",
"specified",
"organization",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/permission/UserPermissionDao.java#L80-L82 |
16,205 | SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/permission/UserPermissionDao.java | UserPermissionDao.selectProjectPermissionsOfUser | public List<String> selectProjectPermissionsOfUser(DbSession dbSession, int userId, long projectId) {
return mapper(dbSession).selectProjectPermissionsOfUser(userId, projectId);
} | java | public List<String> selectProjectPermissionsOfUser(DbSession dbSession, int userId, long projectId) {
return mapper(dbSession).selectProjectPermissionsOfUser(userId, projectId);
} | [
"public",
"List",
"<",
"String",
">",
"selectProjectPermissionsOfUser",
"(",
"DbSession",
"dbSession",
",",
"int",
"userId",
",",
"long",
"projectId",
")",
"{",
"return",
"mapper",
"(",
"dbSession",
")",
".",
"selectProjectPermissionsOfUser",
"(",
"userId",
",",
... | Gets all the project permissions granted to user for the specified project.
@return the project permissions. An empty list is returned if project or user do not exist. | [
"Gets",
"all",
"the",
"project",
"permissions",
"granted",
"to",
"user",
"for",
"the",
"specified",
"project",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/permission/UserPermissionDao.java#L89-L91 |
16,206 | SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/permission/UserPermissionDao.java | UserPermissionDao.deleteGlobalPermission | public void deleteGlobalPermission(DbSession dbSession, int userId, String permission, String organizationUuid) {
mapper(dbSession).deleteGlobalPermission(userId, permission, organizationUuid);
} | java | public void deleteGlobalPermission(DbSession dbSession, int userId, String permission, String organizationUuid) {
mapper(dbSession).deleteGlobalPermission(userId, permission, organizationUuid);
} | [
"public",
"void",
"deleteGlobalPermission",
"(",
"DbSession",
"dbSession",
",",
"int",
"userId",
",",
"String",
"permission",
",",
"String",
"organizationUuid",
")",
"{",
"mapper",
"(",
"dbSession",
")",
".",
"deleteGlobalPermission",
"(",
"userId",
",",
"permissi... | Removes a single global permission from user | [
"Removes",
"a",
"single",
"global",
"permission",
"from",
"user"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/permission/UserPermissionDao.java#L116-L118 |
16,207 | SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/permission/UserPermissionDao.java | UserPermissionDao.deleteProjectPermission | public void deleteProjectPermission(DbSession dbSession, int userId, String permission, long projectId) {
mapper(dbSession).deleteProjectPermission(userId, permission, projectId);
} | java | public void deleteProjectPermission(DbSession dbSession, int userId, String permission, long projectId) {
mapper(dbSession).deleteProjectPermission(userId, permission, projectId);
} | [
"public",
"void",
"deleteProjectPermission",
"(",
"DbSession",
"dbSession",
",",
"int",
"userId",
",",
"String",
"permission",
",",
"long",
"projectId",
")",
"{",
"mapper",
"(",
"dbSession",
")",
".",
"deleteProjectPermission",
"(",
"userId",
",",
"permission",
... | Removes a single project permission from user | [
"Removes",
"a",
"single",
"project",
"permission",
"from",
"user"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/permission/UserPermissionDao.java#L123-L125 |
16,208 | SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/permission/UserPermissionDao.java | UserPermissionDao.deleteProjectPermissionOfAnyUser | public int deleteProjectPermissionOfAnyUser(DbSession dbSession, long projectId, String permission) {
return mapper(dbSession).deleteProjectPermissionOfAnyUser(projectId, permission);
} | java | public int deleteProjectPermissionOfAnyUser(DbSession dbSession, long projectId, String permission) {
return mapper(dbSession).deleteProjectPermissionOfAnyUser(projectId, permission);
} | [
"public",
"int",
"deleteProjectPermissionOfAnyUser",
"(",
"DbSession",
"dbSession",
",",
"long",
"projectId",
",",
"String",
"permission",
")",
"{",
"return",
"mapper",
"(",
"dbSession",
")",
".",
"deleteProjectPermissionOfAnyUser",
"(",
"projectId",
",",
"permission"... | Deletes the specified permission on the specified project for any user. | [
"Deletes",
"the",
"specified",
"permission",
"on",
"the",
"specified",
"project",
"for",
"any",
"user",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/permission/UserPermissionDao.java#L137-L139 |
16,209 | SonarSource/sonarqube | sonar-core/src/main/java/org/sonar/core/platform/PluginClassloaderFactory.java | PluginClassloaderFactory.create | public Map<PluginClassLoaderDef, ClassLoader> create(Collection<PluginClassLoaderDef> defs) {
ClassLoader baseClassLoader = baseClassLoader();
ClassloaderBuilder builder = new ClassloaderBuilder();
builder.newClassloader(API_CLASSLOADER_KEY, baseClassLoader);
builder.setMask(API_CLASSLOADER_KEY, apiMas... | java | public Map<PluginClassLoaderDef, ClassLoader> create(Collection<PluginClassLoaderDef> defs) {
ClassLoader baseClassLoader = baseClassLoader();
ClassloaderBuilder builder = new ClassloaderBuilder();
builder.newClassloader(API_CLASSLOADER_KEY, baseClassLoader);
builder.setMask(API_CLASSLOADER_KEY, apiMas... | [
"public",
"Map",
"<",
"PluginClassLoaderDef",
",",
"ClassLoader",
">",
"create",
"(",
"Collection",
"<",
"PluginClassLoaderDef",
">",
"defs",
")",
"{",
"ClassLoader",
"baseClassLoader",
"=",
"baseClassLoader",
"(",
")",
";",
"ClassloaderBuilder",
"builder",
"=",
"... | Creates as many classloaders as requested by the input parameter. | [
"Creates",
"as",
"many",
"classloaders",
"as",
"requested",
"by",
"the",
"input",
"parameter",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-core/src/main/java/org/sonar/core/platform/PluginClassloaderFactory.java#L56-L74 |
16,210 | SonarSource/sonarqube | sonar-core/src/main/java/org/sonar/core/platform/PluginClassloaderFactory.java | PluginClassloaderFactory.exportResources | private void exportResources(PluginClassLoaderDef def, ClassloaderBuilder builder, Collection<PluginClassLoaderDef> allPlugins) {
// export the resources to all other plugins
builder.setExportMask(def.getBasePluginKey(), def.getExportMask());
for (PluginClassLoaderDef other : allPlugins) {
if (!other.... | java | private void exportResources(PluginClassLoaderDef def, ClassloaderBuilder builder, Collection<PluginClassLoaderDef> allPlugins) {
// export the resources to all other plugins
builder.setExportMask(def.getBasePluginKey(), def.getExportMask());
for (PluginClassLoaderDef other : allPlugins) {
if (!other.... | [
"private",
"void",
"exportResources",
"(",
"PluginClassLoaderDef",
"def",
",",
"ClassloaderBuilder",
"builder",
",",
"Collection",
"<",
"PluginClassLoaderDef",
">",
"allPlugins",
")",
"{",
"// export the resources to all other plugins",
"builder",
".",
"setExportMask",
"(",... | A plugin can export some resources to other plugins | [
"A",
"plugin",
"can",
"export",
"some",
"resources",
"to",
"other",
"plugins"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-core/src/main/java/org/sonar/core/platform/PluginClassloaderFactory.java#L79-L87 |
16,211 | SonarSource/sonarqube | sonar-core/src/main/java/org/sonar/core/platform/PluginClassloaderFactory.java | PluginClassloaderFactory.build | private Map<PluginClassLoaderDef, ClassLoader> build(Collection<PluginClassLoaderDef> defs, ClassloaderBuilder builder) {
Map<PluginClassLoaderDef, ClassLoader> result = new HashMap<>();
Map<String, ClassLoader> classloadersByBasePluginKey = builder.build();
for (PluginClassLoaderDef def : defs) {
Cla... | java | private Map<PluginClassLoaderDef, ClassLoader> build(Collection<PluginClassLoaderDef> defs, ClassloaderBuilder builder) {
Map<PluginClassLoaderDef, ClassLoader> result = new HashMap<>();
Map<String, ClassLoader> classloadersByBasePluginKey = builder.build();
for (PluginClassLoaderDef def : defs) {
Cla... | [
"private",
"Map",
"<",
"PluginClassLoaderDef",
",",
"ClassLoader",
">",
"build",
"(",
"Collection",
"<",
"PluginClassLoaderDef",
">",
"defs",
",",
"ClassloaderBuilder",
"builder",
")",
"{",
"Map",
"<",
"PluginClassLoaderDef",
",",
"ClassLoader",
">",
"result",
"="... | Builds classloaders and verifies that all of them are correctly defined | [
"Builds",
"classloaders",
"and",
"verifies",
"that",
"all",
"of",
"them",
"are",
"correctly",
"defined"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-core/src/main/java/org/sonar/core/platform/PluginClassloaderFactory.java#L92-L103 |
16,212 | SonarSource/sonarqube | sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/ContextPropertiesCache.java | ContextPropertiesCache.put | public ContextPropertiesCache put(String key, String value) {
checkArgument(key != null, "Key of context property must not be null");
checkArgument(value != null, "Value of context property must not be null");
props.put(key, value);
return this;
} | java | public ContextPropertiesCache put(String key, String value) {
checkArgument(key != null, "Key of context property must not be null");
checkArgument(value != null, "Value of context property must not be null");
props.put(key, value);
return this;
} | [
"public",
"ContextPropertiesCache",
"put",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"checkArgument",
"(",
"key",
"!=",
"null",
",",
"\"Key of context property must not be null\"",
")",
";",
"checkArgument",
"(",
"value",
"!=",
"null",
",",
"\"Value ... | Value is overridden if the key was already stored.
@throws IllegalArgumentException if key is null
@throws IllegalArgumentException if value is null
@since 6.1 | [
"Value",
"is",
"overridden",
"if",
"the",
"key",
"was",
"already",
"stored",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-scanner-engine/src/main/java/org/sonar/scanner/repository/ContextPropertiesCache.java#L37-L42 |
16,213 | SonarSource/sonarqube | server/sonar-process/src/main/java/org/sonar/process/FileUtils2.java | FileUtils2.deleteDirectory | public static void deleteDirectory(File directory) throws IOException {
requireNonNull(directory, DIRECTORY_CAN_NOT_BE_NULL);
if (!directory.exists()) {
return;
}
Path path = directory.toPath();
if (Files.isSymbolicLink(path)) {
throw new IOException(format("Directory '%s' is a symboli... | java | public static void deleteDirectory(File directory) throws IOException {
requireNonNull(directory, DIRECTORY_CAN_NOT_BE_NULL);
if (!directory.exists()) {
return;
}
Path path = directory.toPath();
if (Files.isSymbolicLink(path)) {
throw new IOException(format("Directory '%s' is a symboli... | [
"public",
"static",
"void",
"deleteDirectory",
"(",
"File",
"directory",
")",
"throws",
"IOException",
"{",
"requireNonNull",
"(",
"directory",
",",
"DIRECTORY_CAN_NOT_BE_NULL",
")",
";",
"if",
"(",
"!",
"directory",
".",
"exists",
"(",
")",
")",
"{",
"return"... | Deletes a directory recursively. Does not support symbolic link to directories.
@param directory directory to delete
@throws IOException in case deletion is unsuccessful | [
"Deletes",
"a",
"directory",
"recursively",
".",
"Does",
"not",
"support",
"symbolic",
"link",
"to",
"directories",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-process/src/main/java/org/sonar/process/FileUtils2.java#L98-L117 |
16,214 | SonarSource/sonarqube | server/sonar-process/src/main/java/org/sonar/process/FileUtils2.java | FileUtils2.sizeOf | public static long sizeOf(Path path) throws IOException {
SizeVisitor visitor = new SizeVisitor();
Files.walkFileTree(path, visitor);
return visitor.size;
} | java | public static long sizeOf(Path path) throws IOException {
SizeVisitor visitor = new SizeVisitor();
Files.walkFileTree(path, visitor);
return visitor.size;
} | [
"public",
"static",
"long",
"sizeOf",
"(",
"Path",
"path",
")",
"throws",
"IOException",
"{",
"SizeVisitor",
"visitor",
"=",
"new",
"SizeVisitor",
"(",
")",
";",
"Files",
".",
"walkFileTree",
"(",
"path",
",",
"visitor",
")",
";",
"return",
"visitor",
".",... | Size of file or directory, in bytes. In case of a directory,
the size is the sum of the sizes of all files recursively traversed.
This implementation is recommended over commons-io
{@code FileUtils#sizeOf(File)} which suffers from slow usage of Java IO.
@throws IOException if files can't be traversed or size attribut... | [
"Size",
"of",
"file",
"or",
"directory",
"in",
"bytes",
".",
"In",
"case",
"of",
"a",
"directory",
"the",
"size",
"is",
"the",
"sum",
"of",
"the",
"sizes",
"of",
"all",
"files",
"recursively",
"traversed",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-process/src/main/java/org/sonar/process/FileUtils2.java#L129-L133 |
16,215 | SonarSource/sonarqube | server/sonar-process/src/main/java/org/sonar/process/sharedmemoryfile/DefaultProcessCommands.java | DefaultProcessCommands.reset | public static void reset(File directory, int processNumber) {
try (DefaultProcessCommands processCommands = new DefaultProcessCommands(directory, processNumber, true)) {
// nothing else to do than open file and reset the space of specified process
}
} | java | public static void reset(File directory, int processNumber) {
try (DefaultProcessCommands processCommands = new DefaultProcessCommands(directory, processNumber, true)) {
// nothing else to do than open file and reset the space of specified process
}
} | [
"public",
"static",
"void",
"reset",
"(",
"File",
"directory",
",",
"int",
"processNumber",
")",
"{",
"try",
"(",
"DefaultProcessCommands",
"processCommands",
"=",
"new",
"DefaultProcessCommands",
"(",
"directory",
",",
"processNumber",
",",
"true",
")",
")",
"{... | Clears the shared memory space of the specified process number. | [
"Clears",
"the",
"shared",
"memory",
"space",
"of",
"the",
"specified",
"process",
"number",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-process/src/main/java/org/sonar/process/sharedmemoryfile/DefaultProcessCommands.java#L58-L62 |
16,216 | SonarSource/sonarqube | server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStep.java | LoadReportAnalysisMetadataHolderStep.checkQualityProfilesConsistency | private void checkQualityProfilesConsistency(ScannerReport.Metadata metadata, Organization organization) {
List<String> profileKeys = metadata.getQprofilesPerLanguage().values().stream()
.map(QProfile::getKey)
.collect(toList(metadata.getQprofilesPerLanguage().size()));
try (DbSession dbSession = db... | java | private void checkQualityProfilesConsistency(ScannerReport.Metadata metadata, Organization organization) {
List<String> profileKeys = metadata.getQprofilesPerLanguage().values().stream()
.map(QProfile::getKey)
.collect(toList(metadata.getQprofilesPerLanguage().size()));
try (DbSession dbSession = db... | [
"private",
"void",
"checkQualityProfilesConsistency",
"(",
"ScannerReport",
".",
"Metadata",
"metadata",
",",
"Organization",
"organization",
")",
"{",
"List",
"<",
"String",
">",
"profileKeys",
"=",
"metadata",
".",
"getQprofilesPerLanguage",
"(",
")",
".",
"values... | Check that the Quality profiles sent by scanner correctly relate to the project organization. | [
"Check",
"that",
"the",
"Quality",
"profiles",
"sent",
"by",
"scanner",
"correctly",
"relate",
"to",
"the",
"project",
"organization",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/LoadReportAnalysisMetadataHolderStep.java#L177-L191 |
16,217 | SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/webhook/WebhookDeliveryDao.java | WebhookDeliveryDao.selectByWebhookUuid | public List<WebhookDeliveryLiteDto> selectByWebhookUuid(DbSession dbSession, String webhookUuid, int offset, int limit) {
return mapper(dbSession).selectByWebhookUuid(webhookUuid, new RowBounds(offset, limit));
} | java | public List<WebhookDeliveryLiteDto> selectByWebhookUuid(DbSession dbSession, String webhookUuid, int offset, int limit) {
return mapper(dbSession).selectByWebhookUuid(webhookUuid, new RowBounds(offset, limit));
} | [
"public",
"List",
"<",
"WebhookDeliveryLiteDto",
">",
"selectByWebhookUuid",
"(",
"DbSession",
"dbSession",
",",
"String",
"webhookUuid",
",",
"int",
"offset",
",",
"int",
"limit",
")",
"{",
"return",
"mapper",
"(",
"dbSession",
")",
".",
"selectByWebhookUuid",
... | All the deliveries for the specified webhook. Results are ordered by descending date. | [
"All",
"the",
"deliveries",
"for",
"the",
"specified",
"webhook",
".",
"Results",
"are",
"ordered",
"by",
"descending",
"date",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/webhook/WebhookDeliveryDao.java#L45-L47 |
16,218 | SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/webhook/WebhookDeliveryDao.java | WebhookDeliveryDao.selectOrderedByComponentUuid | public List<WebhookDeliveryLiteDto> selectOrderedByComponentUuid(DbSession dbSession, String componentUuid, int offset, int limit) {
return mapper(dbSession).selectOrderedByComponentUuid(componentUuid, new RowBounds(offset, limit));
} | java | public List<WebhookDeliveryLiteDto> selectOrderedByComponentUuid(DbSession dbSession, String componentUuid, int offset, int limit) {
return mapper(dbSession).selectOrderedByComponentUuid(componentUuid, new RowBounds(offset, limit));
} | [
"public",
"List",
"<",
"WebhookDeliveryLiteDto",
">",
"selectOrderedByComponentUuid",
"(",
"DbSession",
"dbSession",
",",
"String",
"componentUuid",
",",
"int",
"offset",
",",
"int",
"limit",
")",
"{",
"return",
"mapper",
"(",
"dbSession",
")",
".",
"selectOrdered... | All the deliveries for the specified component. Results are ordered by descending date. | [
"All",
"the",
"deliveries",
"for",
"the",
"specified",
"component",
".",
"Results",
"are",
"ordered",
"by",
"descending",
"date",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/webhook/WebhookDeliveryDao.java#L56-L58 |
16,219 | SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/webhook/WebhookDeliveryDao.java | WebhookDeliveryDao.selectOrderedByCeTaskUuid | public List<WebhookDeliveryLiteDto> selectOrderedByCeTaskUuid(DbSession dbSession, String ceTaskUuid, int offset, int limit) {
return mapper(dbSession).selectOrderedByCeTaskUuid(ceTaskUuid, new RowBounds(offset, limit));
} | java | public List<WebhookDeliveryLiteDto> selectOrderedByCeTaskUuid(DbSession dbSession, String ceTaskUuid, int offset, int limit) {
return mapper(dbSession).selectOrderedByCeTaskUuid(ceTaskUuid, new RowBounds(offset, limit));
} | [
"public",
"List",
"<",
"WebhookDeliveryLiteDto",
">",
"selectOrderedByCeTaskUuid",
"(",
"DbSession",
"dbSession",
",",
"String",
"ceTaskUuid",
",",
"int",
"offset",
",",
"int",
"limit",
")",
"{",
"return",
"mapper",
"(",
"dbSession",
")",
".",
"selectOrderedByCeTa... | All the deliveries for the specified CE task. Results are ordered by descending date. | [
"All",
"the",
"deliveries",
"for",
"the",
"specified",
"CE",
"task",
".",
"Results",
"are",
"ordered",
"by",
"descending",
"date",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/webhook/WebhookDeliveryDao.java#L67-L69 |
16,220 | SonarSource/sonarqube | server/sonar-main/src/main/java/org/sonar/application/SchedulerImpl.java | SchedulerImpl.stopProcess | private void stopProcess(ProcessId processId) {
SQProcess process = processesById.get(processId);
if (process != null) {
process.stop(1, TimeUnit.MINUTES);
}
} | java | private void stopProcess(ProcessId processId) {
SQProcess process = processesById.get(processId);
if (process != null) {
process.stop(1, TimeUnit.MINUTES);
}
} | [
"private",
"void",
"stopProcess",
"(",
"ProcessId",
"processId",
")",
"{",
"SQProcess",
"process",
"=",
"processesById",
".",
"get",
"(",
"processId",
")",
";",
"if",
"(",
"process",
"!=",
"null",
")",
"{",
"process",
".",
"stop",
"(",
"1",
",",
"TimeUni... | Request for graceful stop then blocks until process is stopped.
Returns immediately if the process is disabled in configuration. | [
"Request",
"for",
"graceful",
"stop",
"then",
"blocks",
"until",
"process",
"is",
"stopped",
".",
"Returns",
"immediately",
"if",
"the",
"process",
"is",
"disabled",
"in",
"configuration",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-main/src/main/java/org/sonar/application/SchedulerImpl.java#L179-L184 |
16,221 | SonarSource/sonarqube | server/sonar-main/src/main/java/org/sonar/application/SchedulerImpl.java | SchedulerImpl.terminate | @Override
public void terminate() {
// disable ability to request for restart
restartRequested.set(false);
restartDisabled.set(true);
if (nodeLifecycle.tryToMoveTo(NodeLifecycle.State.STOPPING)) {
LOG.info("Stopping SonarQube");
}
stopAll();
if (stopperThread != null) {
stoppe... | java | @Override
public void terminate() {
// disable ability to request for restart
restartRequested.set(false);
restartDisabled.set(true);
if (nodeLifecycle.tryToMoveTo(NodeLifecycle.State.STOPPING)) {
LOG.info("Stopping SonarQube");
}
stopAll();
if (stopperThread != null) {
stoppe... | [
"@",
"Override",
"public",
"void",
"terminate",
"(",
")",
"{",
"// disable ability to request for restart",
"restartRequested",
".",
"set",
"(",
"false",
")",
";",
"restartDisabled",
".",
"set",
"(",
"true",
")",
";",
"if",
"(",
"nodeLifecycle",
".",
"tryToMoveT... | Blocks until all processes are stopped. Pending restart, if
any, is disabled. | [
"Blocks",
"until",
"all",
"processes",
"are",
"stopped",
".",
"Pending",
"restart",
"if",
"any",
"is",
"disabled",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-main/src/main/java/org/sonar/application/SchedulerImpl.java#L190-L207 |
16,222 | SonarSource/sonarqube | server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistComponentsStep.java | PersistComponentsStep.indexExistingDtosByUuids | private Map<String, ComponentDto> indexExistingDtosByUuids(DbSession session) {
return dbClient.componentDao().selectAllComponentsFromProjectKey(session, treeRootHolder.getRoot().getDbKey())
.stream()
.collect(Collectors.toMap(ComponentDto::uuid, Function.identity()));
} | java | private Map<String, ComponentDto> indexExistingDtosByUuids(DbSession session) {
return dbClient.componentDao().selectAllComponentsFromProjectKey(session, treeRootHolder.getRoot().getDbKey())
.stream()
.collect(Collectors.toMap(ComponentDto::uuid, Function.identity()));
} | [
"private",
"Map",
"<",
"String",
",",
"ComponentDto",
">",
"indexExistingDtosByUuids",
"(",
"DbSession",
"session",
")",
"{",
"return",
"dbClient",
".",
"componentDao",
"(",
")",
".",
"selectAllComponentsFromProjectKey",
"(",
"session",
",",
"treeRootHolder",
".",
... | Returns a mutable map of the components currently persisted in database for the project, including
disabled components. | [
"Returns",
"a",
"mutable",
"map",
"of",
"the",
"components",
"currently",
"persisted",
"in",
"database",
"for",
"the",
"project",
"including",
"disabled",
"components",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistComponentsStep.java#L159-L163 |
16,223 | SonarSource/sonarqube | server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistComponentsStep.java | PersistComponentsStep.setParentModuleProperties | private static void setParentModuleProperties(ComponentDto componentDto, PathAwareVisitor.Path<ComponentDtoHolder> path) {
componentDto.setProjectUuid(path.root().getDto().uuid());
ComponentDto parentModule = from(path.getCurrentPath())
.filter(ParentModulePathElement.INSTANCE)
.first()
.get(... | java | private static void setParentModuleProperties(ComponentDto componentDto, PathAwareVisitor.Path<ComponentDtoHolder> path) {
componentDto.setProjectUuid(path.root().getDto().uuid());
ComponentDto parentModule = from(path.getCurrentPath())
.filter(ParentModulePathElement.INSTANCE)
.first()
.get(... | [
"private",
"static",
"void",
"setParentModuleProperties",
"(",
"ComponentDto",
"componentDto",
",",
"PathAwareVisitor",
".",
"Path",
"<",
"ComponentDtoHolder",
">",
"path",
")",
"{",
"componentDto",
".",
"setProjectUuid",
"(",
"path",
".",
"root",
"(",
")",
".",
... | Applies to a node of type either DIRECTORY or FILE | [
"Applies",
"to",
"a",
"node",
"of",
"type",
"either",
"DIRECTORY",
"or",
"FILE"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistComponentsStep.java#L401-L414 |
16,224 | SonarSource/sonarqube | sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/AbstractExtensionDictionnary.java | AbstractExtensionDictionnary.getDependents | private <T> List<Object> getDependents(T extension) {
return new ArrayList<>(evaluateAnnotatedClasses(extension, DependedUpon.class));
} | java | private <T> List<Object> getDependents(T extension) {
return new ArrayList<>(evaluateAnnotatedClasses(extension, DependedUpon.class));
} | [
"private",
"<",
"T",
">",
"List",
"<",
"Object",
">",
"getDependents",
"(",
"T",
"extension",
")",
"{",
"return",
"new",
"ArrayList",
"<>",
"(",
"evaluateAnnotatedClasses",
"(",
"extension",
",",
"DependedUpon",
".",
"class",
")",
")",
";",
"}"
] | Objects that depend upon this extension. | [
"Objects",
"that",
"depend",
"upon",
"this",
"extension",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/AbstractExtensionDictionnary.java#L119-L121 |
16,225 | SonarSource/sonarqube | sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/PluginFiles.java | PluginFiles.get | public Optional<File> get(InstalledPlugin plugin) {
// Does not fail if another process tries to create the directory at the same time.
File jarInCache = jarInCache(plugin.key, plugin.hash);
if (jarInCache.exists() && jarInCache.isFile()) {
return Optional.of(jarInCache);
}
return download(plu... | java | public Optional<File> get(InstalledPlugin plugin) {
// Does not fail if another process tries to create the directory at the same time.
File jarInCache = jarInCache(plugin.key, plugin.hash);
if (jarInCache.exists() && jarInCache.isFile()) {
return Optional.of(jarInCache);
}
return download(plu... | [
"public",
"Optional",
"<",
"File",
">",
"get",
"(",
"InstalledPlugin",
"plugin",
")",
"{",
"// Does not fail if another process tries to create the directory at the same time.",
"File",
"jarInCache",
"=",
"jarInCache",
"(",
"plugin",
".",
"key",
",",
"plugin",
".",
"has... | Get the JAR file of specified plugin. If not present in user local cache,
then it's downloaded from server and added to cache.
@return the file, or {@link Optional#empty()} if plugin not found (404 HTTP code)
@throws IllegalStateException if the plugin can't be downloaded (not 404 nor 2xx HTTP codes)
or can't be cache... | [
"Get",
"the",
"JAR",
"file",
"of",
"specified",
"plugin",
".",
"If",
"not",
"present",
"in",
"user",
"local",
"cache",
"then",
"it",
"s",
"downloaded",
"from",
"server",
"and",
"added",
"to",
"cache",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/PluginFiles.java#L83-L90 |
16,226 | SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/event/EventComponentChangeDto.java | EventComponentChangeDto.setChangeCategory | private EventComponentChangeDto setChangeCategory(String changeCategory) {
this.category = ChangeCategory.fromDbValue(changeCategory)
.orElseThrow(() -> new IllegalArgumentException("Unsupported changeCategory DB value: " + changeCategory));
return this;
} | java | private EventComponentChangeDto setChangeCategory(String changeCategory) {
this.category = ChangeCategory.fromDbValue(changeCategory)
.orElseThrow(() -> new IllegalArgumentException("Unsupported changeCategory DB value: " + changeCategory));
return this;
} | [
"private",
"EventComponentChangeDto",
"setChangeCategory",
"(",
"String",
"changeCategory",
")",
"{",
"this",
".",
"category",
"=",
"ChangeCategory",
".",
"fromDbValue",
"(",
"changeCategory",
")",
".",
"orElseThrow",
"(",
"(",
")",
"->",
"new",
"IllegalArgumentExce... | Used by MyBatis through reflection.
@throws IllegalArgumentException if not a support change category DB value | [
"Used",
"by",
"MyBatis",
"through",
"reflection",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/event/EventComponentChangeDto.java#L93-L97 |
16,227 | SonarSource/sonarqube | sonar-core/src/main/java/org/sonar/core/platform/PluginInfo.java | PluginInfo.isCompatibleWith | public boolean isCompatibleWith(String runtimeVersion) {
if (null == this.minimalSqVersion) {
// no constraint defined on the plugin
return true;
}
Version effectiveMin = Version.create(minimalSqVersion.getName()).removeQualifier();
Version effectiveVersion = Version.create(runtimeVersion).... | java | public boolean isCompatibleWith(String runtimeVersion) {
if (null == this.minimalSqVersion) {
// no constraint defined on the plugin
return true;
}
Version effectiveMin = Version.create(minimalSqVersion.getName()).removeQualifier();
Version effectiveVersion = Version.create(runtimeVersion).... | [
"public",
"boolean",
"isCompatibleWith",
"(",
"String",
"runtimeVersion",
")",
"{",
"if",
"(",
"null",
"==",
"this",
".",
"minimalSqVersion",
")",
"{",
"// no constraint defined on the plugin",
"return",
"true",
";",
"}",
"Version",
"effectiveMin",
"=",
"Version",
... | Find out if this plugin is compatible with a given version of SonarQube.
The version of SQ must be greater than or equal to the minimal version
needed by the plugin. | [
"Find",
"out",
"if",
"this",
"plugin",
"is",
"compatible",
"with",
"a",
"given",
"version",
"of",
"SonarQube",
".",
"The",
"version",
"of",
"SQ",
"must",
"be",
"greater",
"than",
"or",
"equal",
"to",
"the",
"minimal",
"version",
"needed",
"by",
"the",
"p... | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-core/src/main/java/org/sonar/core/platform/PluginInfo.java#L340-L355 |
16,228 | SonarSource/sonarqube | sonar-core/src/main/java/org/sonar/core/issue/tracking/BlockRecognizer.java | BlockRecognizer.match | void match(Input<RAW> rawInput, Input<BASE> baseInput, Tracking<RAW, BASE> tracking) {
BlockHashSequence rawHashSequence = rawInput.getBlockHashSequence();
BlockHashSequence baseHashSequence = baseInput.getBlockHashSequence();
Multimap<Integer, RAW> rawsByLine = groupByLine(tracking.getUnmatchedRaws(), raw... | java | void match(Input<RAW> rawInput, Input<BASE> baseInput, Tracking<RAW, BASE> tracking) {
BlockHashSequence rawHashSequence = rawInput.getBlockHashSequence();
BlockHashSequence baseHashSequence = baseInput.getBlockHashSequence();
Multimap<Integer, RAW> rawsByLine = groupByLine(tracking.getUnmatchedRaws(), raw... | [
"void",
"match",
"(",
"Input",
"<",
"RAW",
">",
"rawInput",
",",
"Input",
"<",
"BASE",
">",
"baseInput",
",",
"Tracking",
"<",
"RAW",
",",
"BASE",
">",
"tracking",
")",
"{",
"BlockHashSequence",
"rawHashSequence",
"=",
"rawInput",
".",
"getBlockHashSequence"... | If base source code is available, then detect code moves through block hashes.
Only the issues associated to a line can be matched here. | [
"If",
"base",
"source",
"code",
"is",
"available",
"then",
"detect",
"code",
"moves",
"through",
"block",
"hashes",
".",
"Only",
"the",
"issues",
"associated",
"to",
"a",
"line",
"can",
"be",
"matched",
"here",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-core/src/main/java/org/sonar/core/issue/tracking/BlockRecognizer.java#L39-L98 |
16,229 | SonarSource/sonarqube | server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/BaseIssuesLoader.java | BaseIssuesLoader.loadUuidsOfComponentsWithOpenIssues | public Set<String> loadUuidsOfComponentsWithOpenIssues() {
try (DbSession dbSession = dbClient.openSession(false)) {
return dbClient.issueDao().selectComponentUuidsOfOpenIssuesForProjectUuid(dbSession, treeRootHolder.getRoot().getUuid());
}
} | java | public Set<String> loadUuidsOfComponentsWithOpenIssues() {
try (DbSession dbSession = dbClient.openSession(false)) {
return dbClient.issueDao().selectComponentUuidsOfOpenIssuesForProjectUuid(dbSession, treeRootHolder.getRoot().getUuid());
}
} | [
"public",
"Set",
"<",
"String",
">",
"loadUuidsOfComponentsWithOpenIssues",
"(",
")",
"{",
"try",
"(",
"DbSession",
"dbSession",
"=",
"dbClient",
".",
"openSession",
"(",
"false",
")",
")",
"{",
"return",
"dbClient",
".",
"issueDao",
"(",
")",
".",
"selectCo... | Uuids of all the components that have open issues on this project. | [
"Uuids",
"of",
"all",
"the",
"components",
"that",
"have",
"open",
"issues",
"on",
"this",
"project",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/BaseIssuesLoader.java#L43-L47 |
16,230 | SonarSource/sonarqube | sonar-scanner-engine/src/main/java/org/sonar/scanner/postjob/PostJobOptimizer.java | PostJobOptimizer.shouldExecute | public boolean shouldExecute(DefaultPostJobDescriptor descriptor) {
if (!settingsCondition(descriptor)) {
LOG.debug("'{}' skipped because one of the required properties is missing", descriptor.name());
return false;
}
return true;
} | java | public boolean shouldExecute(DefaultPostJobDescriptor descriptor) {
if (!settingsCondition(descriptor)) {
LOG.debug("'{}' skipped because one of the required properties is missing", descriptor.name());
return false;
}
return true;
} | [
"public",
"boolean",
"shouldExecute",
"(",
"DefaultPostJobDescriptor",
"descriptor",
")",
"{",
"if",
"(",
"!",
"settingsCondition",
"(",
"descriptor",
")",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"'{}' skipped because one of the required properties is missing\"",
",",
"de... | Decide if the given PostJob should be executed. | [
"Decide",
"if",
"the",
"given",
"PostJob",
"should",
"be",
"executed",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-scanner-engine/src/main/java/org/sonar/scanner/postjob/PostJobOptimizer.java#L40-L46 |
16,231 | SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/RemoveUserAction.java | RemoveUserAction.ensureLastAdminIsNotRemoved | private void ensureLastAdminIsNotRemoved(DbSession dbSession, GroupDto group, UserDto user) {
int remainingAdmins = dbClient.authorizationDao().countUsersWithGlobalPermissionExcludingGroupMember(dbSession,
group.getOrganizationUuid(), OrganizationPermission.ADMINISTER.getKey(), group.getId(), user.getId());
... | java | private void ensureLastAdminIsNotRemoved(DbSession dbSession, GroupDto group, UserDto user) {
int remainingAdmins = dbClient.authorizationDao().countUsersWithGlobalPermissionExcludingGroupMember(dbSession,
group.getOrganizationUuid(), OrganizationPermission.ADMINISTER.getKey(), group.getId(), user.getId());
... | [
"private",
"void",
"ensureLastAdminIsNotRemoved",
"(",
"DbSession",
"dbSession",
",",
"GroupDto",
"group",
",",
"UserDto",
"user",
")",
"{",
"int",
"remainingAdmins",
"=",
"dbClient",
".",
"authorizationDao",
"(",
")",
".",
"countUsersWithGlobalPermissionExcludingGroupM... | Ensure that there are still users with admin global permission if user is removed from the group. | [
"Ensure",
"that",
"there",
"are",
"still",
"users",
"with",
"admin",
"global",
"permission",
"if",
"user",
"is",
"removed",
"from",
"the",
"group",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/RemoveUserAction.java#L93-L97 |
16,232 | SonarSource/sonarqube | server/sonar-server-common/src/main/java/org/sonar/server/es/newindex/StringFieldBuilder.java | StringFieldBuilder.addSubFields | public T addSubFields(DefaultIndexSettingsElement... analyzers) {
Arrays.stream(analyzers)
.forEach(analyzer -> addSubField(analyzer.getSubFieldSuffix(), analyzer.fieldMapping()));
return castThis();
} | java | public T addSubFields(DefaultIndexSettingsElement... analyzers) {
Arrays.stream(analyzers)
.forEach(analyzer -> addSubField(analyzer.getSubFieldSuffix(), analyzer.fieldMapping()));
return castThis();
} | [
"public",
"T",
"addSubFields",
"(",
"DefaultIndexSettingsElement",
"...",
"analyzers",
")",
"{",
"Arrays",
".",
"stream",
"(",
"analyzers",
")",
".",
"forEach",
"(",
"analyzer",
"->",
"addSubField",
"(",
"analyzer",
".",
"getSubFieldSuffix",
"(",
")",
",",
"an... | Add subfields, one for each analyzer. | [
"Add",
"subfields",
"one",
"for",
"each",
"analyzer",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server-common/src/main/java/org/sonar/server/es/newindex/StringFieldBuilder.java#L68-L72 |
16,233 | SonarSource/sonarqube | server/sonar-db-core/src/main/java/org/sonar/db/DdlUtils.java | DdlUtils.createSchema | public static void createSchema(Connection connection, String dialect, boolean createSchemaMigrations) {
if (createSchemaMigrations) {
executeScript(connection, "org/sonar/db/version/schema_migrations-" + dialect + ".ddl");
}
executeScript(connection, "org/sonar/db/version/schema-" + dialect + ".ddl")... | java | public static void createSchema(Connection connection, String dialect, boolean createSchemaMigrations) {
if (createSchemaMigrations) {
executeScript(connection, "org/sonar/db/version/schema_migrations-" + dialect + ".ddl");
}
executeScript(connection, "org/sonar/db/version/schema-" + dialect + ".ddl")... | [
"public",
"static",
"void",
"createSchema",
"(",
"Connection",
"connection",
",",
"String",
"dialect",
",",
"boolean",
"createSchemaMigrations",
")",
"{",
"if",
"(",
"createSchemaMigrations",
")",
"{",
"executeScript",
"(",
"connection",
",",
"\"org/sonar/db/version/s... | The connection is commited in this method but not closed. | [
"The",
"connection",
"is",
"commited",
"in",
"this",
"method",
"but",
"not",
"closed",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-core/src/main/java/org/sonar/db/DdlUtils.java#L45-L51 |
16,234 | SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/rule/RuleUpdater.java | RuleUpdater.getRuleDto | private RuleDto getRuleDto(RuleUpdate change) {
try (DbSession dbSession = dbClient.openSession(false)) {
RuleDto rule = dbClient.ruleDao().selectOrFailByKey(dbSession, change.getOrganization(), change.getRuleKey());
if (RuleStatus.REMOVED == rule.getStatus()) {
throw new IllegalArgumentExceptio... | java | private RuleDto getRuleDto(RuleUpdate change) {
try (DbSession dbSession = dbClient.openSession(false)) {
RuleDto rule = dbClient.ruleDao().selectOrFailByKey(dbSession, change.getOrganization(), change.getRuleKey());
if (RuleStatus.REMOVED == rule.getStatus()) {
throw new IllegalArgumentExceptio... | [
"private",
"RuleDto",
"getRuleDto",
"(",
"RuleUpdate",
"change",
")",
"{",
"try",
"(",
"DbSession",
"dbSession",
"=",
"dbClient",
".",
"openSession",
"(",
"false",
")",
")",
"{",
"RuleDto",
"rule",
"=",
"dbClient",
".",
"ruleDao",
"(",
")",
".",
"selectOrF... | Load all the DTOs required for validating changes and updating rule | [
"Load",
"all",
"the",
"DTOs",
"required",
"for",
"validating",
"changes",
"and",
"updating",
"rule"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/rule/RuleUpdater.java#L92-L100 |
16,235 | SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/setting/ws/ValuesAction.java | ValuesAction.loadComponentSettings | private Multimap<String, Setting> loadComponentSettings(DbSession dbSession, Set<String> keys, ComponentDto component) {
List<String> componentUuids = DOT_SPLITTER.splitToList(component.moduleUuidPath());
List<ComponentDto> componentDtos = dbClient.componentDao().selectByUuids(dbSession, componentUuids);
Se... | java | private Multimap<String, Setting> loadComponentSettings(DbSession dbSession, Set<String> keys, ComponentDto component) {
List<String> componentUuids = DOT_SPLITTER.splitToList(component.moduleUuidPath());
List<ComponentDto> componentDtos = dbClient.componentDao().selectByUuids(dbSession, componentUuids);
Se... | [
"private",
"Multimap",
"<",
"String",
",",
"Setting",
">",
"loadComponentSettings",
"(",
"DbSession",
"dbSession",
",",
"Set",
"<",
"String",
">",
"keys",
",",
"ComponentDto",
"component",
")",
"{",
"List",
"<",
"String",
">",
"componentUuids",
"=",
"DOT_SPLIT... | Return list of settings by component uuid, sorted from project to lowest module | [
"Return",
"list",
"of",
"settings",
"by",
"component",
"uuid",
"sorted",
"from",
"project",
"to",
"lowest",
"module"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/setting/ws/ValuesAction.java#L220-L237 |
16,236 | SonarSource/sonarqube | server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationHandler.java | ChangesOnMyIssueNotificationHandler.isPeerChanged | private static boolean isPeerChanged(Change change, ChangedIssue issue) {
Optional<User> assignee = issue.getAssignee();
return !assignee.isPresent() || !change.isAuthorLogin(assignee.get().getLogin());
} | java | private static boolean isPeerChanged(Change change, ChangedIssue issue) {
Optional<User> assignee = issue.getAssignee();
return !assignee.isPresent() || !change.isAuthorLogin(assignee.get().getLogin());
} | [
"private",
"static",
"boolean",
"isPeerChanged",
"(",
"Change",
"change",
",",
"ChangedIssue",
"issue",
")",
"{",
"Optional",
"<",
"User",
">",
"assignee",
"=",
"issue",
".",
"getAssignee",
"(",
")",
";",
"return",
"!",
"assignee",
".",
"isPresent",
"(",
"... | Is the author of the change the assignee of the specified issue?
If not, it means the issue has been changed by a peer of the author of the change. | [
"Is",
"the",
"author",
"of",
"the",
"change",
"the",
"assignee",
"of",
"the",
"specified",
"issue?",
"If",
"not",
"it",
"means",
"the",
"issue",
"has",
"been",
"changed",
"by",
"a",
"peer",
"of",
"the",
"author",
"of",
"the",
"change",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server-common/src/main/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationHandler.java#L174-L177 |
16,237 | SonarSource/sonarqube | server/sonar-server-common/src/main/java/org/sonar/server/es/Facets.java | Facets.get | @CheckForNull
public LinkedHashMap<String, Long> get(String facetName) {
return facetsByName.get(facetName);
} | java | @CheckForNull
public LinkedHashMap<String, Long> get(String facetName) {
return facetsByName.get(facetName);
} | [
"@",
"CheckForNull",
"public",
"LinkedHashMap",
"<",
"String",
",",
"Long",
">",
"get",
"(",
"String",
"facetName",
")",
"{",
"return",
"facetsByName",
".",
"get",
"(",
"facetName",
")",
";",
"}"
] | The buckets of the given facet. Null if the facet does not exist | [
"The",
"buckets",
"of",
"the",
"given",
"facet",
".",
"Null",
"if",
"the",
"facet",
"does",
"not",
"exist"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server-common/src/main/java/org/sonar/server/es/Facets.java#L167-L170 |
16,238 | SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/user/AbstractUserSession.java | AbstractUserSession.doKeepAuthorizedComponents | protected List<ComponentDto> doKeepAuthorizedComponents(String permission, Collection<ComponentDto> components) {
boolean allowPublicComponent = PUBLIC_PERMISSIONS.contains(permission);
return components.stream()
.filter(c -> (allowPublicComponent && !c.isPrivate()) || hasComponentPermission(permission, c... | java | protected List<ComponentDto> doKeepAuthorizedComponents(String permission, Collection<ComponentDto> components) {
boolean allowPublicComponent = PUBLIC_PERMISSIONS.contains(permission);
return components.stream()
.filter(c -> (allowPublicComponent && !c.isPrivate()) || hasComponentPermission(permission, c... | [
"protected",
"List",
"<",
"ComponentDto",
">",
"doKeepAuthorizedComponents",
"(",
"String",
"permission",
",",
"Collection",
"<",
"ComponentDto",
">",
"components",
")",
"{",
"boolean",
"allowPublicComponent",
"=",
"PUBLIC_PERMISSIONS",
".",
"contains",
"(",
"permissi... | Naive implementation, to be overridden if needed | [
"Naive",
"implementation",
"to",
"be",
"overridden",
"if",
"needed"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/user/AbstractUserSession.java#L133-L138 |
16,239 | SonarSource/sonarqube | server/sonar-server-common/src/main/java/org/sonar/server/setting/ChildSettings.java | ChildSettings.getProperties | @Override
public Map<String, String> getProperties() {
// order is important. local properties override parent properties.
ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
builder.putAll(parentSettings.getProperties());
builder.putAll(localProperties);
return builder.build();... | java | @Override
public Map<String, String> getProperties() {
// order is important. local properties override parent properties.
ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
builder.putAll(parentSettings.getProperties());
builder.putAll(localProperties);
return builder.build();... | [
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"String",
">",
"getProperties",
"(",
")",
"{",
"// order is important. local properties override parent properties.",
"ImmutableMap",
".",
"Builder",
"<",
"String",
",",
"String",
">",
"builder",
"=",
"ImmutableMap... | Only returns the currently loaded properties.
<p>
On the Web Server, global properties are loaded lazily when requested by name. Therefor,
this will return only global properties which have been requested using
{@link #get(String)} at least once prior to this call. | [
"Only",
"returns",
"the",
"currently",
"loaded",
"properties",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server-common/src/main/java/org/sonar/server/setting/ChildSettings.java#L71-L78 |
16,240 | SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/duplication/DuplicationDao.java | DuplicationDao.insert | public void insert(DbSession session, DuplicationUnitDto dto) {
session.getMapper(DuplicationMapper.class).batchInsert(dto);
} | java | public void insert(DbSession session, DuplicationUnitDto dto) {
session.getMapper(DuplicationMapper.class).batchInsert(dto);
} | [
"public",
"void",
"insert",
"(",
"DbSession",
"session",
",",
"DuplicationUnitDto",
"dto",
")",
"{",
"session",
".",
"getMapper",
"(",
"DuplicationMapper",
".",
"class",
")",
".",
"batchInsert",
"(",
"dto",
")",
";",
"}"
] | Insert rows in the table DUPLICATIONS_INDEX.
Note that generated ids are not returned. | [
"Insert",
"rows",
"in",
"the",
"table",
"DUPLICATIONS_INDEX",
".",
"Note",
"that",
"generated",
"ids",
"are",
"not",
"returned",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/duplication/DuplicationDao.java#L45-L47 |
16,241 | SonarSource/sonarqube | sonar-core/src/main/java/org/sonar/core/platform/PluginLoader.java | PluginLoader.basePluginKey | static String basePluginKey(PluginInfo plugin, Map<String, PluginInfo> allPluginsPerKey) {
String base = plugin.getKey();
String parentKey = plugin.getBasePlugin();
while (!Strings.isNullOrEmpty(parentKey)) {
PluginInfo parentPlugin = allPluginsPerKey.get(parentKey);
base = parentPlugin.getKey()... | java | static String basePluginKey(PluginInfo plugin, Map<String, PluginInfo> allPluginsPerKey) {
String base = plugin.getKey();
String parentKey = plugin.getBasePlugin();
while (!Strings.isNullOrEmpty(parentKey)) {
PluginInfo parentPlugin = allPluginsPerKey.get(parentKey);
base = parentPlugin.getKey()... | [
"static",
"String",
"basePluginKey",
"(",
"PluginInfo",
"plugin",
",",
"Map",
"<",
"String",
",",
"PluginInfo",
">",
"allPluginsPerKey",
")",
"{",
"String",
"base",
"=",
"plugin",
".",
"getKey",
"(",
")",
";",
"String",
"parentKey",
"=",
"plugin",
".",
"ge... | Get the root key of a tree of plugins. For example if plugin C depends on B, which depends on A, then
B and C must be attached to the classloader of A. The method returns A in the three cases. | [
"Get",
"the",
"root",
"key",
"of",
"a",
"tree",
"of",
"plugins",
".",
"For",
"example",
"if",
"plugin",
"C",
"depends",
"on",
"B",
"which",
"depends",
"on",
"A",
"then",
"B",
"and",
"C",
"must",
"be",
"attached",
"to",
"the",
"classloader",
"of",
"A"... | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-core/src/main/java/org/sonar/core/platform/PluginLoader.java#L158-L167 |
16,242 | SonarSource/sonarqube | sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/CharsetValidation.java | CharsetValidation.isUTF16 | public Result isUTF16(byte[] buffer, boolean failOnNull) {
if (buffer.length < 2) {
return Result.INVALID;
}
int beAscii = 0;
int beLines = 0;
int leAscii = 0;
int leLines = 0;
for (int i = 0; i < buffer.length / 2; i++) {
// using bytes is fine, since we will compare with posi... | java | public Result isUTF16(byte[] buffer, boolean failOnNull) {
if (buffer.length < 2) {
return Result.INVALID;
}
int beAscii = 0;
int beLines = 0;
int leAscii = 0;
int leLines = 0;
for (int i = 0; i < buffer.length / 2; i++) {
// using bytes is fine, since we will compare with posi... | [
"public",
"Result",
"isUTF16",
"(",
"byte",
"[",
"]",
"buffer",
",",
"boolean",
"failOnNull",
")",
"{",
"if",
"(",
"buffer",
".",
"length",
"<",
"2",
")",
"{",
"return",
"Result",
".",
"INVALID",
";",
"}",
"int",
"beAscii",
"=",
"0",
";",
"int",
"b... | Checks if an array of bytes looks UTF-16 encoded.
We look for clues by checking the presence of nulls and new line control chars in both little and big endian byte orders.
Failing on nulls will greatly reduce FPs if the buffer is actually encoded in UTF-32.
Note that for any unicode between 0-255, UTF-16 encodes it di... | [
"Checks",
"if",
"an",
"array",
"of",
"bytes",
"looks",
"UTF",
"-",
"16",
"encoded",
".",
"We",
"look",
"for",
"clues",
"by",
"checking",
"the",
"presence",
"of",
"nulls",
"and",
"new",
"line",
"control",
"chars",
"in",
"both",
"little",
"and",
"big",
"... | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/CharsetValidation.java#L63-L127 |
16,243 | SonarSource/sonarqube | sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/CharsetValidation.java | CharsetValidation.isValidWindows1252 | public Result isValidWindows1252(byte[] buf) {
for (byte b : buf) {
if (!VALID_WINDOWS_1252[b + 128]) {
return Result.INVALID;
}
}
try {
return new Result(Validation.MAYBE, Charset.forName("Windows-1252"));
} catch (UnsupportedCharsetException e) {
return Result.INVALID;... | java | public Result isValidWindows1252(byte[] buf) {
for (byte b : buf) {
if (!VALID_WINDOWS_1252[b + 128]) {
return Result.INVALID;
}
}
try {
return new Result(Validation.MAYBE, Charset.forName("Windows-1252"));
} catch (UnsupportedCharsetException e) {
return Result.INVALID;... | [
"public",
"Result",
"isValidWindows1252",
"(",
"byte",
"[",
"]",
"buf",
")",
"{",
"for",
"(",
"byte",
"b",
":",
"buf",
")",
"{",
"if",
"(",
"!",
"VALID_WINDOWS_1252",
"[",
"b",
"+",
"128",
"]",
")",
"{",
"return",
"Result",
".",
"INVALID",
";",
"}"... | Verify that the buffer doesn't contain bytes that are not supposed to be used by Windows-1252.
@return Result object with Validation.MAYBE and Windows-1252 if no unknown characters are used,
otherwise Result.INVALID
@param buf byte buffer to validate | [
"Verify",
"that",
"the",
"buffer",
"doesn",
"t",
"contain",
"bytes",
"that",
"are",
"not",
"supposed",
"to",
"be",
"used",
"by",
"Windows",
"-",
"1252",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/CharsetValidation.java#L276-L288 |
16,244 | SonarSource/sonarqube | server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/util/cache/MemoryCache.java | MemoryCache.getAll | public Map<K, V> getAll(Iterable<K> keys) {
List<K> missingKeys = new ArrayList<>();
Map<K, V> result = new HashMap<>();
for (K key : keys) {
V value = map.get(key);
if (value == null && !map.containsKey(key)) {
missingKeys.add(key);
} else {
result.put(key, value);
}... | java | public Map<K, V> getAll(Iterable<K> keys) {
List<K> missingKeys = new ArrayList<>();
Map<K, V> result = new HashMap<>();
for (K key : keys) {
V value = map.get(key);
if (value == null && !map.containsKey(key)) {
missingKeys.add(key);
} else {
result.put(key, value);
}... | [
"public",
"Map",
"<",
"K",
",",
"V",
">",
"getAll",
"(",
"Iterable",
"<",
"K",
">",
"keys",
")",
"{",
"List",
"<",
"K",
">",
"missingKeys",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"Map",
"<",
"K",
",",
"V",
">",
"result",
"=",
"new",
"H... | Get values associated with keys. All the requested keys are included
in the Map result. Value is null if the key is not found in cache. | [
"Get",
"values",
"associated",
"with",
"keys",
".",
"All",
"the",
"requested",
"keys",
"are",
"included",
"in",
"the",
"Map",
"result",
".",
"Value",
"is",
"null",
"if",
"the",
"key",
"is",
"not",
"found",
"in",
"cache",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/util/cache/MemoryCache.java#L64-L87 |
16,245 | SonarSource/sonarqube | server/sonar-process/src/main/java/org/sonar/process/logging/LogbackHelper.java | LogbackHelper.configureForSubprocessGobbler | public void configureForSubprocessGobbler(Props props, String logPattern) {
if (isAllLogsToConsoleEnabled(props)) {
LoggerContext ctx = getRootContext();
ctx.getLogger(ROOT_LOGGER_NAME).addAppender(newConsoleAppender(ctx, "root_console", logPattern));
}
} | java | public void configureForSubprocessGobbler(Props props, String logPattern) {
if (isAllLogsToConsoleEnabled(props)) {
LoggerContext ctx = getRootContext();
ctx.getLogger(ROOT_LOGGER_NAME).addAppender(newConsoleAppender(ctx, "root_console", logPattern));
}
} | [
"public",
"void",
"configureForSubprocessGobbler",
"(",
"Props",
"props",
",",
"String",
"logPattern",
")",
"{",
"if",
"(",
"isAllLogsToConsoleEnabled",
"(",
"props",
")",
")",
"{",
"LoggerContext",
"ctx",
"=",
"getRootContext",
"(",
")",
";",
"ctx",
".",
"get... | Make the logback configuration for a sub process to correctly push all its logs to be read by a stream gobbler
on the sub process's System.out.
@see #buildLogPattern(RootLoggerConfig) | [
"Make",
"the",
"logback",
"configuration",
"for",
"a",
"sub",
"process",
"to",
"correctly",
"push",
"all",
"its",
"logs",
"to",
"be",
"read",
"by",
"a",
"stream",
"gobbler",
"on",
"the",
"sub",
"process",
"s",
"System",
".",
"out",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-process/src/main/java/org/sonar/process/logging/LogbackHelper.java#L211-L216 |
16,246 | SonarSource/sonarqube | server/sonar-process/src/main/java/org/sonar/process/logging/LogbackHelper.java | LogbackHelper.resetFromXml | public void resetFromXml(String xmlResourcePath) throws JoranException {
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(context);
context.reset();
configurator.doConfigure(LogbackHelper.clas... | java | public void resetFromXml(String xmlResourcePath) throws JoranException {
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(context);
context.reset();
configurator.doConfigure(LogbackHelper.clas... | [
"public",
"void",
"resetFromXml",
"(",
"String",
"xmlResourcePath",
")",
"throws",
"JoranException",
"{",
"LoggerContext",
"context",
"=",
"(",
"LoggerContext",
")",
"LoggerFactory",
".",
"getILoggerFactory",
"(",
")",
";",
"JoranConfigurator",
"configurator",
"=",
... | Generally used to reset logback in logging tests | [
"Generally",
"used",
"to",
"reset",
"logback",
"in",
"logging",
"tests"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-process/src/main/java/org/sonar/process/logging/LogbackHelper.java#L233-L239 |
16,247 | SonarSource/sonarqube | server/sonar-process/src/main/java/org/sonar/process/ProcessEntryPoint.java | ProcessEntryPoint.launch | public void launch(Monitored mp) {
if (!lifecycle.tryToMoveTo(Lifecycle.State.STARTING)) {
throw new IllegalStateException("Already started");
}
monitored = mp;
Logger logger = LoggerFactory.getLogger(getClass());
try {
launch(logger);
} catch (Exception e) {
logger.warn("Fail... | java | public void launch(Monitored mp) {
if (!lifecycle.tryToMoveTo(Lifecycle.State.STARTING)) {
throw new IllegalStateException("Already started");
}
monitored = mp;
Logger logger = LoggerFactory.getLogger(getClass());
try {
launch(logger);
} catch (Exception e) {
logger.warn("Fail... | [
"public",
"void",
"launch",
"(",
"Monitored",
"mp",
")",
"{",
"if",
"(",
"!",
"lifecycle",
".",
"tryToMoveTo",
"(",
"Lifecycle",
".",
"State",
".",
"STARTING",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Already started\"",
")",
";",
"}... | Launch process and waits until it's down | [
"Launch",
"process",
"and",
"waits",
"until",
"it",
"s",
"down"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-process/src/main/java/org/sonar/process/ProcessEntryPoint.java#L92-L106 |
16,248 | SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/rule/RuleTagHelper.java | RuleTagHelper.applyTags | static boolean applyTags(RuleDto rule, Set<String> tags) {
for (String tag : tags) {
RuleTagFormat.validate(tag);
}
Set<String> initialTags = rule.getTags();
final Set<String> systemTags = rule.getSystemTags();
Set<String> withoutSystemTags = Sets.filter(tags, input -> input != null && !syste... | java | static boolean applyTags(RuleDto rule, Set<String> tags) {
for (String tag : tags) {
RuleTagFormat.validate(tag);
}
Set<String> initialTags = rule.getTags();
final Set<String> systemTags = rule.getSystemTags();
Set<String> withoutSystemTags = Sets.filter(tags, input -> input != null && !syste... | [
"static",
"boolean",
"applyTags",
"(",
"RuleDto",
"rule",
",",
"Set",
"<",
"String",
">",
"tags",
")",
"{",
"for",
"(",
"String",
"tag",
":",
"tags",
")",
"{",
"RuleTagFormat",
".",
"validate",
"(",
"tag",
")",
";",
"}",
"Set",
"<",
"String",
">",
... | Validates tags and resolves conflicts between user and system tags. | [
"Validates",
"tags",
"and",
"resolves",
"conflicts",
"between",
"user",
"and",
"system",
"tags",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/rule/RuleTagHelper.java#L36-L46 |
16,249 | SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleDao.java | ActiveRuleDao.selectByProfileUuid | public List<OrgActiveRuleDto> selectByProfileUuid(DbSession dbSession, String uuid) {
return mapper(dbSession).selectByProfileUuid(uuid);
} | java | public List<OrgActiveRuleDto> selectByProfileUuid(DbSession dbSession, String uuid) {
return mapper(dbSession).selectByProfileUuid(uuid);
} | [
"public",
"List",
"<",
"OrgActiveRuleDto",
">",
"selectByProfileUuid",
"(",
"DbSession",
"dbSession",
",",
"String",
"uuid",
")",
"{",
"return",
"mapper",
"(",
"dbSession",
")",
".",
"selectByProfileUuid",
"(",
"uuid",
")",
";",
"}"
] | Active rule on removed rule are NOT returned | [
"Active",
"rule",
"on",
"removed",
"rule",
"are",
"NOT",
"returned"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleDao.java#L69-L71 |
16,250 | SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleDao.java | ActiveRuleDao.selectParamsByActiveRuleId | public List<ActiveRuleParamDto> selectParamsByActiveRuleId(DbSession dbSession, Integer activeRuleId) {
return mapper(dbSession).selectParamsByActiveRuleId(activeRuleId);
} | java | public List<ActiveRuleParamDto> selectParamsByActiveRuleId(DbSession dbSession, Integer activeRuleId) {
return mapper(dbSession).selectParamsByActiveRuleId(activeRuleId);
} | [
"public",
"List",
"<",
"ActiveRuleParamDto",
">",
"selectParamsByActiveRuleId",
"(",
"DbSession",
"dbSession",
",",
"Integer",
"activeRuleId",
")",
"{",
"return",
"mapper",
"(",
"dbSession",
")",
".",
"selectParamsByActiveRuleId",
"(",
"activeRuleId",
")",
";",
"}"
... | Nested DTO ActiveRuleParams | [
"Nested",
"DTO",
"ActiveRuleParams"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleDao.java#L136-L138 |
16,251 | SonarSource/sonarqube | server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueAssigner.java | IssueAssigner.guessScmAuthor | private Optional<String> guessScmAuthor(DefaultIssue issue, Component component) {
String author = null;
if (scmChangesets != null) {
author = IssueLocations.allLinesFor(issue, component.getUuid())
.filter(scmChangesets::hasChangesetForLine)
.mapToObj(scmChangesets::getChangesetForLine)
... | java | private Optional<String> guessScmAuthor(DefaultIssue issue, Component component) {
String author = null;
if (scmChangesets != null) {
author = IssueLocations.allLinesFor(issue, component.getUuid())
.filter(scmChangesets::hasChangesetForLine)
.mapToObj(scmChangesets::getChangesetForLine)
... | [
"private",
"Optional",
"<",
"String",
">",
"guessScmAuthor",
"(",
"DefaultIssue",
"issue",
",",
"Component",
"component",
")",
"{",
"String",
"author",
"=",
"null",
";",
"if",
"(",
"scmChangesets",
"!=",
"null",
")",
"{",
"author",
"=",
"IssueLocations",
"."... | Author of the latest change on the lines involved by the issue.
If no authors are set on the lines, then the author of the latest change on the file
is returned. | [
"Author",
"of",
"the",
"latest",
"change",
"on",
"the",
"lines",
"involved",
"by",
"the",
"issue",
".",
"If",
"no",
"authors",
"are",
"set",
"on",
"the",
"lines",
"then",
"the",
"author",
"of",
"the",
"latest",
"change",
"on",
"the",
"file",
"is",
"ret... | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueAssigner.java#L112-L124 |
16,252 | SonarSource/sonarqube | server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/PopulateTableDefaultQProfiles.java | PopulateTableDefaultQProfiles.selectOrgsWithMultipleDefaultProfiles | private static Set<OrgLang> selectOrgsWithMultipleDefaultProfiles(Context context) throws SQLException {
Select rows = context.prepareSelect("select organization_uuid, language from rules_profiles " +
" where is_default = ? " +
" group by organization_uuid, language " +
" having count(kee) > 1 ")
... | java | private static Set<OrgLang> selectOrgsWithMultipleDefaultProfiles(Context context) throws SQLException {
Select rows = context.prepareSelect("select organization_uuid, language from rules_profiles " +
" where is_default = ? " +
" group by organization_uuid, language " +
" having count(kee) > 1 ")
... | [
"private",
"static",
"Set",
"<",
"OrgLang",
">",
"selectOrgsWithMultipleDefaultProfiles",
"(",
"Context",
"context",
")",
"throws",
"SQLException",
"{",
"Select",
"rows",
"=",
"context",
".",
"prepareSelect",
"(",
"\"select organization_uuid, language from rules_profiles \"... | By design the table rules_profiles does not enforce to have a single
profile marked as default for an organization and language.
This method returns the buggy rows. | [
"By",
"design",
"the",
"table",
"rules_profiles",
"does",
"not",
"enforce",
"to",
"have",
"a",
"single",
"profile",
"marked",
"as",
"default",
"for",
"an",
"organization",
"and",
"language",
".",
"This",
"method",
"returns",
"the",
"buggy",
"rows",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v65/PopulateTableDefaultQProfiles.java#L85-L92 |
16,253 | SonarSource/sonarqube | sonar-scanner-engine/src/main/java/org/sonar/scanner/util/ScannerUtils.java | ScannerUtils.cleanKeyForFilename | public static String cleanKeyForFilename(String projectKey) {
String cleanKey = StringUtils.deleteWhitespace(projectKey);
return StringUtils.replace(cleanKey, ":", "_");
} | java | public static String cleanKeyForFilename(String projectKey) {
String cleanKey = StringUtils.deleteWhitespace(projectKey);
return StringUtils.replace(cleanKey, ":", "_");
} | [
"public",
"static",
"String",
"cleanKeyForFilename",
"(",
"String",
"projectKey",
")",
"{",
"String",
"cleanKey",
"=",
"StringUtils",
".",
"deleteWhitespace",
"(",
"projectKey",
")",
";",
"return",
"StringUtils",
".",
"replace",
"(",
"cleanKey",
",",
"\":\"",
",... | Clean provided string to remove chars that are not valid as file name.
@param projectKey e.g. my:file | [
"Clean",
"provided",
"string",
"to",
"remove",
"chars",
"that",
"are",
"not",
"valid",
"as",
"file",
"name",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-scanner-engine/src/main/java/org/sonar/scanner/util/ScannerUtils.java#L37-L40 |
16,254 | SonarSource/sonarqube | server/sonar-server-common/src/main/java/org/sonar/server/issue/index/IssueIndexer.java | IssueIndexer.deleteByKeys | public void deleteByKeys(String projectUuid, Collection<String> issueKeys) {
if (issueKeys.isEmpty()) {
return;
}
BulkIndexer bulkIndexer = createBulkIndexer(Size.REGULAR, IndexingListener.FAIL_ON_ERROR);
bulkIndexer.start();
issueKeys.forEach(issueKey -> bulkIndexer.addDeletion(TYPE_ISSUE.ge... | java | public void deleteByKeys(String projectUuid, Collection<String> issueKeys) {
if (issueKeys.isEmpty()) {
return;
}
BulkIndexer bulkIndexer = createBulkIndexer(Size.REGULAR, IndexingListener.FAIL_ON_ERROR);
bulkIndexer.start();
issueKeys.forEach(issueKey -> bulkIndexer.addDeletion(TYPE_ISSUE.ge... | [
"public",
"void",
"deleteByKeys",
"(",
"String",
"projectUuid",
",",
"Collection",
"<",
"String",
">",
"issueKeys",
")",
"{",
"if",
"(",
"issueKeys",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"BulkIndexer",
"bulkIndexer",
"=",
"createBulkIndexe... | Used by Compute Engine, no need to recovery on errors | [
"Used",
"by",
"Compute",
"Engine",
"no",
"need",
"to",
"recovery",
"on",
"errors"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server-common/src/main/java/org/sonar/server/issue/index/IssueIndexer.java#L226-L235 |
16,255 | SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivator.java | RuleActivator.applySeverityAndParamToChange | private void applySeverityAndParamToChange(RuleActivation request, RuleActivationContext context, ActiveRuleChange change) {
RuleWrapper rule = context.getRule();
ActiveRuleWrapper activeRule = context.getActiveRule();
ActiveRuleWrapper parentActiveRule = context.getParentActiveRule();
// First apply s... | java | private void applySeverityAndParamToChange(RuleActivation request, RuleActivationContext context, ActiveRuleChange change) {
RuleWrapper rule = context.getRule();
ActiveRuleWrapper activeRule = context.getActiveRule();
ActiveRuleWrapper parentActiveRule = context.getParentActiveRule();
// First apply s... | [
"private",
"void",
"applySeverityAndParamToChange",
"(",
"RuleActivation",
"request",
",",
"RuleActivationContext",
"context",
",",
"ActiveRuleChange",
"change",
")",
"{",
"RuleWrapper",
"rule",
"=",
"context",
".",
"getRule",
"(",
")",
";",
"ActiveRuleWrapper",
"acti... | Update severity and params | [
"Update",
"severity",
"and",
"params"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivator.java#L159-L216 |
16,256 | SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivator.java | RuleActivator.isSameAsParent | private static boolean isSameAsParent(ActiveRuleChange change, RuleActivationContext context) {
ActiveRuleWrapper parentActiveRule = context.getParentActiveRule();
if (parentActiveRule == null) {
return false;
}
if (!StringUtils.equals(change.getSeverity(), parentActiveRule.get().getSeverityString... | java | private static boolean isSameAsParent(ActiveRuleChange change, RuleActivationContext context) {
ActiveRuleWrapper parentActiveRule = context.getParentActiveRule();
if (parentActiveRule == null) {
return false;
}
if (!StringUtils.equals(change.getSeverity(), parentActiveRule.get().getSeverityString... | [
"private",
"static",
"boolean",
"isSameAsParent",
"(",
"ActiveRuleChange",
"change",
",",
"RuleActivationContext",
"context",
")",
"{",
"ActiveRuleWrapper",
"parentActiveRule",
"=",
"context",
".",
"getParentActiveRule",
"(",
")",
";",
"if",
"(",
"parentActiveRule",
"... | True if trying to override an inherited rule but with exactly the same values | [
"True",
"if",
"trying",
"to",
"override",
"an",
"inherited",
"rule",
"but",
"with",
"exactly",
"the",
"same",
"values"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivator.java#L454-L468 |
16,257 | SonarSource/sonarqube | server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureToMeasureDto.java | MeasureToMeasureDto.valueAsDouble | @CheckForNull
private static Double valueAsDouble(Measure measure) {
switch (measure.getValueType()) {
case BOOLEAN:
return measure.getBooleanValue() ? 1.0d : 0.0d;
case INT:
return (double) measure.getIntValue();
case LONG:
return (double) measure.getLongValue();
c... | java | @CheckForNull
private static Double valueAsDouble(Measure measure) {
switch (measure.getValueType()) {
case BOOLEAN:
return measure.getBooleanValue() ? 1.0d : 0.0d;
case INT:
return (double) measure.getIntValue();
case LONG:
return (double) measure.getLongValue();
c... | [
"@",
"CheckForNull",
"private",
"static",
"Double",
"valueAsDouble",
"(",
"Measure",
"measure",
")",
"{",
"switch",
"(",
"measure",
".",
"getValueType",
"(",
")",
")",
"{",
"case",
"BOOLEAN",
":",
"return",
"measure",
".",
"getBooleanValue",
"(",
")",
"?",
... | return the numerical value as a double. It's the type used in db.
Returns null if no numerical value found | [
"return",
"the",
"numerical",
"value",
"as",
"a",
"double",
".",
"It",
"s",
"the",
"type",
"used",
"in",
"db",
".",
"Returns",
"null",
"if",
"no",
"numerical",
"value",
"found"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/MeasureToMeasureDto.java#L97-L114 |
16,258 | SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RegisterQualityProfiles.java | RegisterQualityProfiles.ensureBuiltInDefaultQPContainsRules | private void ensureBuiltInDefaultQPContainsRules(DbSession dbSession) {
Map<String, RulesProfileDto> rulesProfilesByLanguage = dbClient.qualityProfileDao().selectBuiltInRuleProfilesWithActiveRules(dbSession).stream()
.collect(toMap(RulesProfileDto::getLanguage, Function.identity(), (oldValue, newValue) -> old... | java | private void ensureBuiltInDefaultQPContainsRules(DbSession dbSession) {
Map<String, RulesProfileDto> rulesProfilesByLanguage = dbClient.qualityProfileDao().selectBuiltInRuleProfilesWithActiveRules(dbSession).stream()
.collect(toMap(RulesProfileDto::getLanguage, Function.identity(), (oldValue, newValue) -> old... | [
"private",
"void",
"ensureBuiltInDefaultQPContainsRules",
"(",
"DbSession",
"dbSession",
")",
"{",
"Map",
"<",
"String",
",",
"RulesProfileDto",
">",
"rulesProfilesByLanguage",
"=",
"dbClient",
".",
"qualityProfileDao",
"(",
")",
".",
"selectBuiltInRuleProfilesWithActiveR... | This method ensure that if a default built-in quality profile does not have any active rules but another built-in one for the same language
does have active rules, the last one will be the default one.
@see <a href="https://jira.sonarsource.com/browse/SONAR-10363">SONAR-10363</a> | [
"This",
"method",
"ensure",
"that",
"if",
"a",
"default",
"built",
"-",
"in",
"quality",
"profile",
"does",
"not",
"have",
"any",
"active",
"rules",
"but",
"another",
"built",
"-",
"in",
"one",
"for",
"the",
"same",
"language",
"does",
"have",
"active",
... | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RegisterQualityProfiles.java#L155-L186 |
16,259 | SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/badge/ws/ETagUtils.java | ETagUtils.hash | private static long hash(byte[] input) {
long hash = FNV1_INIT;
for (byte b : input) {
hash ^= b & 0xff;
hash *= FNV1_PRIME;
}
return hash;
} | java | private static long hash(byte[] input) {
long hash = FNV1_INIT;
for (byte b : input) {
hash ^= b & 0xff;
hash *= FNV1_PRIME;
}
return hash;
} | [
"private",
"static",
"long",
"hash",
"(",
"byte",
"[",
"]",
"input",
")",
"{",
"long",
"hash",
"=",
"FNV1_INIT",
";",
"for",
"(",
"byte",
"b",
":",
"input",
")",
"{",
"hash",
"^=",
"b",
"&",
"0xff",
";",
"hash",
"*=",
"FNV1_PRIME",
";",
"}",
"ret... | hash method of a String independant of the JVM
FNV-1a hash method @see <a href="https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function#FNV-1a_hash"></a> | [
"hash",
"method",
"of",
"a",
"String",
"independant",
"of",
"the",
"JVM",
"FNV",
"-",
"1a",
"hash",
"method"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/badge/ws/ETagUtils.java#L39-L46 |
16,260 | SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDto.java | IssueDto.toDtoForServerInsert | public static IssueDto toDtoForServerInsert(DefaultIssue issue, ComponentDto component, ComponentDto project, int ruleId, long now) {
return toDtoForComputationInsert(issue, ruleId, now)
.setComponent(component)
.setProject(project);
} | java | public static IssueDto toDtoForServerInsert(DefaultIssue issue, ComponentDto component, ComponentDto project, int ruleId, long now) {
return toDtoForComputationInsert(issue, ruleId, now)
.setComponent(component)
.setProject(project);
} | [
"public",
"static",
"IssueDto",
"toDtoForServerInsert",
"(",
"DefaultIssue",
"issue",
",",
"ComponentDto",
"component",
",",
"ComponentDto",
"project",
",",
"int",
"ruleId",
",",
"long",
"now",
")",
"{",
"return",
"toDtoForComputationInsert",
"(",
"issue",
",",
"r... | On server side, we need component keys and uuid | [
"On",
"server",
"side",
"we",
"need",
"component",
"keys",
"and",
"uuid"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/issue/IssueDto.java#L148-L152 |
16,261 | SonarSource/sonarqube | server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImpl.java | CeProcessingSchedulerImpl.stopScheduling | @Override
public void stopScheduling() {
LOG.debug("Stopping compute engine");
// Requesting all workers to stop
for (ChainingCallback chainingCallback : chainingCallbacks) {
chainingCallback.stop(false);
}
// Workers have 40s to gracefully stop processing tasks
long until = System.curr... | java | @Override
public void stopScheduling() {
LOG.debug("Stopping compute engine");
// Requesting all workers to stop
for (ChainingCallback chainingCallback : chainingCallbacks) {
chainingCallback.stop(false);
}
// Workers have 40s to gracefully stop processing tasks
long until = System.curr... | [
"@",
"Override",
"public",
"void",
"stopScheduling",
"(",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Stopping compute engine\"",
")",
";",
"// Requesting all workers to stop",
"for",
"(",
"ChainingCallback",
"chainingCallback",
":",
"chainingCallbacks",
")",
"{",
"chainin... | This method is stopping all the workers giving them a delay before killing them. | [
"This",
"method",
"is",
"stopping",
"all",
"the",
"workers",
"giving",
"them",
"a",
"delay",
"before",
"killing",
"them",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-ce/src/main/java/org/sonar/ce/taskprocessor/CeProcessingSchedulerImpl.java#L76-L105 |
16,262 | SonarSource/sonarqube | sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java | RulesDefinitionXmlLoader.load | public void load(RulesDefinition.NewRepository repo, InputStream input, String encoding) {
load(repo, input, Charset.forName(encoding));
} | java | public void load(RulesDefinition.NewRepository repo, InputStream input, String encoding) {
load(repo, input, Charset.forName(encoding));
} | [
"public",
"void",
"load",
"(",
"RulesDefinition",
".",
"NewRepository",
"repo",
",",
"InputStream",
"input",
",",
"String",
"encoding",
")",
"{",
"load",
"(",
"repo",
",",
"input",
",",
"Charset",
".",
"forName",
"(",
"encoding",
")",
")",
";",
"}"
] | Loads rules by reading the XML input stream. The input stream is not always closed by the method, so it
should be handled by the caller.
@since 4.3 | [
"Loads",
"rules",
"by",
"reading",
"the",
"XML",
"input",
"stream",
".",
"The",
"input",
"stream",
"is",
"not",
"always",
"closed",
"by",
"the",
"method",
"so",
"it",
"should",
"be",
"handled",
"by",
"the",
"caller",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java#L196-L198 |
16,263 | SonarSource/sonarqube | sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java | RulesDefinitionXmlLoader.load | public void load(RulesDefinition.NewRepository repo, Reader reader) {
XMLInputFactory xmlFactory = XMLInputFactory.newInstance();
xmlFactory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE);
xmlFactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.FALSE);
// just so it won't try to loa... | java | public void load(RulesDefinition.NewRepository repo, Reader reader) {
XMLInputFactory xmlFactory = XMLInputFactory.newInstance();
xmlFactory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE);
xmlFactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.FALSE);
// just so it won't try to loa... | [
"public",
"void",
"load",
"(",
"RulesDefinition",
".",
"NewRepository",
"repo",
",",
"Reader",
"reader",
")",
"{",
"XMLInputFactory",
"xmlFactory",
"=",
"XMLInputFactory",
".",
"newInstance",
"(",
")",
";",
"xmlFactory",
".",
"setProperty",
"(",
"XMLInputFactory",... | Loads rules by reading the XML input stream. The reader is not closed by the method, so it
should be handled by the caller.
@since 4.3 | [
"Loads",
"rules",
"by",
"reading",
"the",
"XML",
"input",
"stream",
".",
"The",
"reader",
"is",
"not",
"closed",
"by",
"the",
"method",
"so",
"it",
"should",
"be",
"handled",
"by",
"the",
"caller",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/server/rule/RulesDefinitionXmlLoader.java#L216-L237 |
16,264 | SonarSource/sonarqube | sonar-plugin-api/src/main/java/org/sonar/api/internal/SonarRuntimeImpl.java | SonarRuntimeImpl.forSonarQube | public static SonarRuntime forSonarQube(Version version, SonarQubeSide side) {
return new SonarRuntimeImpl(version, SonarProduct.SONARQUBE, side);
} | java | public static SonarRuntime forSonarQube(Version version, SonarQubeSide side) {
return new SonarRuntimeImpl(version, SonarProduct.SONARQUBE, side);
} | [
"public",
"static",
"SonarRuntime",
"forSonarQube",
"(",
"Version",
"version",
",",
"SonarQubeSide",
"side",
")",
"{",
"return",
"new",
"SonarRuntimeImpl",
"(",
"version",
",",
"SonarProduct",
".",
"SONARQUBE",
",",
"side",
")",
";",
"}"
] | Create an instance for SonarQube runtime environment. | [
"Create",
"an",
"instance",
"for",
"SonarQube",
"runtime",
"environment",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/internal/SonarRuntimeImpl.java#L71-L73 |
16,265 | SonarSource/sonarqube | sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java | RulesProfile.getActiveRulesByRepository | public List<ActiveRule> getActiveRulesByRepository(String repositoryKey) {
List<ActiveRule> result = new ArrayList<>();
for (ActiveRule activeRule : activeRules) {
if (repositoryKey.equals(activeRule.getRepositoryKey()) && activeRule.isEnabled()) {
result.add(activeRule);
}
}
return ... | java | public List<ActiveRule> getActiveRulesByRepository(String repositoryKey) {
List<ActiveRule> result = new ArrayList<>();
for (ActiveRule activeRule : activeRules) {
if (repositoryKey.equals(activeRule.getRepositoryKey()) && activeRule.isEnabled()) {
result.add(activeRule);
}
}
return ... | [
"public",
"List",
"<",
"ActiveRule",
">",
"getActiveRulesByRepository",
"(",
"String",
"repositoryKey",
")",
"{",
"List",
"<",
"ActiveRule",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"ActiveRule",
"activeRule",
":",
"activeRules"... | Get the active rules of a specific repository.
Only enabled rules are selected. Disabled rules are excluded. | [
"Get",
"the",
"active",
"rules",
"of",
"a",
"specific",
"repository",
".",
"Only",
"enabled",
"rules",
"are",
"selected",
".",
"Disabled",
"rules",
"are",
"excluded",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java#L256-L264 |
16,266 | SonarSource/sonarqube | server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueLifecycle.java | IssueLifecycle.copyComment | private static DefaultIssueComment copyComment(String issueKey, DefaultIssueComment c) {
DefaultIssueComment comment = new DefaultIssueComment();
comment.setIssueKey(issueKey);
comment.setKey(Uuids.create());
comment.setUserUuid(c.userUuid());
comment.setMarkdownText(c.markdownText());
comment.s... | java | private static DefaultIssueComment copyComment(String issueKey, DefaultIssueComment c) {
DefaultIssueComment comment = new DefaultIssueComment();
comment.setIssueKey(issueKey);
comment.setKey(Uuids.create());
comment.setUserUuid(c.userUuid());
comment.setMarkdownText(c.markdownText());
comment.s... | [
"private",
"static",
"DefaultIssueComment",
"copyComment",
"(",
"String",
"issueKey",
",",
"DefaultIssueComment",
"c",
")",
"{",
"DefaultIssueComment",
"comment",
"=",
"new",
"DefaultIssueComment",
"(",
")",
";",
"comment",
".",
"setIssueKey",
"(",
"issueKey",
")",
... | Copy a comment from another issue | [
"Copy",
"a",
"comment",
"from",
"another",
"issue"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueLifecycle.java#L121-L130 |
16,267 | SonarSource/sonarqube | server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueLifecycle.java | IssueLifecycle.copyFieldDiffOfIssueFromOtherBranch | private static Optional<FieldDiffs> copyFieldDiffOfIssueFromOtherBranch(String issueKey, FieldDiffs c) {
FieldDiffs result = new FieldDiffs();
result.setIssueKey(issueKey);
result.setUserUuid(c.userUuid());
result.setCreationDate(c.creationDate());
// Don't copy "file" changelogs as they refer to fi... | java | private static Optional<FieldDiffs> copyFieldDiffOfIssueFromOtherBranch(String issueKey, FieldDiffs c) {
FieldDiffs result = new FieldDiffs();
result.setIssueKey(issueKey);
result.setUserUuid(c.userUuid());
result.setCreationDate(c.creationDate());
// Don't copy "file" changelogs as they refer to fi... | [
"private",
"static",
"Optional",
"<",
"FieldDiffs",
">",
"copyFieldDiffOfIssueFromOtherBranch",
"(",
"String",
"issueKey",
",",
"FieldDiffs",
"c",
")",
"{",
"FieldDiffs",
"result",
"=",
"new",
"FieldDiffs",
"(",
")",
";",
"result",
".",
"setIssueKey",
"(",
"issu... | Copy a diff from another issue | [
"Copy",
"a",
"diff",
"from",
"another",
"issue"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueLifecycle.java#L135-L147 |
16,268 | SonarSource/sonarqube | sonar-core/src/main/java/org/sonar/core/issue/tracking/Tracking.java | Tracking.getUnmatchedBases | public Stream<BASE> getUnmatchedBases() {
return bases.stream().filter(base -> !baseToRaw.containsKey(base));
} | java | public Stream<BASE> getUnmatchedBases() {
return bases.stream().filter(base -> !baseToRaw.containsKey(base));
} | [
"public",
"Stream",
"<",
"BASE",
">",
"getUnmatchedBases",
"(",
")",
"{",
"return",
"bases",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"base",
"->",
"!",
"baseToRaw",
".",
"containsKey",
"(",
"base",
")",
")",
";",
"}"
] | The base issues that are not matched by a raw issue and that need to be closed. | [
"The",
"base",
"issues",
"that",
"are",
"not",
"matched",
"by",
"a",
"raw",
"issue",
"and",
"that",
"need",
"to",
"be",
"closed",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-core/src/main/java/org/sonar/core/issue/tracking/Tracking.java#L72-L74 |
16,269 | SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/organization/MemberUpdater.java | MemberUpdater.synchronizeUserOrganizationMembership | public void synchronizeUserOrganizationMembership(DbSession dbSession, UserDto user, ALM alm, Set<String> organizationAlmIds) {
Set<String> userOrganizationUuids = dbClient.organizationMemberDao().selectOrganizationUuidsByUser(dbSession, user.getId());
Set<String> userOrganizationUuidsWithMembersSyncEnabled = d... | java | public void synchronizeUserOrganizationMembership(DbSession dbSession, UserDto user, ALM alm, Set<String> organizationAlmIds) {
Set<String> userOrganizationUuids = dbClient.organizationMemberDao().selectOrganizationUuidsByUser(dbSession, user.getId());
Set<String> userOrganizationUuidsWithMembersSyncEnabled = d... | [
"public",
"void",
"synchronizeUserOrganizationMembership",
"(",
"DbSession",
"dbSession",
",",
"UserDto",
"user",
",",
"ALM",
"alm",
",",
"Set",
"<",
"String",
">",
"organizationAlmIds",
")",
"{",
"Set",
"<",
"String",
">",
"userOrganizationUuids",
"=",
"dbClient"... | Synchronize organization membership of a user from a list of ALM organization specific ids
Please note that no commit will not be executed. | [
"Synchronize",
"organization",
"membership",
"of",
"a",
"user",
"from",
"a",
"list",
"of",
"ALM",
"organization",
"specific",
"ids",
"Please",
"note",
"that",
"no",
"commit",
"will",
"not",
"be",
"executed",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/organization/MemberUpdater.java#L110-L133 |
16,270 | SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/ce/CeQueueDao.java | CeQueueDao.countByStatusAndMainComponentUuids | public Map<String, Integer> countByStatusAndMainComponentUuids(DbSession dbSession, CeQueueDto.Status status, Set<String> projectUuids) {
if (projectUuids.isEmpty()) {
return emptyMap();
}
ImmutableMap.Builder<String, Integer> builder = ImmutableMap.builder();
executeLargeUpdates(
projectUu... | java | public Map<String, Integer> countByStatusAndMainComponentUuids(DbSession dbSession, CeQueueDto.Status status, Set<String> projectUuids) {
if (projectUuids.isEmpty()) {
return emptyMap();
}
ImmutableMap.Builder<String, Integer> builder = ImmutableMap.builder();
executeLargeUpdates(
projectUu... | [
"public",
"Map",
"<",
"String",
",",
"Integer",
">",
"countByStatusAndMainComponentUuids",
"(",
"DbSession",
"dbSession",
",",
"CeQueueDto",
".",
"Status",
"status",
",",
"Set",
"<",
"String",
">",
"projectUuids",
")",
"{",
"if",
"(",
"projectUuids",
".",
"isE... | Counts entries in the queue with the specified status for each specified main component uuid.
The returned map doesn't contain any entry for main component uuids for which there is no entry in the queue (ie.
all entries have a value >= 0). | [
"Counts",
"entries",
"in",
"the",
"queue",
"with",
"the",
"specified",
"status",
"for",
"each",
"specified",
"main",
"component",
"uuid",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/ce/CeQueueDao.java#L151-L164 |
16,271 | SonarSource/sonarqube | sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/output/ScannerReportWriter.java | ScannerReportWriter.writeMetadata | public File writeMetadata(ScannerReport.Metadata metadata) {
Protobuf.write(metadata, fileStructure.metadataFile());
return fileStructure.metadataFile();
} | java | public File writeMetadata(ScannerReport.Metadata metadata) {
Protobuf.write(metadata, fileStructure.metadataFile());
return fileStructure.metadataFile();
} | [
"public",
"File",
"writeMetadata",
"(",
"ScannerReport",
".",
"Metadata",
"metadata",
")",
"{",
"Protobuf",
".",
"write",
"(",
"metadata",
",",
"fileStructure",
".",
"metadataFile",
"(",
")",
")",
";",
"return",
"fileStructure",
".",
"metadataFile",
"(",
")",
... | Metadata is mandatory | [
"Metadata",
"is",
"mandatory"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/output/ScannerReportWriter.java#L54-L57 |
16,272 | SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/permission/AuthorizationDao.java | AuthorizationDao.selectOrganizationPermissions | public Set<String> selectOrganizationPermissions(DbSession dbSession, String organizationUuid, int userId) {
return mapper(dbSession).selectOrganizationPermissions(organizationUuid, userId);
} | java | public Set<String> selectOrganizationPermissions(DbSession dbSession, String organizationUuid, int userId) {
return mapper(dbSession).selectOrganizationPermissions(organizationUuid, userId);
} | [
"public",
"Set",
"<",
"String",
">",
"selectOrganizationPermissions",
"(",
"DbSession",
"dbSession",
",",
"String",
"organizationUuid",
",",
"int",
"userId",
")",
"{",
"return",
"mapper",
"(",
"dbSession",
")",
".",
"selectOrganizationPermissions",
"(",
"organizatio... | Loads all the permissions granted to user for the specified organization | [
"Loads",
"all",
"the",
"permissions",
"granted",
"to",
"user",
"for",
"the",
"specified",
"organization"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/permission/AuthorizationDao.java#L47-L49 |
16,273 | SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/permission/AuthorizationDao.java | AuthorizationDao.selectOrganizationPermissionsOfAnonymous | public Set<String> selectOrganizationPermissionsOfAnonymous(DbSession dbSession, String organizationUuid) {
return mapper(dbSession).selectOrganizationPermissionsOfAnonymous(organizationUuid);
} | java | public Set<String> selectOrganizationPermissionsOfAnonymous(DbSession dbSession, String organizationUuid) {
return mapper(dbSession).selectOrganizationPermissionsOfAnonymous(organizationUuid);
} | [
"public",
"Set",
"<",
"String",
">",
"selectOrganizationPermissionsOfAnonymous",
"(",
"DbSession",
"dbSession",
",",
"String",
"organizationUuid",
")",
"{",
"return",
"mapper",
"(",
"dbSession",
")",
".",
"selectOrganizationPermissionsOfAnonymous",
"(",
"organizationUuid"... | Loads all the permissions granted to anonymous user for the specified organization | [
"Loads",
"all",
"the",
"permissions",
"granted",
"to",
"anonymous",
"user",
"for",
"the",
"specified",
"organization"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/permission/AuthorizationDao.java#L54-L56 |
16,274 | SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/permission/AuthorizationDao.java | AuthorizationDao.selectUserIdsWithGlobalPermission | public List<Integer> selectUserIdsWithGlobalPermission(DbSession dbSession, String organizationUuid, String permission) {
return mapper(dbSession).selectUserIdsWithGlobalPermission(organizationUuid, permission);
} | java | public List<Integer> selectUserIdsWithGlobalPermission(DbSession dbSession, String organizationUuid, String permission) {
return mapper(dbSession).selectUserIdsWithGlobalPermission(organizationUuid, permission);
} | [
"public",
"List",
"<",
"Integer",
">",
"selectUserIdsWithGlobalPermission",
"(",
"DbSession",
"dbSession",
",",
"String",
"organizationUuid",
",",
"String",
"permission",
")",
"{",
"return",
"mapper",
"(",
"dbSession",
")",
".",
"selectUserIdsWithGlobalPermission",
"(... | The list of users who have the global permission.
The anyone virtual group is not taken into account. | [
"The",
"list",
"of",
"users",
"who",
"have",
"the",
"global",
"permission",
".",
"The",
"anyone",
"virtual",
"group",
"is",
"not",
"taken",
"into",
"account",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/permission/AuthorizationDao.java#L102-L104 |
16,275 | SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/permission/AuthorizationDao.java | AuthorizationDao.keepAuthorizedUsersForRoleAndProject | public Collection<Integer> keepAuthorizedUsersForRoleAndProject(DbSession dbSession, Collection<Integer> userIds, String role, long projectId) {
return executeLargeInputs(
userIds,
partitionOfIds -> mapper(dbSession).keepAuthorizedUsersForRoleAndProject(role, projectId, partitionOfIds),
partitionS... | java | public Collection<Integer> keepAuthorizedUsersForRoleAndProject(DbSession dbSession, Collection<Integer> userIds, String role, long projectId) {
return executeLargeInputs(
userIds,
partitionOfIds -> mapper(dbSession).keepAuthorizedUsersForRoleAndProject(role, projectId, partitionOfIds),
partitionS... | [
"public",
"Collection",
"<",
"Integer",
">",
"keepAuthorizedUsersForRoleAndProject",
"(",
"DbSession",
"dbSession",
",",
"Collection",
"<",
"Integer",
">",
"userIds",
",",
"String",
"role",
",",
"long",
"projectId",
")",
"{",
"return",
"executeLargeInputs",
"(",
"... | Keep only authorized user that have the given permission on a given project.
Please Note that if the permission is 'Anyone' is NOT taking into account by this method. | [
"Keep",
"only",
"authorized",
"user",
"that",
"have",
"the",
"given",
"permission",
"on",
"a",
"given",
"project",
".",
"Please",
"Note",
"that",
"if",
"the",
"permission",
"is",
"Anyone",
"is",
"NOT",
"taking",
"into",
"account",
"by",
"this",
"method",
"... | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/permission/AuthorizationDao.java#L171-L176 |
16,276 | SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/permission/AuthorizationDao.java | AuthorizationDao.selectGlobalAdministerEmailSubscribers | public Set<EmailSubscriberDto> selectGlobalAdministerEmailSubscribers(DbSession dbSession) {
return mapper(dbSession).selectEmailSubscribersWithGlobalPermission(ADMINISTER.getKey());
} | java | public Set<EmailSubscriberDto> selectGlobalAdministerEmailSubscribers(DbSession dbSession) {
return mapper(dbSession).selectEmailSubscribersWithGlobalPermission(ADMINISTER.getKey());
} | [
"public",
"Set",
"<",
"EmailSubscriberDto",
">",
"selectGlobalAdministerEmailSubscribers",
"(",
"DbSession",
"dbSession",
")",
"{",
"return",
"mapper",
"(",
"dbSession",
")",
".",
"selectEmailSubscribersWithGlobalPermission",
"(",
"ADMINISTER",
".",
"getKey",
"(",
")",
... | Used by license notifications | [
"Used",
"by",
"license",
"notifications"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/permission/AuthorizationDao.java#L185-L187 |
16,277 | SonarSource/sonarqube | server/sonar-server-common/src/main/java/org/sonar/server/log/ServerProcessLogging.java | ServerProcessLogging.configureDirectToConsoleLoggers | private void configureDirectToConsoleLoggers(LoggerContext context, String... loggerNames) {
RootLoggerConfig config = newRootLoggerConfigBuilder()
.setProcessId(ProcessId.APP)
.setThreadIdFieldPattern("")
.build();
String logPattern = helper.buildLogPattern(config);
ConsoleAppender<ILoggi... | java | private void configureDirectToConsoleLoggers(LoggerContext context, String... loggerNames) {
RootLoggerConfig config = newRootLoggerConfigBuilder()
.setProcessId(ProcessId.APP)
.setThreadIdFieldPattern("")
.build();
String logPattern = helper.buildLogPattern(config);
ConsoleAppender<ILoggi... | [
"private",
"void",
"configureDirectToConsoleLoggers",
"(",
"LoggerContext",
"context",
",",
"String",
"...",
"loggerNames",
")",
"{",
"RootLoggerConfig",
"config",
"=",
"newRootLoggerConfigBuilder",
"(",
")",
".",
"setProcessId",
"(",
"ProcessId",
".",
"APP",
")",
"... | Setup one or more specified loggers to be non additive and to print to System.out which will be caught by the Main
Process and written to sonar.log. | [
"Setup",
"one",
"or",
"more",
"specified",
"loggers",
"to",
"be",
"non",
"additive",
"and",
"to",
"print",
"to",
"System",
".",
"out",
"which",
"will",
"be",
"caught",
"by",
"the",
"Main",
"Process",
"and",
"written",
"to",
"sonar",
".",
"log",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server-common/src/main/java/org/sonar/server/log/ServerProcessLogging.java#L140-L153 |
16,278 | SonarSource/sonarqube | sonar-ws/src/main/java/org/sonarqube/ws/client/OkHttpResponse.java | OkHttpResponse.content | @Override
public String content() {
try (ResponseBody body = okResponse.body()) {
return body.string();
} catch (IOException e) {
throw fail(e);
}
} | java | @Override
public String content() {
try (ResponseBody body = okResponse.body()) {
return body.string();
} catch (IOException e) {
throw fail(e);
}
} | [
"@",
"Override",
"public",
"String",
"content",
"(",
")",
"{",
"try",
"(",
"ResponseBody",
"body",
"=",
"okResponse",
".",
"body",
"(",
")",
")",
"{",
"return",
"body",
".",
"string",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
... | Get body content as a String. This response will be automatically closed. | [
"Get",
"body",
"content",
"as",
"a",
"String",
".",
"This",
"response",
"will",
"be",
"automatically",
"closed",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-ws/src/main/java/org/sonarqube/ws/client/OkHttpResponse.java#L78-L85 |
16,279 | SonarSource/sonarqube | sonar-plugin-api/src/main/java/org/sonar/api/notifications/Notification.java | Notification.getDefaultMessage | public String getDefaultMessage() {
String defaultMessage = getFieldValue(DEFAULT_MESSAGE_KEY);
if (defaultMessage == null) {
defaultMessage = this.toString();
}
return defaultMessage;
} | java | public String getDefaultMessage() {
String defaultMessage = getFieldValue(DEFAULT_MESSAGE_KEY);
if (defaultMessage == null) {
defaultMessage = this.toString();
}
return defaultMessage;
} | [
"public",
"String",
"getDefaultMessage",
"(",
")",
"{",
"String",
"defaultMessage",
"=",
"getFieldValue",
"(",
"DEFAULT_MESSAGE_KEY",
")",
";",
"if",
"(",
"defaultMessage",
"==",
"null",
")",
"{",
"defaultMessage",
"=",
"this",
".",
"toString",
"(",
")",
";",
... | Returns the default message to display for this notification. | [
"Returns",
"the",
"default",
"message",
"to",
"display",
"for",
"this",
"notification",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/notifications/Notification.java#L89-L95 |
16,280 | SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java | TaskFormatter.computeExecutionTimeMs | @CheckForNull
private Long computeExecutionTimeMs(CeQueueDto dto) {
Long startedAt = dto.getStartedAt();
if (startedAt == null) {
return null;
}
return system2.now() - startedAt;
} | java | @CheckForNull
private Long computeExecutionTimeMs(CeQueueDto dto) {
Long startedAt = dto.getStartedAt();
if (startedAt == null) {
return null;
}
return system2.now() - startedAt;
} | [
"@",
"CheckForNull",
"private",
"Long",
"computeExecutionTimeMs",
"(",
"CeQueueDto",
"dto",
")",
"{",
"Long",
"startedAt",
"=",
"dto",
".",
"getStartedAt",
"(",
")",
";",
"if",
"(",
"startedAt",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",... | now - startedAt | [
"now",
"-",
"startedAt"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/ce/ws/TaskFormatter.java#L290-L297 |
16,281 | SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/authentication/ws/LogoutAction.java | LogoutAction.generateAuthenticationEvent | private void generateAuthenticationEvent(HttpServletRequest request, HttpServletResponse response) {
try {
Optional<JwtHttpHandler.Token> token = jwtHttpHandler.getToken(request, response);
String userLogin = token.isPresent() ? token.get().getUserDto().getLogin() : null;
authenticationEvent.logou... | java | private void generateAuthenticationEvent(HttpServletRequest request, HttpServletResponse response) {
try {
Optional<JwtHttpHandler.Token> token = jwtHttpHandler.getToken(request, response);
String userLogin = token.isPresent() ? token.get().getUserDto().getLogin() : null;
authenticationEvent.logou... | [
"private",
"void",
"generateAuthenticationEvent",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"{",
"try",
"{",
"Optional",
"<",
"JwtHttpHandler",
".",
"Token",
">",
"token",
"=",
"jwtHttpHandler",
".",
"getToken",
"(",
"request... | The generation of the authentication event should not prevent the removal of JWT cookie, that's why it's done in a separate method | [
"The",
"generation",
"of",
"the",
"authentication",
"event",
"should",
"not",
"prevent",
"the",
"removal",
"of",
"JWT",
"cookie",
"that",
"s",
"why",
"it",
"s",
"done",
"in",
"a",
"separate",
"method"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/authentication/ws/LogoutAction.java#L87-L95 |
16,282 | SonarSource/sonarqube | sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java | Durations.format | @Deprecated
public String format(Locale locale, Duration duration, DurationFormat format) {
return format(duration);
} | java | @Deprecated
public String format(Locale locale, Duration duration, DurationFormat format) {
return format(duration);
} | [
"@",
"Deprecated",
"public",
"String",
"format",
"(",
"Locale",
"locale",
",",
"Duration",
"duration",
",",
"DurationFormat",
"format",
")",
"{",
"return",
"format",
"(",
"duration",
")",
";",
"}"
] | Return the formatted work duration.
@deprecated since 6.3 as the {@link Locale#ENGLISH} is always used. Use {@link #format(Duration)} instead | [
"Return",
"the",
"formatted",
"work",
"duration",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/utils/Durations.java#L83-L86 |
16,283 | SonarSource/sonarqube | server/sonar-main/src/main/java/org/sonar/application/command/JvmOptions.java | JvmOptions.add | public T add(String str) {
requireNonNull(str, JVM_OPTION_NOT_NULL_ERROR_MESSAGE);
String value = str.trim();
if (isInvalidOption(value)) {
throw new IllegalArgumentException("a JVM option can't be empty and must start with '-'");
}
checkMandatoryOptionOverwrite(value);
options.add(value);... | java | public T add(String str) {
requireNonNull(str, JVM_OPTION_NOT_NULL_ERROR_MESSAGE);
String value = str.trim();
if (isInvalidOption(value)) {
throw new IllegalArgumentException("a JVM option can't be empty and must start with '-'");
}
checkMandatoryOptionOverwrite(value);
options.add(value);... | [
"public",
"T",
"add",
"(",
"String",
"str",
")",
"{",
"requireNonNull",
"(",
"str",
",",
"JVM_OPTION_NOT_NULL_ERROR_MESSAGE",
")",
";",
"String",
"value",
"=",
"str",
".",
"trim",
"(",
")",
";",
"if",
"(",
"isInvalidOption",
"(",
"value",
")",
")",
"{",
... | Add an option.
Argument is trimmed before being added.
@throws IllegalArgumentException if argument is empty or does not start with {@code -}. | [
"Add",
"an",
"option",
".",
"Argument",
"is",
"trimmed",
"before",
"being",
"added",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-main/src/main/java/org/sonar/application/command/JvmOptions.java#L114-L124 |
16,284 | SonarSource/sonarqube | sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java | DateUtils.parseDate | public static Date parseDate(String s) {
return Date.from(parseLocalDate(s).atStartOfDay(ZoneId.systemDefault()).toInstant());
} | java | public static Date parseDate(String s) {
return Date.from(parseLocalDate(s).atStartOfDay(ZoneId.systemDefault()).toInstant());
} | [
"public",
"static",
"Date",
"parseDate",
"(",
"String",
"s",
")",
"{",
"return",
"Date",
".",
"from",
"(",
"parseLocalDate",
"(",
"s",
")",
".",
"atStartOfDay",
"(",
"ZoneId",
".",
"systemDefault",
"(",
")",
")",
".",
"toInstant",
"(",
")",
")",
";",
... | Return a date at the start of day.
@param s string in format {@link #DATE_FORMAT}
@throws SonarException when string cannot be parsed | [
"Return",
"a",
"date",
"at",
"the",
"start",
"of",
"day",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java#L110-L112 |
16,285 | SonarSource/sonarqube | sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java | DateUtils.addDays | public static Date addDays(Date date, int numberOfDays) {
return Date.from(date.toInstant().plus(numberOfDays, ChronoUnit.DAYS));
} | java | public static Date addDays(Date date, int numberOfDays) {
return Date.from(date.toInstant().plus(numberOfDays, ChronoUnit.DAYS));
} | [
"public",
"static",
"Date",
"addDays",
"(",
"Date",
"date",
",",
"int",
"numberOfDays",
")",
"{",
"return",
"Date",
".",
"from",
"(",
"date",
".",
"toInstant",
"(",
")",
".",
"plus",
"(",
"numberOfDays",
",",
"ChronoUnit",
".",
"DAYS",
")",
")",
";",
... | Adds a number of days to a date returning a new object.
The original date object is unchanged.
@param date the date, not null
@param numberOfDays the amount to add, may be negative
@return the new date object with the amount added | [
"Adds",
"a",
"number",
"of",
"days",
"to",
"a",
"date",
"returning",
"a",
"new",
"object",
".",
"The",
"original",
"date",
"object",
"is",
"unchanged",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/utils/DateUtils.java#L297-L299 |
16,286 | SonarSource/sonarqube | sonar-core/src/main/java/org/sonar/core/util/HttpsTrust.java | HttpsTrust.createSocketFactory | private static SSLSocketFactory createSocketFactory(Ssl context) {
try {
return context.newFactory(new AlwaysTrustManager());
} catch (Exception e) {
throw new IllegalStateException("Fail to build SSL factory", e);
}
} | java | private static SSLSocketFactory createSocketFactory(Ssl context) {
try {
return context.newFactory(new AlwaysTrustManager());
} catch (Exception e) {
throw new IllegalStateException("Fail to build SSL factory", e);
}
} | [
"private",
"static",
"SSLSocketFactory",
"createSocketFactory",
"(",
"Ssl",
"context",
")",
"{",
"try",
"{",
"return",
"context",
".",
"newFactory",
"(",
"new",
"AlwaysTrustManager",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",... | Trust all certificates | [
"Trust",
"all",
"certificates"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-core/src/main/java/org/sonar/core/util/HttpsTrust.java#L69-L75 |
16,287 | SonarSource/sonarqube | sonar-core/src/main/java/org/sonar/core/util/HttpsTrust.java | HttpsTrust.createHostnameVerifier | private static HostnameVerifier createHostnameVerifier() {
return new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
return true;
}
};
} | java | private static HostnameVerifier createHostnameVerifier() {
return new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
return true;
}
};
} | [
"private",
"static",
"HostnameVerifier",
"createHostnameVerifier",
"(",
")",
"{",
"return",
"new",
"HostnameVerifier",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"verify",
"(",
"String",
"hostname",
",",
"SSLSession",
"session",
")",
"{",
"return",
"tr... | Trust all hosts | [
"Trust",
"all",
"hosts"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-core/src/main/java/org/sonar/core/util/HttpsTrust.java#L80-L87 |
16,288 | SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java | ComponentDao.selectByKeysAndBranches | public List<ComponentDto> selectByKeysAndBranches(DbSession session, Map<String, String> branchesByKey) {
Set<String> dbKeys = branchesByKey.entrySet().stream()
.map(entry -> generateBranchKey(entry.getKey(), entry.getValue()))
.collect(toSet());
return selectByDbKeys(session, dbKeys);
} | java | public List<ComponentDto> selectByKeysAndBranches(DbSession session, Map<String, String> branchesByKey) {
Set<String> dbKeys = branchesByKey.entrySet().stream()
.map(entry -> generateBranchKey(entry.getKey(), entry.getValue()))
.collect(toSet());
return selectByDbKeys(session, dbKeys);
} | [
"public",
"List",
"<",
"ComponentDto",
">",
"selectByKeysAndBranches",
"(",
"DbSession",
"session",
",",
"Map",
"<",
"String",
",",
"String",
">",
"branchesByKey",
")",
"{",
"Set",
"<",
"String",
">",
"dbKeys",
"=",
"branchesByKey",
".",
"entrySet",
"(",
")"... | Return list of components that will will mix main and branch components.
Please note that a project can only appear once in the list, it's not possible to ask for many branches on same project with this method. | [
"Return",
"list",
"of",
"components",
"that",
"will",
"will",
"mix",
"main",
"and",
"branch",
"components",
".",
"Please",
"note",
"that",
"a",
"project",
"can",
"only",
"appear",
"once",
"in",
"the",
"list",
"it",
"s",
"not",
"possible",
"to",
"ask",
"f... | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java#L212-L217 |
16,289 | SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java | ComponentDao.selectAncestors | public List<ComponentDto> selectAncestors(DbSession dbSession, ComponentDto component) {
if (component.isRoot()) {
return Collections.emptyList();
}
List<String> ancestorUuids = component.getUuidPathAsList();
List<ComponentDto> ancestors = selectByUuids(dbSession, ancestorUuids);
return Orderi... | java | public List<ComponentDto> selectAncestors(DbSession dbSession, ComponentDto component) {
if (component.isRoot()) {
return Collections.emptyList();
}
List<String> ancestorUuids = component.getUuidPathAsList();
List<ComponentDto> ancestors = selectByUuids(dbSession, ancestorUuids);
return Orderi... | [
"public",
"List",
"<",
"ComponentDto",
">",
"selectAncestors",
"(",
"DbSession",
"dbSession",
",",
"ComponentDto",
"component",
")",
"{",
"if",
"(",
"component",
".",
"isRoot",
"(",
")",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"... | List of ancestors, ordered from root to parent. The list is empty
if the component is a tree root. Disabled components are excluded by design
as tree represents the more recent analysis. | [
"List",
"of",
"ancestors",
"ordered",
"from",
"root",
"to",
"parent",
".",
"The",
"list",
"is",
"empty",
"if",
"the",
"component",
"is",
"a",
"tree",
"root",
".",
"Disabled",
"components",
"are",
"excluded",
"by",
"design",
"as",
"tree",
"represents",
"the... | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java#L238-L245 |
16,290 | SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivationContext.java | RuleActivationContext.selectChild | void selectChild(QProfileDto to) {
checkState(!to.isBuiltIn());
QProfileDto qp = requireNonNull(this.profilesByUuid.get(to.getKee()), () -> "No profile with uuid " + to.getKee());
RulesProfileDto ruleProfile = RulesProfileDto.from(qp);
doSwitch(ruleProfile, getRule().get().getId());
} | java | void selectChild(QProfileDto to) {
checkState(!to.isBuiltIn());
QProfileDto qp = requireNonNull(this.profilesByUuid.get(to.getKee()), () -> "No profile with uuid " + to.getKee());
RulesProfileDto ruleProfile = RulesProfileDto.from(qp);
doSwitch(ruleProfile, getRule().get().getId());
} | [
"void",
"selectChild",
"(",
"QProfileDto",
"to",
")",
"{",
"checkState",
"(",
"!",
"to",
".",
"isBuiltIn",
"(",
")",
")",
";",
"QProfileDto",
"qp",
"=",
"requireNonNull",
"(",
"this",
".",
"profilesByUuid",
".",
"get",
"(",
"to",
".",
"getKee",
"(",
")... | Moves cursor to a child profile | [
"Moves",
"cursor",
"to",
"a",
"child",
"profile"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivationContext.java#L214-L220 |
16,291 | SonarSource/sonarqube | sonar-core/src/main/java/org/sonar/core/util/stream/MoreCollectors.java | MoreCollectors.toOneElement | public static <T> Collector<T, ?, T> toOneElement() {
return java.util.stream.Collectors.collectingAndThen(
java.util.stream.Collectors.toList(),
list -> {
if (list.size() != 1) {
throw new IllegalStateException("Stream should have only one element");
}
return list.get(... | java | public static <T> Collector<T, ?, T> toOneElement() {
return java.util.stream.Collectors.collectingAndThen(
java.util.stream.Collectors.toList(),
list -> {
if (list.size() != 1) {
throw new IllegalStateException("Stream should have only one element");
}
return list.get(... | [
"public",
"static",
"<",
"T",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"T",
">",
"toOneElement",
"(",
")",
"{",
"return",
"java",
".",
"util",
".",
"stream",
".",
"Collectors",
".",
"collectingAndThen",
"(",
"java",
".",
"util",
".",
"stream",
".",... | For stream of one expected element, return the element
@throws IllegalArgumentException if stream has no element or more than 1 element | [
"For",
"stream",
"of",
"one",
"expected",
"element",
"return",
"the",
"element"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-core/src/main/java/org/sonar/core/util/stream/MoreCollectors.java#L281-L290 |
16,292 | SonarSource/sonarqube | sonar-core/src/main/java/org/sonar/core/util/UuidFactoryFast.java | UuidFactoryFast.putLong | private static void putLong(byte[] array, long l, int pos, int numberOfLongBytes) {
for (int i = 0; i < numberOfLongBytes; ++i) {
array[pos + numberOfLongBytes - i - 1] = (byte) (l >>> (i * 8));
}
} | java | private static void putLong(byte[] array, long l, int pos, int numberOfLongBytes) {
for (int i = 0; i < numberOfLongBytes; ++i) {
array[pos + numberOfLongBytes - i - 1] = (byte) (l >>> (i * 8));
}
} | [
"private",
"static",
"void",
"putLong",
"(",
"byte",
"[",
"]",
"array",
",",
"long",
"l",
",",
"int",
"pos",
",",
"int",
"numberOfLongBytes",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numberOfLongBytes",
";",
"++",
"i",
")",
"{",
... | Puts the lower numberOfLongBytes from l into the array, starting index pos. | [
"Puts",
"the",
"lower",
"numberOfLongBytes",
"from",
"l",
"into",
"the",
"array",
"starting",
"index",
"pos",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-core/src/main/java/org/sonar/core/util/UuidFactoryFast.java#L62-L66 |
16,293 | SonarSource/sonarqube | server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/ComponentUuidFactoryImpl.java | ComponentUuidFactoryImpl.getOrCreateForKey | @Override
public String getOrCreateForKey(String key) {
return uuidsByKey.computeIfAbsent(key, k -> Uuids.create());
} | java | @Override
public String getOrCreateForKey(String key) {
return uuidsByKey.computeIfAbsent(key, k -> Uuids.create());
} | [
"@",
"Override",
"public",
"String",
"getOrCreateForKey",
"(",
"String",
"key",
")",
"{",
"return",
"uuidsByKey",
".",
"computeIfAbsent",
"(",
"key",
",",
"k",
"->",
"Uuids",
".",
"create",
"(",
")",
")",
";",
"}"
] | Get UUID from database if it exists, otherwise generate a new one. | [
"Get",
"UUID",
"from",
"database",
"if",
"it",
"exists",
"otherwise",
"generate",
"a",
"new",
"one",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/ComponentUuidFactoryImpl.java#L41-L44 |
16,294 | SonarSource/sonarqube | sonar-scanner-engine/src/main/java/org/sonar/scanner/report/AnalysisContextReportPublisher.java | AnalysisContextReportPublisher.collectModuleSpecificProps | private Map<String, String> collectModuleSpecificProps(DefaultInputModule module) {
Map<String, String> moduleSpecificProps = new HashMap<>();
AbstractProjectOrModule parent = hierarchy.parent(module);
if (parent == null) {
moduleSpecificProps.putAll(module.properties());
} else {
Map<String... | java | private Map<String, String> collectModuleSpecificProps(DefaultInputModule module) {
Map<String, String> moduleSpecificProps = new HashMap<>();
AbstractProjectOrModule parent = hierarchy.parent(module);
if (parent == null) {
moduleSpecificProps.putAll(module.properties());
} else {
Map<String... | [
"private",
"Map",
"<",
"String",
",",
"String",
">",
"collectModuleSpecificProps",
"(",
"DefaultInputModule",
"module",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"moduleSpecificProps",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"AbstractProjectOrModul... | Only keep props that are not in parent | [
"Only",
"keep",
"props",
"that",
"are",
"not",
"in",
"parent"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/AnalysisContextReportPublisher.java#L174-L188 |
16,295 | SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/property/ws/IndexAction.java | IndexAction.loadComponentSettings | private Multimap<String, PropertyDto> loadComponentSettings(DbSession dbSession, Optional<String> key, ComponentDto component) {
List<String> componentUuids = DOT_SPLITTER.splitToList(component.moduleUuidPath());
List<ComponentDto> componentDtos = dbClient.componentDao().selectByUuids(dbSession, componentUuids)... | java | private Multimap<String, PropertyDto> loadComponentSettings(DbSession dbSession, Optional<String> key, ComponentDto component) {
List<String> componentUuids = DOT_SPLITTER.splitToList(component.moduleUuidPath());
List<ComponentDto> componentDtos = dbClient.componentDao().selectByUuids(dbSession, componentUuids)... | [
"private",
"Multimap",
"<",
"String",
",",
"PropertyDto",
">",
"loadComponentSettings",
"(",
"DbSession",
"dbSession",
",",
"Optional",
"<",
"String",
">",
"key",
",",
"ComponentDto",
"component",
")",
"{",
"List",
"<",
"String",
">",
"componentUuids",
"=",
"D... | Return list of propertyDto by component uuid, sorted from project to lowest module | [
"Return",
"list",
"of",
"propertyDto",
"by",
"component",
"uuid",
"sorted",
"from",
"project",
"to",
"lowest",
"module"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/property/ws/IndexAction.java#L159-L174 |
16,296 | SonarSource/sonarqube | sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleConfigurationProvider.java | ModuleConfigurationProvider.getTopDownParentProjects | static List<ProjectDefinition> getTopDownParentProjects(ProjectDefinition project) {
List<ProjectDefinition> result = new ArrayList<>();
ProjectDefinition p = project;
while (p != null) {
result.add(0, p);
p = p.getParent();
}
return result;
} | java | static List<ProjectDefinition> getTopDownParentProjects(ProjectDefinition project) {
List<ProjectDefinition> result = new ArrayList<>();
ProjectDefinition p = project;
while (p != null) {
result.add(0, p);
p = p.getParent();
}
return result;
} | [
"static",
"List",
"<",
"ProjectDefinition",
">",
"getTopDownParentProjects",
"(",
"ProjectDefinition",
"project",
")",
"{",
"List",
"<",
"ProjectDefinition",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"ProjectDefinition",
"p",
"=",
"project",
"... | From root to given project | [
"From",
"root",
"to",
"given",
"project"
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/ModuleConfigurationProvider.java#L60-L68 |
16,297 | SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel.java | PlatformLevel.addIfStartupLeader | AddIfStartupLeader addIfStartupLeader(Object... objects) {
if (addIfStartupLeader == null) {
this.addIfStartupLeader = new AddIfStartupLeader(getWebServer().isStartupLeader());
}
addIfStartupLeader.ifAdd(objects);
return addIfStartupLeader;
} | java | AddIfStartupLeader addIfStartupLeader(Object... objects) {
if (addIfStartupLeader == null) {
this.addIfStartupLeader = new AddIfStartupLeader(getWebServer().isStartupLeader());
}
addIfStartupLeader.ifAdd(objects);
return addIfStartupLeader;
} | [
"AddIfStartupLeader",
"addIfStartupLeader",
"(",
"Object",
"...",
"objects",
")",
"{",
"if",
"(",
"addIfStartupLeader",
"==",
"null",
")",
"{",
"this",
".",
"addIfStartupLeader",
"=",
"new",
"AddIfStartupLeader",
"(",
"getWebServer",
"(",
")",
".",
"isStartupLeade... | Add a component to container only if the web server is startup leader.
@throws IllegalStateException if called from PlatformLevel1, when cluster settings are not loaded | [
"Add",
"a",
"component",
"to",
"container",
"only",
"if",
"the",
"web",
"server",
"is",
"startup",
"leader",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel.java#L139-L145 |
16,298 | SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel.java | PlatformLevel.addIfCluster | AddIfCluster addIfCluster(Object... objects) {
if (addIfCluster == null) {
addIfCluster = new AddIfCluster(!getWebServer().isStandalone());
}
addIfCluster.ifAdd(objects);
return addIfCluster;
} | java | AddIfCluster addIfCluster(Object... objects) {
if (addIfCluster == null) {
addIfCluster = new AddIfCluster(!getWebServer().isStandalone());
}
addIfCluster.ifAdd(objects);
return addIfCluster;
} | [
"AddIfCluster",
"addIfCluster",
"(",
"Object",
"...",
"objects",
")",
"{",
"if",
"(",
"addIfCluster",
"==",
"null",
")",
"{",
"addIfCluster",
"=",
"new",
"AddIfCluster",
"(",
"!",
"getWebServer",
"(",
")",
".",
"isStandalone",
"(",
")",
")",
";",
"}",
"a... | Add a component to container only if clustering is enabled.
@throws IllegalStateException if called from PlatformLevel1, when cluster settings are not loaded | [
"Add",
"a",
"component",
"to",
"container",
"only",
"if",
"clustering",
"is",
"enabled",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel.java#L152-L158 |
16,299 | SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel.java | PlatformLevel.addIfStandalone | AddIfStandalone addIfStandalone(Object... objects) {
if (addIfStandalone == null) {
addIfStandalone = new AddIfStandalone(getWebServer().isStandalone());
}
addIfStandalone.ifAdd(objects);
return addIfStandalone;
} | java | AddIfStandalone addIfStandalone(Object... objects) {
if (addIfStandalone == null) {
addIfStandalone = new AddIfStandalone(getWebServer().isStandalone());
}
addIfStandalone.ifAdd(objects);
return addIfStandalone;
} | [
"AddIfStandalone",
"addIfStandalone",
"(",
"Object",
"...",
"objects",
")",
"{",
"if",
"(",
"addIfStandalone",
"==",
"null",
")",
"{",
"addIfStandalone",
"=",
"new",
"AddIfStandalone",
"(",
"getWebServer",
"(",
")",
".",
"isStandalone",
"(",
")",
")",
";",
"... | Add a component to container only if this is a standalone instance, without clustering.
@throws IllegalStateException if called from PlatformLevel1, when cluster settings are not loaded | [
"Add",
"a",
"component",
"to",
"container",
"only",
"if",
"this",
"is",
"a",
"standalone",
"instance",
"without",
"clustering",
"."
] | 2fffa4c2f79ae3714844d7742796e82822b6a98a | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel.java#L165-L171 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.