Skip to content

RC-352 Update ruling tests for the relocated sonar-server fixture - #6436

Draft
romainbrenguier wants to merge 1 commit into
masterfrom
romain/RC-352-move-sonar-server
Draft

romainbrenguier wants to merge 1 commit into
masterfrom
romain/RC-352-move-sonar-server

Conversation

@romainbrenguier

Copy link
Copy Markdown
Contributor

Summary

  • Update the its/sources submodule to the sonar-server fixture relocation in RC-352 Move sonar-server ruling project to the repository root ruling_java#18.
  • Point the SonarQube server ruling test at the top-level sonar-server fixture and use its new project key.
  • Move all 187 expected baselines to expected/sonar-server and update their project keys without changing expected issue locations.

Dependency

Merge SonarSource/ruling_java#18 first.

Validation

  • Verified all 187 baseline files preserve all 52,108 expected issue locations; only project keys changed.
  • Verified all 2,960 moved fixture files are unchanged except for the intended Maven parent lookup update.
  • git diff --cached --check passes.
  • Ruling integration tests are intentionally left to CI.

Part of RC-352

@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

RC-352

@github-actions

Copy link
Copy Markdown
Contributor

Ruling Diff Summary

Detected changes in 368 rule files: 52108 issues removed, 52108 issues added.

NoSonar (java) on sonar-server - 0 issues removed, 1 issues added - new ruling file

Added src/main/java/org/sonar/server/ui/PageDecorations.java (line 46)

        41 |   public PageDecorations() {
        42 |     this(Collections.emptyList());
        43 |   }
        44 | 
        45 |   public PageDecoration[] get() {
>>>     46 |     return decorations;// NOSONAR expose internal representation
        47 |   }
        48 | }
S103 (java) on sonar-server - 0 issues removed, 2003 issues added - new ruling file

Added src/main/java/org/sonar/ce/http/CeHttpClient.java (line 123)

       118 |       return null;
       119 |     }
       120 |   }
       121 | 
       122 |   private <T> T call(ActionClient<T> actionClient) {
>>>    123 |     try (DefaultProcessCommands commands = DefaultProcessCommands.secondary(ipcSharedDir, COMPUTE_ENGINE.getIpcIndex())) {
       124 |       if (commands.isUp()) {
       125 |         return actionClient.call(commands.getHttpUrl() + "/" + actionClient.getPath());
       126 |       }
       127 |       return actionClient.getDefault();
       128 |     } catch (Exception e) {

Added src/main/java/org/sonar/ce/log/CeProcessLogging.java (line 43)

        38 | 
        39 |   @Override
        40 |   protected void extendLogLevelConfiguration(LogLevelConfig.Builder logLevelConfigBuilder) {
        41 |     logLevelConfigBuilder.levelByDomain("sql", ProcessId.COMPUTE_ENGINE, LogDomain.SQL);
        42 |     logLevelConfigBuilder.levelByDomain("es", ProcessId.COMPUTE_ENGINE, LogDomain.ES);
>>>     43 |     JMX_RMI_LOGGER_NAMES.forEach(loggerName -> logLevelConfigBuilder.levelByDomain(loggerName, ProcessId.COMPUTE_ENGINE, LogDomain.JMX));
        44 |     MSQDRIVER_LOGGER_NAMES_TO_TURN_OFF.forEach(loggerName -> logLevelConfigBuilder.immutableLevel(loggerName, Level.OFF));
        45 |   }
        46 | 
        47 |   @Override
        48 |   protected void extendConfigure() {

Added src/main/java/org/sonar/ce/log/CeProcessLogging.java (line 44)

        39 |   @Override
        40 |   protected void extendLogLevelConfiguration(LogLevelConfig.Builder logLevelConfigBuilder) {
        41 |     logLevelConfigBuilder.levelByDomain("sql", ProcessId.COMPUTE_ENGINE, LogDomain.SQL);
        42 |     logLevelConfigBuilder.levelByDomain("es", ProcessId.COMPUTE_ENGINE, LogDomain.ES);
        43 |     JMX_RMI_LOGGER_NAMES.forEach(loggerName -> logLevelConfigBuilder.levelByDomain(loggerName, ProcessId.COMPUTE_ENGINE, LogDomain.JMX));
>>>     44 |     MSQDRIVER_LOGGER_NAMES_TO_TURN_OFF.forEach(loggerName -> logLevelConfigBuilder.immutableLevel(loggerName, Level.OFF));
        45 |   }
        46 | 
        47 |   @Override
        48 |   protected void extendConfigure() {
        49 |     // nothing to do

Added src/main/java/org/sonar/ce/queue/CeQueueImpl.java (line 58)

        53 |   private final DefaultOrganizationProvider defaultOrganizationProvider;
        54 | 
        55 |   // state
        56 |   private AtomicBoolean submitPaused = new AtomicBoolean(false);
        57 | 
>>>     58 |   public CeQueueImpl(DbClient dbClient, UuidFactory uuidFactory, DefaultOrganizationProvider defaultOrganizationProvider) {
        59 |     this.dbClient = dbClient;
        60 |     this.uuidFactory = uuidFactory;
        61 |     this.defaultOrganizationProvider = defaultOrganizationProvider;
        62 |   }
        63 | 

Added src/main/java/org/sonar/ce/queue/CeQueueImpl.java (line 102)

        97 | 
        98 |   protected CeTask loadTask(DbSession dbSession, CeQueueDto dto) {
        99 |     if (dto.getComponentUuid() == null) {
       100 |       return new CeQueueDtoToCeTask(defaultOrganizationProvider.get().getUuid()).apply(dto);
       101 |     }
>>>    102 |     com.google.common.base.Optional<ComponentDto> componentDto = dbClient.componentDao().selectByUuid(dbSession, dto.getComponentUuid());
       103 |     if (componentDto.isPresent()) {
       104 |       return new CeQueueDtoToCeTask(defaultOrganizationProvider.get().getUuid(), ImmutableMap.of(dto.getComponentUuid(), componentDto.get())).apply(dto);
       105 |     }
       106 |     return new CeQueueDtoToCeTask(defaultOrganizationProvider.get().getUuid()).apply(dto);
       107 |   }

Added src/main/java/org/sonar/ce/queue/CeQueueImpl.java (line 104)

        99 |     if (dto.getComponentUuid() == null) {
       100 |       return new CeQueueDtoToCeTask(defaultOrganizationProvider.get().getUuid()).apply(dto);
       101 |     }
       102 |     com.google.common.base.Optional<ComponentDto> componentDto = dbClient.componentDao().selectByUuid(dbSession, dto.getComponentUuid());
       103 |     if (componentDto.isPresent()) {
>>>    104 |       return new CeQueueDtoToCeTask(defaultOrganizationProvider.get().getUuid(), ImmutableMap.of(dto.getComponentUuid(), componentDto.get())).apply(dto);
       105 |     }
       106 |     return new CeQueueDtoToCeTask(defaultOrganizationProvider.get().getUuid()).apply(dto);
       107 |   }
       108 | 
       109 |   private List<CeTask> loadTasks(DbSession dbSession, List<CeQueueDto> dtos) {

Added src/main/java/org/sonar/ce/queue/CeTask.java (line 42)

        37 |   private final String componentKey;
        38 |   private final String componentName;
        39 |   private final String submitterLogin;
        40 | 
        41 |   private CeTask(Builder builder) {
>>>     42 |     this.organizationUuid = requireNonNull(emptyToNull(builder.organizationUuid), "organizationUuid can't be null nor empty");
        43 |     this.uuid = requireNonNull(emptyToNull(builder.uuid), "uuid can't be null nor empty");
        44 |     this.type = requireNonNull(emptyToNull(builder.type), "type can't be null nor empty");
        45 |     this.componentUuid = emptyToNull(builder.componentUuid);
        46 |     this.componentKey = emptyToNull(builder.componentKey);
        47 |     this.componentName = emptyToNull(builder.componentName);

Added src/main/java/org/sonar/ce/taskprocessor/CeTaskProcessor.java (line 52)

        47 |    */
        48 |   Set<String> getHandledCeTaskTypes();
        49 | 
        50 |   /**
        51 |    * Calls the processing code for a specific {@link CeTask} which will optionally return a {@link CeTaskResult}
>>>     52 |    * holding information to be persisted in the processing history of the Compute Engine (currently the {@code CE_ACTIVITY} table).
        53 |    * <p>
        54 |    * The specified is guaranteed to be non {@code null} and its {@link CeTask#getType()} to be one of the values
        55 |    * of {@link #getHandledCeTaskTypes()}.
        56 |    * </p>
        57 |    *

Added src/main/java/org/sonar/server/app/ProcessCommandWrapperImpl.java (line 89)

        84 |     };
        85 |     abstract <T> T callOn(ProcessCommands processCommands);
        86 |   }
        87 | 
        88 |   private int nonNullAsInt(String key) {
>>>     89 |     return config.getInt(key).orElseThrow(() -> new IllegalArgumentException(String.format("Property %s is not set", key)));
        90 |   }
        91 | 
        92 |   private File nonNullValueAsFile(String key) {
        93 |     return new File(config.get(key).orElseThrow(() -> new IllegalArgumentException(String.format("Property %s is not set", key))));
        94 |   }

Added src/main/java/org/sonar/server/app/ProcessCommandWrapperImpl.java (line 93)

        88 |   private int nonNullAsInt(String key) {
        89 |     return config.getInt(key).orElseThrow(() -> new IllegalArgumentException(String.format("Property %s is not set", key)));
        90 |   }
        91 | 
        92 |   private File nonNullValueAsFile(String key) {
>>>     93 |     return new File(config.get(key).orElseThrow(() -> new IllegalArgumentException(String.format("Property %s is not set", key))));
        94 |   }
        95 | }

Added src/main/java/org/sonar/server/app/TomcatAccessLog.java (line 36)

        31 | 
        32 | class TomcatAccessLog {
        33 | 
        34 |   private static final String PROPERTY_ENABLE = "sonar.web.accessLogs.enable";
        35 |   private static final String PROPERTY_PATTERN = "sonar.web.accessLogs.pattern";
>>>     36 |   private static final String DEFAULT_SQ_ACCESS_LOG_PATTERN = "%h %l %u [%t] \"%r\" %s %b \"%i{Referer}\" \"%i{User-Agent}\" \"%reqAttribute{ID}\"";
        37 | 
        38 |   void configure(Tomcat tomcat, Props props) {
        39 |     tomcat.setSilent(true);
        40 |     tomcat.getService().addLifecycleListener(new LifecycleLogger(Loggers.get(TomcatAccessLog.class)));
        41 |     configureLogbackAccess(tomcat, props);

Added src/main/java/org/sonar/server/app/TomcatConnectors.java (line 84)

        79 |   }
        80 | 
        81 |   private static void configureCompression(Connector connector) {
        82 |     connector.setProperty("compression", "on");
        83 |     connector.setProperty("compressionMinSize", "1024");
>>>     84 |     connector.setProperty("compressableMimeType", "text/html,text/xml,text/plain,text/css,application/json,application/javascript");
        85 |   }
        86 | 
        87 |   private static void setConnectorAttribute(Connector c, String key, @Nullable Object value) {
        88 |     if (value != null) {
        89 |       c.setAttribute(key, value);

Added src/main/java/org/sonar/server/app/TomcatContexts.java (line 60)

        55 |   TomcatContexts(Fs fs) {
        56 |     this.fs = fs;
        57 |   }
        58 | 
        59 |   public StandardContext configure(Tomcat tomcat, Props props) {
>>>     60 |     addStaticDir(tomcat, getContextPath(props) + "/deploy", new File(props.nonNullValueAsFile(ProcessProperties.PATH_DATA), WEB_DEPLOY_PATH_RELATIVE_TO_DATA_DIR));
        61 | 
        62 |     StandardContext webapp = addContext(tomcat, getContextPath(props), webappDir(props));
        63 |     for (Map.Entry<Object, Object> entry : props.rawProperties().entrySet()) {
        64 |       String key = entry.getKey().toString();
        65 |       webapp.addParameter(key, entry.getValue().toString());

Added src/main/java/org/sonar/server/app/TomcatContexts.java (line 75)

        70 |   static String getContextPath(Props props) {
        71 |     String context = props.value(PROPERTY_CONTEXT, "");
        72 |     if ("/".equals(context)) {
        73 |       context = "";
        74 |     } else if (!"".equals(context) && context != null && !context.startsWith("/")) {
>>>     75 |       throw MessageException.of(format("Value of '%s' must start with a forward slash: '%s'", PROPERTY_CONTEXT, context));
        76 |     }
        77 |     return context;
        78 |   }
        79 | 
        80 |   @VisibleForTesting

Added src/main/java/org/sonar/server/app/TomcatContexts.java (line 110)

       105 |       context.setDelegate(true);
       106 |       context.setJarScanner(new NullJarScanner());
       107 |       context.setAllowCasualMultipartParsing(true);
       108 |       context.setCookies(false);
       109 |       // disable JSP and WebSocket support
>>>    110 |       context.setContainerSciFilter("org.apache.tomcat.websocket.server.WsSci|org.apache.jasper.servlet.JasperInitializer");
       111 |       return context;
       112 |     } catch (ServletException e) {
       113 |       throw new IllegalStateException("Fail to configure webapp from " + dir, e);
       114 |     }
       115 |   }
S1066 (java) on sonar-server - 0 issues removed, 1 issues added - new ruling file

Added src/main/java/org/sonar/server/source/HtmlTextDecorator.java (line 97)

        92 |     return decoratedHtmlLines;
        93 |   }
        94 | 
        95 |   private void addCharToCurrentLine(CharactersReader charsReader, StringBuilder currentHtmlLine, DecorationDataHolder decorationDataHolder) {
        96 |     if (shouldStartNewLine(charsReader)) {
>>>     97 |       if (shouldReopenPendingTags(charsReader)) {
        98 |         reopenCurrentSyntaxTags(charsReader, currentHtmlLine);
        99 |       }
       100 |     }
       101 | 
       102 |     int numberOfTagsToClose = getNumberOfTagsToClose(charsReader.getCurrentIndex(), decorationDataHolder);
S1067 (java) on sonar-server - 0 issues removed, 6 issues added - new ruling file

Added src/main/java/org/sonar/server/computation/task/projectanalysis/measure/BestValueOptimization.java (line 60)

        55 |   public boolean apply(@Nonnull Measure measure) {
        56 |     return isBestValueOptimized(measure);
        57 |   }
        58 | 
        59 |   private boolean isBestValueOptimized(Measure measure) {
>>>     60 |     return measure.getData() == null
        61 |       && !measure.hasQualityGateStatus()
        62 |       && hasNoVariation(measure, metric.getBestValue())
        63 |       && (measure.getValueType() == NO_VALUE || isBestValue(measure, metric.getBestValue()));
        64 |   }
        65 | 

Added src/main/java/org/sonar/server/computation/task/projectanalysis/step/PersistComponentsStep.java (line 409)

       404 |     componentDto.setModuleUuidPath(parentModule.moduleUuidPath());
       405 | 
       406 |   }
       407 | 
       408 |   private static Optional<ComponentUpdateDto> compareForUpdate(ComponentDto existing, ComponentDto target) {
>>>    409 |     boolean hasDifferences = !StringUtils.equals(existing.getCopyResourceUuid(), target.getCopyResourceUuid()) ||
       410 |       !StringUtils.equals(existing.description(), target.description()) ||
       411 |       !existing.isEnabled() ||
       412 |       !StringUtils.equals(existing.getUuidPath(), target.getUuidPath()) ||
       413 |       !StringUtils.equals(existing.language(), target.language()) ||
       414 |       !StringUtils.equals(existing.longName(), target.longName()) ||

Added src/main/java/org/sonar/server/rule/RuleUpdate.java (line 222)

       217 |   public boolean isEmpty() {
       218 |     return !changeMarkdownNote && !changeTags && !changeDebtRemediationFunction && isCustomRuleFieldsEmpty();
       219 |   }
       220 | 
       221 |   private boolean isCustomRuleFieldsEmpty() {
>>>    222 |     return !changeName && !changeDescription && !changeSeverity && !changeStatus && !changeParameters;
       223 |   }
       224 | 
       225 |   private void checkCustomRule() {
       226 |     if (useCase != CUSTOM_RULE) {
       227 |       throw new IllegalStateException("Not a custom rule");

Added src/main/java/org/sonar/server/source/HtmlTextDecorator.java (line 170)

       165 |     }
       166 |     return tagsToOpen;
       167 |   }
       168 | 
       169 |   private boolean shouldClosePendingTags(CharactersReader charactersReader) {
>>>    170 |     return charactersReader.getCurrentValue() == CR_END_OF_LINE
       171 |       || (charactersReader.getCurrentValue() == LF_END_OF_LINE && charactersReader.getPreviousValue() != CR_END_OF_LINE)
       172 |       || (charactersReader.getCurrentValue() == CharactersReader.END_OF_STREAM && charactersReader.getPreviousValue() != LF_END_OF_LINE);
       173 |   }
       174 | 
       175 |   private boolean shouldReopenPendingTags(CharactersReader charactersReader) {

Added src/main/java/org/sonar/server/source/HtmlTextDecorator.java (line 176)

       171 |       || (charactersReader.getCurrentValue() == LF_END_OF_LINE && charactersReader.getPreviousValue() != CR_END_OF_LINE)
       172 |       || (charactersReader.getCurrentValue() == CharactersReader.END_OF_STREAM && charactersReader.getPreviousValue() != LF_END_OF_LINE);
       173 |   }
       174 | 
       175 |   private boolean shouldReopenPendingTags(CharactersReader charactersReader) {
>>>    176 |     return (charactersReader.getPreviousValue() == LF_END_OF_LINE && charactersReader.getCurrentValue() != LF_END_OF_LINE)
       177 |       || (charactersReader.getPreviousValue() == CR_END_OF_LINE && charactersReader.getCurrentValue() != CR_END_OF_LINE
       178 |         && charactersReader.getCurrentValue() != LF_END_OF_LINE);
       179 |   }
       180 | 
       181 |   private boolean shouldStartNewLine(CharactersReader charactersReader) {

Added src/main/java/org/sonar/server/user/UserUpdater.java (line 251)

       246 |     }
       247 |     return false;
       248 |   }
       249 | 
       250 |   private static boolean isSameExternalIdentity(UserDto dto, @Nullable ExternalIdentity externalIdentity) {
>>>    251 |     return (externalIdentity == null && dto.getExternalIdentity() == null) ||
       252 |       (externalIdentity != null
       253 |         && Objects.equals(dto.getExternalIdentity(), externalIdentity.getId())
       254 |         && Objects.equals(dto.getExternalIdentityProvider(), externalIdentity.getProvider()));
       255 |   }
       256 | 
S1068 (java) on sonar-server - 0 issues removed, 7 issues added - new ruling file

Added src/test/java/org/sonar/server/computation/task/projectanalysis/measure/MapBasedRawMeasureRepositoryTest.java (line 80)

        75 |   private final Metric metric1 = mock(Metric.class);
        76 |   private final Metric metric2 = mock(Metric.class);
        77 | 
        78 |   private static final Measure SOME_MEASURE = Measure.newMeasureBuilder().create("some value");
        79 | 
>>>     80 |   private static final RuleDto SOME_RULE = RuleDto.createFor(RuleKey.of("A", "1")).setId(963);
        81 |   private static final Developer SOME_DEVELOPER = new DumbDeveloper("DEV1");
        82 | 
        83 |   private ReportMetricValidator reportMetricValidator = mock(ReportMetricValidator.class);
        84 | 
        85 |   private MetricRepository metricRepository = mock(MetricRepository.class);

Added src/test/java/org/sonar/server/issue/IssueServiceMediumTest.java (line 70)

        65 | 
        66 |   private DbClient db = tester.get(DbClient.class);
        67 |   private IssueIndex issueIndex;
        68 |   private DbSession session;
        69 |   private IssueService service;
>>>     70 |   private RuleIndexer ruleIndexer;
        71 | 
        72 |   @Before
        73 |   public void setUp() {
        74 |     tester.clearDbAndIndexes();
        75 |     issueIndex = tester.get(IssueIndex.class);

Added src/test/java/org/sonar/server/qualityprofile/QProfileExportersTest.java (line 79)

        74 |   private ProfileExporter[] exporters = new ProfileExporter[] {
        75 |     new StandardExporter(), new XooExporter()};
        76 |   private ProfileImporter[] importers = new ProfileImporter[] {
        77 |     new XooProfileImporter(), new XooProfileImporterWithMessages(), new XooProfileImporterWithError()};
        78 |   private RuleDefinitionDto rule;
>>>     79 |   private RuleParamDto ruleParam;
        80 |   private QProfileExporters underTest = new QProfileExporters(db.getDbClient(), ruleFinder, ruleActivator, exporters, importers);
        81 | 
        82 |   @Before
        83 |   public void setUp() {
        84 |     rule = db.rules().insert(r -> r.setLanguage("xoo").setRepositoryKey("SonarXoo").setRuleKey("R1"));

Added src/test/java/org/sonar/server/rule/RuleUpdaterTest.java (line 85)

        80 |   public EsTester es = new EsTester(new RuleIndexDefinition(new MapSettings().asConfig()));
        81 | 
        82 |   private RuleIndex ruleIndex = new RuleIndex(es.client());
        83 |   private RuleIndexer ruleIndexer = new RuleIndexer(es.client(), db.getDbClient());
        84 |   private DbSession dbSession = db.getSession();
>>>     85 |   private TestDefaultOrganizationProvider defaultOrganizationProvider = TestDefaultOrganizationProvider.from(db);
        86 | 
        87 |   private RuleUpdater underTest = new RuleUpdater(db.getDbClient(), ruleIndexer, system2);
        88 | 
        89 |   @Test
        90 |   public void do_not_update_rule_with_removed_status() {

Added src/test/java/org/sonar/server/rule/ws/UpdateActionTest.java (line 101)

        96 |   private DefaultOrganizationProvider defaultOrganizationProvider = TestDefaultOrganizationProvider.from(db);
        97 |   private Languages languages = new Languages();
        98 |   private RuleMapper mapper = new RuleMapper(languages, createMacroInterpreter());
        99 |   private RuleIndexer ruleIndexer = new RuleIndexer(esClient, dbClient);
       100 |   private RuleUpdater ruleUpdater = new RuleUpdater(dbClient, ruleIndexer, System2.INSTANCE);
>>>    101 |   private RuleWsSupport ruleWsSupport = new RuleWsSupport(dbClient, userSession, defaultOrganizationProvider);
       102 |   private WsAction underTest = new UpdateAction(dbClient, ruleUpdater, mapper, userSession, defaultOrganizationProvider);
       103 |   private WsActionTester ws = new WsActionTester(underTest);
       104 | 
       105 |   @Test
       106 |   public void update_custom_rule() throws Exception {

Added src/test/java/org/sonar/server/user/index/UserIndexTest.java (line 42)

        37 | 
        38 | public class UserIndexTest {
        39 | 
        40 |   private static final String USER1_LOGIN = "user1";
        41 |   private static final String USER2_LOGIN = "user2";
>>>     42 |   private static final long DATE_1 = 1_500_000_000_000L;
        43 |   private static final long DATE_2 = 1_500_000_000_001L;
        44 | 
        45 |   @Rule
        46 |   public EsTester esTester = new EsTester(new UserIndexDefinition(new MapSettings().asConfig()));
        47 | 

Added src/test/java/org/sonar/server/user/index/UserIndexTest.java (line 43)

        38 | public class UserIndexTest {
        39 | 
        40 |   private static final String USER1_LOGIN = "user1";
        41 |   private static final String USER2_LOGIN = "user2";
        42 |   private static final long DATE_1 = 1_500_000_000_000L;
>>>     43 |   private static final long DATE_2 = 1_500_000_000_001L;
        44 | 
        45 |   @Rule
        46 |   public EsTester esTester = new EsTester(new UserIndexDefinition(new MapSettings().asConfig()));
        47 | 
        48 |   private UserIndex underTest;
S107 (java) on sonar-server - 0 issues removed, 10 issues added - new ruling file

Added src/main/java/org/sonar/server/issue/IssueQueryFactory.java (line 205)

       200 |       }
       201 |     }
       202 |     return assignees;
       203 |   }
       204 | 
>>>    205 |   private boolean mergeDeprecatedComponentParameters(DbSession session, @Nullable Boolean onComponentOnly,
       206 |     @Nullable Collection<String> components,
       207 |     @Nullable Collection<String> componentUuids,
       208 |     @Nullable Collection<String> componentKeys,
       209 |     @Nullable Collection<String> componentRootUuids,
       210 |     @Nullable Collection<String> componentRoots,

Added src/main/java/org/sonar/server/issue/IssueQueryFactory.java (line 243)

       238 |     return Arrays.stream(objects)
       239 |       .filter(Objects::nonNull)
       240 |       .count() <= 1;
       241 |   }
       242 | 
>>>    243 |   private void addComponentParameters(IssueQuery.Builder builder, DbSession session,
       244 |     boolean onComponentOnly,
       245 |     Collection<String> componentUuids,
       246 |     @Nullable Collection<String> projectUuids, @Nullable Collection<String> projectKeys,
       247 |     @Nullable Collection<String> moduleUuids,
       248 |     @Nullable Collection<String> directories,

Added src/main/java/org/sonar/server/measure/custom/ws/SearchAction.java (line 128)

       123 | 
       124 |   private List<CustomMeasureDto> searchCustomMeasures(DbSession dbSession, ComponentDto project, SearchOptions searchOptions) {
       125 |     return dbClient.customMeasureDao().selectByComponentUuid(dbSession, project.uuid(), searchOptions.getOffset(), searchOptions.getLimit());
       126 |   }
       127 | 
>>>    128 |   private void writeResponse(Response response, List<CustomMeasureDto> customMeasures, int nbCustomMeasures, ComponentDto project, Map<Integer, MetricDto> metricsById,
       129 |     Map<String, UserDto> usersByLogin, @Nullable Long lastAnalysisDate, SearchOptions searchOptions, List<String> fieldsToReturn) {
       130 |     JsonWriter json = response.newJsonWriter();
       131 |     json.beginObject();
       132 |     customMeasureJsonWriter.write(json, customMeasures, project, metricsById, usersByLogin, lastAnalysisDate, fieldsToReturn);
       133 |     searchOptions.writeJson(json, nbCustomMeasures);

Added src/main/java/org/sonar/server/organization/OrganizationCreationImpl.java (line 76)

        71 |   private final Configuration config;
        72 |   private final BuiltInQProfileRepository builtInQProfileRepository;
        73 |   private final DefaultGroupCreator defaultGroupCreator;
        74 |   private final UserIndexer userIndexer;
        75 | 
>>>     76 |   public OrganizationCreationImpl(DbClient dbClient, System2 system2, UuidFactory uuidFactory,
        77 |     OrganizationValidation organizationValidation, Configuration config, UserIndexer userIndexer,
        78 |     BuiltInQProfileRepository builtInQProfileRepository,
        79 |     DefaultGroupCreator defaultGroupCreator) {
        80 |     this.dbClient = dbClient;
        81 |     this.system2 = system2;

Added src/main/java/org/sonar/server/qualityprofile/ws/ChangelogLoader.java (line 100)

        95 | 
        96 |     private Change() {
        97 |     }
        98 | 
        99 |     @VisibleForTesting
>>>    100 |     Change(String key, String type, long at, @Nullable String severity, @Nullable String userLogin,
       101 |       @Nullable String userName, @Nullable String inheritance, @Nullable RuleKey ruleKey, @Nullable String ruleName) {
       102 |       this.key = key;
       103 |       this.type = type;
       104 |       this.at = at;
       105 |       this.severity = severity;

Added src/main/java/org/sonar/server/qualityprofile/ws/CreateAction.java (line 64)

        59 |   private final ProfileImporter[] importers;
        60 |   private final QProfileWsSupport qProfileWsSupport;
        61 |   private final UserSession userSession;
        62 |   private final ActiveRuleIndexer activeRuleIndexer;
        63 | 
>>>     64 |   public CreateAction(DbClient dbClient, QProfileFactory profileFactory, QProfileExporters exporters, Languages languages,
        65 |     QProfileWsSupport qProfileWsSupport, UserSession userSession, ActiveRuleIndexer activeRuleIndexer, ProfileImporter... importers) {
        66 |     this.dbClient = dbClient;
        67 |     this.profileFactory = profileFactory;
        68 |     this.exporters = exporters;
        69 |     this.languages = languages;

Added src/main/java/org/sonar/server/rule/RegisterRules.java (line 82)

        77 |   private final Languages languages;
        78 |   private final System2 system2;
        79 |   private final OrganizationFlags organizationFlags;
        80 |   private final WebServerRuleFinder webServerRuleFinder;
        81 | 
>>>     82 |   public RegisterRules(RuleDefinitionsLoader defLoader, RuleActivator ruleActivator, DbClient dbClient, RuleIndexer ruleIndexer,
        83 |     ActiveRuleIndexer activeRuleIndexer, Languages languages, System2 system2, OrganizationFlags organizationFlags,
        84 |     WebServerRuleFinder webServerRuleFinder) {
        85 |     this.defLoader = defLoader;
        86 |     this.ruleActivator = ruleActivator;
        87 |     this.dbClient = dbClient;

Added src/main/java/org/sonar/server/test/ws/ListAction.java (line 196)

       191 |     List<ComponentDto> components = dbClient.componentDao().selectByUuids(dbSession, fileUuids);
       192 | 
       193 |     return Maps.uniqueIndex(components, ComponentDto::uuid);
       194 |   }
       195 | 
>>>    196 |   private SearchResult<TestDoc> searchTests(DbSession dbSession, @Nullable String testUuid, @Nullable String testFileUuid, @Nullable String testFileKey,
       197 |     @Nullable String sourceFileUuid, @Nullable String sourceFileKey, @Nullable Integer sourceFileLineNumber, SearchOptions searchOptions) {
       198 |     if (testUuid != null) {
       199 |       return searchTestsByTestUuid(dbSession, testUuid, searchOptions);
       200 |     }
       201 |     if (testFileUuid != null) {

Added src/main/java/org/sonar/server/ui/ws/GlobalAction.java (line 69)

        64 |   private final DbClient dbClient;
        65 |   private final OrganizationFlags organizationFlags;
        66 |   private final DefaultOrganizationProvider defaultOrganizationProvider;
        67 |   private final UserSession userSession;
        68 | 
>>>     69 |   public GlobalAction(PageRepository pageRepository, Configuration config, ResourceTypes resourceTypes, Server server,
        70 |     DbClient dbClient, OrganizationFlags organizationFlags, DefaultOrganizationProvider defaultOrganizationProvider, UserSession userSession) {
        71 |     this.pageRepository = pageRepository;
        72 |     this.config = config;
        73 |     this.resourceTypes = resourceTypes;
        74 |     this.server = server;

Added src/main/java/org/sonar/server/user/UserUpdater.java (line 83)

        78 |   private final DefaultOrganizationProvider defaultOrganizationProvider;
        79 |   private final OrganizationCreation organizationCreation;
        80 |   private final DefaultGroupFinder defaultGroupFinder;
        81 |   private final Configuration config;
        82 | 
>>>     83 |   public UserUpdater(NewUserNotifier newUserNotifier, DbClient dbClient, UserIndexer userIndexer, OrganizationFlags organizationFlags,
        84 |     DefaultOrganizationProvider defaultOrganizationProvider, OrganizationCreation organizationCreation, DefaultGroupFinder defaultGroupFinder, Configuration config) {
        85 |     this.newUserNotifier = newUserNotifier;
        86 |     this.dbClient = dbClient;
        87 |     this.userIndexer = userIndexer;
        88 |     this.organizationFlags = organizationFlags;
S1075 (java) on sonar-server - 0 issues removed, 1 issues added - new ruling file

Added src/main/java/org/sonar/server/authentication/AuthenticationFilter.java (line 34)

        29 | import static com.google.common.base.Strings.isNullOrEmpty;
        30 | import static java.lang.String.format;
        31 | import static org.sonar.server.authentication.AuthenticationError.handleError;
        32 | 
        33 | public abstract class AuthenticationFilter extends ServletFilter {
>>>     34 |   static final String CALLBACK_PATH = "/oauth2/callback/";
        35 |   private final IdentityProviderRepository identityProviderRepository;
        36 |   private final Server server;
        37 | 
        38 |   public AuthenticationFilter(Server server, IdentityProviderRepository identityProviderRepository) {
        39 |     this.server = server;
S108 (java) on sonar-server - 0 issues removed, 3 issues added - new ruling file

Added src/test/java/org/sonar/server/computation/task/projectanalysis/issue/ScmAccountToUserLoaderTest.java (line 92)

        87 |     UserIndex index = new UserIndex(esTester.client());
        88 |     ScmAccountToUserLoader underTest = new ScmAccountToUserLoader(index);
        89 |     try {
        90 |       underTest.loadAll(Collections.<String>emptyList());
        91 |       fail();
>>>     92 |     } catch (UnsupportedOperationException ignored) {
        93 |     }
        94 |   }
        95 | }

Added src/test/java/org/sonar/server/util/ObjectInputStreamIteratorTest.java (line 52)

        47 |     assertThat(it.next().value).isEqualTo("second");
        48 |     assertThat(it.next().value).isEqualTo("third");
        49 |     try {
        50 |       it.next();
        51 |       fail();
>>>     52 |     } catch (NoSuchElementException expected) {
        53 | 
        54 |     }
        55 |   }
        56 | 
        57 |   @Test

Added src/test/java/org/sonar/server/util/ObjectInputStreamIteratorTest.java (line 71)

        66 |     ObjectInputStreamIterator<SimpleSerializable> it = new ObjectInputStreamIterator<>(new ByteArrayInputStream(bytesOutput.toByteArray()));
        67 |     assertThat(it.next().value).isEqualTo("first");
        68 |     try {
        69 |       it.next();
        70 |       fail();
>>>     71 |     } catch (RuntimeException expected) {
        72 | 
        73 |     }
        74 |   }
        75 | 
        76 |   static class SimpleSerializable implements Serializable {
S109 (java) on sonar-server - 0 issues removed, 205 issues added - new ruling file

Added src/main/java/org/sonar/ce/http/CeHttpClient.java (line 110)

       105 |       okhttp3.Request request = new okhttp3.Request.Builder()
       106 |         .post(RequestBody.create(null, new byte[0]))
       107 |         .url(url + "?level=" + newLogLevel.name())
       108 |         .build();
       109 |       okhttp3.Response response = new OkHttpClient().newCall(request).execute();
>>>    110 |       if (response.code() != 200) {
       111 |         throw new IOException(
       112 |           String.format(
       113 |             "Failed to change log level in Compute Engine. Code was '%s' and response was '%s' for url '%s'",
       114 |             response.code(),
       115 |             response.body().string(),

Added src/main/java/org/sonar/server/app/TomcatConnectors.java (line 49)

        44 |     tomcat.getService().addConnector(httpConnector);
        45 |   }
        46 | 
        47 |   private static Connector newHttpConnector(Props props) {
        48 |     // Not named "sonar.web.http.port" to keep backward-compatibility
>>>     49 |     int port = props.valueAsInt("sonar.web.port", 9000);
        50 |     if (port < 0) {
        51 |       throw new IllegalStateException(format("HTTP port '%s' is invalid", port));
        52 |     }
        53 | 
        54 |     Connector connector = new Connector(HTTP_PROTOCOL);

Added src/main/java/org/sonar/server/app/TomcatConnectors.java (line 75)

        70 |   private static void configureMaxHttpHeaderSize(Connector connector) {
        71 |     setConnectorAttribute(connector, "maxHttpHeaderSize", MAX_HTTP_HEADER_SIZE_BYTES);
        72 |   }
        73 | 
        74 |   private static void configurePool(Props props, Connector connector) {
>>>     75 |     connector.setProperty("acceptorThreadCount", String.valueOf(2));
        76 |     connector.setProperty("minSpareThreads", String.valueOf(props.valueAsInt("sonar.web.http.minThreads", 5)));
        77 |     connector.setProperty("maxThreads", String.valueOf(props.valueAsInt("sonar.web.http.maxThreads", 50)));
        78 |     connector.setProperty("acceptCount", String.valueOf(props.valueAsInt("sonar.web.http.acceptCount", 25)));
        79 |   }
        80 | 

Added src/main/java/org/sonar/server/app/TomcatConnectors.java (line 76)

        71 |     setConnectorAttribute(connector, "maxHttpHeaderSize", MAX_HTTP_HEADER_SIZE_BYTES);
        72 |   }
        73 | 
        74 |   private static void configurePool(Props props, Connector connector) {
        75 |     connector.setProperty("acceptorThreadCount", String.valueOf(2));
>>>     76 |     connector.setProperty("minSpareThreads", String.valueOf(props.valueAsInt("sonar.web.http.minThreads", 5)));
        77 |     connector.setProperty("maxThreads", String.valueOf(props.valueAsInt("sonar.web.http.maxThreads", 50)));
        78 |     connector.setProperty("acceptCount", String.valueOf(props.valueAsInt("sonar.web.http.acceptCount", 25)));
        79 |   }
        80 | 
        81 |   private static void configureCompression(Connector connector) {

Added src/main/java/org/sonar/server/authentication/BasicAuthenticator.java (line 72)

        67 |     UserDto userDto = authenticate(login, password, request);
        68 |     return Optional.of(userDto);
        69 |   }
        70 | 
        71 |   private static String[] getCredentials(String authorizationHeader) {
>>>     72 |     String basicAuthEncoded = authorizationHeader.substring(6);
        73 |     String basicAuthDecoded = getDecodedBasicAuth(basicAuthEncoded);
        74 | 
        75 |     int semiColonPos = basicAuthDecoded.indexOf(':');
        76 |     if (semiColonPos <= 0) {
        77 |       throw AuthenticationException.newBuilder()

Added src/main/java/org/sonar/server/authentication/JwtCsrfVerifier.java (line 49)

        44 |   private static final String API_URL = "/api";
        45 | 
        46 |   public String generateState(HttpServletRequest request, HttpServletResponse response, int timeoutInSeconds) {
        47 |     // Create a state token to prevent request forgery.
        48 |     // Store it in the cookie for later validation.
>>>     49 |     String state = new BigInteger(130, new SecureRandom()).toString(32);
        50 |     response.addCookie(newCookieBuilder(request).setName(CSRF_STATE_COOKIE).setValue(state).setHttpOnly(false).setExpiry(timeoutInSeconds).build());
        51 |     return state;
        52 |   }
        53 | 
        54 |   public void verifyState(HttpServletRequest request, @Nullable String csrfState, @Nullable String login) {

Added src/main/java/org/sonar/server/authentication/JwtHttpHandler.java (line 184)

       179 |   private static int getSessionTimeoutInSeconds(Configuration config) {
       180 |     int minutes = config.getInt(SESSION_TIMEOUT_IN_MINUTES_PROPERTY).orElse(SESSION_TIMEOUT_DEFAULT_VALUE_IN_MINUTES);
       181 |     checkArgument(minutes > 0, "Property %s must be strictly positive. Got %s", SESSION_TIMEOUT_IN_MINUTES_PROPERTY, minutes);
       182 |     checkArgument(minutes <= MAX_SESSION_TIMEOUT_IN_MINUTES, "Property %s must not be greater than 3 months (%s minutes). Got %s minutes",
       183 |       SESSION_TIMEOUT_IN_MINUTES_PROPERTY, MAX_SESSION_TIMEOUT_IN_MINUTES, minutes);
>>>    184 |     return minutes * 60;
       185 |   }
       186 | 
       187 |   public static class Token {
       188 |     private final UserDto userDto;
       189 |     private final Map<String, Object> properties;

Added src/main/java/org/sonar/server/authentication/JwtSerializer.java (line 93)

        88 |     long now = system2.now();
        89 |     JwtBuilder jwtBuilder = Jwts.builder()
        90 |       .setId(uuidFactory.create())
        91 |       .setSubject(jwtSession.getUserLogin())
        92 |       .setIssuedAt(new Date(now))
>>>     93 |       .setExpiration(new Date(now + jwtSession.getExpirationTimeInSeconds() * 1000))
        94 |       .signWith(SIGNATURE_ALGORITHM, secretKey);
        95 |     for (Map.Entry<String, Object> entry : jwtSession.getProperties().entrySet()) {
        96 |       jwtBuilder.claim(entry.getKey(), entry.getValue());
        97 |     }
        98 |     return jwtBuilder.compact();

Added src/main/java/org/sonar/server/authentication/JwtSerializer.java (line 132)

       127 |     long now = system2.now();
       128 |     JwtBuilder jwtBuilder = Jwts.builder();
       129 |     for (Map.Entry<String, Object> entry : token.entrySet()) {
       130 |       jwtBuilder.claim(entry.getKey(), entry.getValue());
       131 |     }
>>>    132 |     jwtBuilder.setExpiration(new Date(now + expirationTimeInSeconds * 1000))
       133 |       .signWith(SIGNATURE_ALGORITHM, secretKey);
       134 |     return jwtBuilder.compact();
       135 |   }
       136 | 
       137 |   private static SecretKey generateSecretKey() {

Added src/main/java/org/sonar/server/authentication/OAuthCsrfVerifier.java (line 44)

        39 |   private static final String CSRF_STATE_COOKIE = "OAUTHSTATE";
        40 | 
        41 |   public String generateState(HttpServletRequest request, HttpServletResponse response) {
        42 |     // Create a state token to prevent request forgery.
        43 |     // Store it in the session for later validation.
>>>     44 |     String state = new BigInteger(130, new SecureRandom()).toString(32);
        45 |     response.addCookie(newCookieBuilder(request).setName(CSRF_STATE_COOKIE).setValue(sha256Hex(state)).setHttpOnly(true).setExpiry(-1).build());
        46 |     return state;
        47 |   }
        48 | 
        49 |   public void verifyState(HttpServletRequest request, HttpServletResponse response, OAuth2IdentityProvider provider) {

Added src/main/java/org/sonar/server/ce/ws/ActivityAction.java (line 150)

       145 |       .setExampleValue(DateUtils.formatDateTime(new Date()));
       146 |     action.createParam(Param.PAGE)
       147 |       .setDescription("Deprecated parameter")
       148 |       .setDeprecatedSince("5.5")
       149 |       .setDeprecatedKey("pageIndex", "5.4");
>>>    150 |     action.createPageSize(100, MAX_PAGE_SIZE);
       151 |   }
       152 | 
       153 |   @Override
       154 |   public void handle(Request wsRequest, Response wsResponse) throws Exception {
       155 |     ActivityResponse activityResponse = doHandle(toSearchWsRequest(wsRequest));

Added src/main/java/org/sonar/server/component/index/ComponentDoc.java (line 28)

        23 | import org.sonar.server.es.BaseDoc;
        24 | 
        25 | public class ComponentDoc extends BaseDoc {
        26 | 
        27 |   public ComponentDoc() {
>>>     28 |     super(new HashMap<>(5));
        29 |   }
        30 | 
        31 |   @Override
        32 |   public String getId() {
        33 |     return getField("_id");

Added src/main/java/org/sonar/server/component/index/ComponentIndexQuery.java (line 89)

        84 | 
        85 |     private Builder() {
        86 |     }
        87 | 
        88 |     public Builder setQuery(String query) {
>>>     89 |       checkArgument(query.length() >= 2, "Query must be at least two characters long: %s", query);
        90 |       this.query = query;
        91 |       return this;
        92 |     }
        93 | 
        94 |     public Builder setQualifiers(Collection<String> qualifiers) {

Added src/main/java/org/sonar/server/component/ws/FilterParser.java (line 81)

        76 |     if (!matcher.find()) {
        77 |       return null;
        78 |     }
        79 |     Criterion.Builder builder = new Criterion.Builder();
        80 |     builder.setKey(matcher.group(1));
>>>     81 |     String operatorValue = matcher.group(2);
        82 |     String value = matcher.group(3);
        83 |     if (!isNullOrEmpty(operatorValue) && !isNullOrEmpty(value)) {
        84 |       builder.setOperator(Operator.getByValue(operatorValue));
        85 |       builder.setValue(sanitizeValue(value));
        86 |     }

Added src/main/java/org/sonar/server/component/ws/FilterParser.java (line 82)

        77 |       return null;
        78 |     }
        79 |     Criterion.Builder builder = new Criterion.Builder();
        80 |     builder.setKey(matcher.group(1));
        81 |     String operatorValue = matcher.group(2);
>>>     82 |     String value = matcher.group(3);
        83 |     if (!isNullOrEmpty(operatorValue) && !isNullOrEmpty(value)) {
        84 |       builder.setOperator(Operator.getByValue(operatorValue));
        85 |       builder.setValue(sanitizeValue(value));
        86 |     }
        87 |     return builder.build();
S1104 (java) on sonar-server - 0 issues removed, 1 issues added - new ruling file

Added src/main/java/org/sonar/server/platform/web/MasterServletFilter.java (line 44)

        39 | /**
        40 |  * Inspired by http://stackoverflow.com/a/7592883/229031
        41 |  */
        42 | public class MasterServletFilter implements Filter {
        43 | 
>>>     44 |   public static volatile MasterServletFilter INSTANCE;
        45 |   private ServletFilter[] filters;
        46 |   private FilterConfig config;
        47 | 
        48 |   public MasterServletFilter() {
        49 |     if (INSTANCE != null) {
S1108 (java) on sonar-server - 0 issues removed, 598 issues added - new ruling file

Added src/main/java/org/sonar/ce/http/CeHttpClient.java (line 128)

       123 |     try (DefaultProcessCommands commands = DefaultProcessCommands.secondary(ipcSharedDir, COMPUTE_ENGINE.getIpcIndex())) {
       124 |       if (commands.isUp()) {
       125 |         return actionClient.call(commands.getHttpUrl() + "/" + actionClient.getPath());
       126 |       }
       127 |       return actionClient.getDefault();
>>>    128 |     } catch (Exception e) {
       129 |       throw new IllegalStateException("Failed to call HTTP server of process " + COMPUTE_ENGINE, e);
       130 |     }
       131 |   }
       132 | 
       133 |   private interface ActionClient<T> {

Added src/main/java/org/sonar/server/app/EmbeddedTomcat.java (line 63)

        58 |     TomcatConnectors.configure(tomcat, props);
        59 |     webappContext = new TomcatContexts().configure(tomcat, props);
        60 |     try {
        61 |       tomcat.start();
        62 |       new TomcatStartupLogs(Loggers.get(getClass())).log(tomcat);
>>>     63 |     } catch (LifecycleException e) {
        64 |       Throwables.propagate(e);
        65 |     }
        66 |   }
        67 | 
        68 |   Status getStatus() {

Added src/main/java/org/sonar/server/app/EmbeddedTomcat.java (line 100)

        95 |   void terminate() {
        96 |     if (tomcat.getServer().getState().isAvailable()) {
        97 |       try {
        98 |         tomcat.stop();
        99 |         tomcat.destroy();
>>>    100 |       } catch (Exception e) {
       101 |         Loggers.get(EmbeddedTomcat.class).error("Fail to stop web server", e);
       102 |       }
       103 |     }
       104 |     deleteQuietly(tomcatBasedir());
       105 |   }

Added src/main/java/org/sonar/server/app/ProgrammaticLogbackValve.java (line 42)

        37 |     try {
        38 |       // direct coupling with LogbackValve implementation
        39 |       FieldUtils.writeField(this, "executorService", ExecutorServiceUtil.newExecutorService(), true);
        40 |       FieldUtils.writeField(this, "started", true, true);
        41 |       setState(LifecycleState.STARTING);
>>>     42 |     } catch (IllegalAccessException e) {
        43 |       throw new IllegalStateException(e);
        44 |     }
        45 |   }
        46 | }

Added src/main/java/org/sonar/server/app/TomcatAccessLog.java (line 73)

        68 |     @Override
        69 |     public void lifecycleEvent(LifecycleEvent event) {
        70 |       if ("after_start".equals(event.getType())) {
        71 |         logger.debug("Tomcat is started");
        72 | 
>>>     73 |       } else if ("after_destroy".equals(event.getType())) {
        74 |         logger.debug("Tomcat is stopped");
        75 |       }
        76 |     }
        77 |   }
        78 | 

Added src/main/java/org/sonar/server/app/TomcatContexts.java (line 74)

        69 | 
        70 |   static String getContextPath(Props props) {
        71 |     String context = props.value(PROPERTY_CONTEXT, "");
        72 |     if ("/".equals(context)) {
        73 |       context = "";
>>>     74 |     } else if (!"".equals(context) && context != null && !context.startsWith("/")) {
        75 |       throw MessageException.of(format("Value of '%s' must start with a forward slash: '%s'", PROPERTY_CONTEXT, context));
        76 |     }
        77 |     return context;
        78 |   }
        79 | 

Added src/main/java/org/sonar/server/app/TomcatContexts.java (line 84)

        79 | 
        80 |   @VisibleForTesting
        81 |   StandardContext addStaticDir(Tomcat tomcat, String contextPath, File dir) {
        82 |     try {
        83 |       fs.createOrCleanupDir(dir);
>>>     84 |     } catch (IOException e) {
        85 |       throw new IllegalStateException(format("Fail to create or clean-up directory %s", dir.getAbsolutePath()), e);
        86 |     }
        87 | 
        88 |     return addContext(tomcat, contextPath, dir);
        89 |   }

Added src/main/java/org/sonar/server/app/TomcatContexts.java (line 112)

       107 |       context.setAllowCasualMultipartParsing(true);
       108 |       context.setCookies(false);
       109 |       // disable JSP and WebSocket support
       110 |       context.setContainerSciFilter("org.apache.tomcat.websocket.server.WsSci|org.apache.jasper.servlet.JasperInitializer");
       111 |       return context;
>>>    112 |     } catch (ServletException e) {
       113 |       throw new IllegalStateException("Fail to configure webapp from " + dir, e);
       114 |     }
       115 |   }
       116 | 
       117 |   private static File webappDir(Props props) {

Added src/main/java/org/sonar/server/app/TomcatStartupLogs.java (line 40)

        35 |   void log(Tomcat tomcat) {
        36 |     Connector[] connectors = tomcat.getService().findConnectors();
        37 |     for (Connector connector : connectors) {
        38 |       if (StringUtils.equalsIgnoreCase(connector.getScheme(), "http")) {
        39 |         logHttp(connector);
>>>     40 |       } else {
        41 |         throw new IllegalArgumentException("Unsupported connector: " + connector);
        42 |       }
        43 |     }
        44 |   }
        45 | 

Added src/main/java/org/sonar/server/authentication/AuthenticationError.java (line 68)

        63 |   }
        64 | 
        65 |   private static String encodeMessage(String message) {
        66 |     try {
        67 |       return encode(message, UTF_8.name());
>>>     68 |     } catch (UnsupportedEncodingException e) {
        69 |       throw new IllegalStateException(format("Fail to encode %s", message), e);
        70 |     }
        71 |   }
        72 | 
        73 |   public static void redirectToUnauthorized(HttpServletResponse response) {

Added src/main/java/org/sonar/server/authentication/AuthenticationError.java (line 80)

        75 |   }
        76 | 
        77 |   private static void redirectTo(HttpServletResponse response, String url) {
        78 |     try {
        79 |       response.sendRedirect(url);
>>>     80 |     } catch (IOException e) {
        81 |       throw new IllegalStateException(format("Fail to redirect to %s", url), e);
        82 |     }
        83 |   }
        84 | }

Added src/main/java/org/sonar/server/authentication/AuthenticationFilter.java (line 57)

        52 |       handleError(response, "No provider key found in URI");
        53 |       return null;
        54 |     }
        55 |     try {
        56 |       return identityProviderRepository.getEnabledByKey(providerKey);
>>>     57 |     } catch (Exception e) {
        58 |       handleError(e, response, format("Failed to retrieve IdentityProvider for key '%s'", providerKey));
        59 |       return null;
        60 |     }
        61 |   }
        62 | 

Added src/main/java/org/sonar/server/authentication/BasicAuthenticator.java (line 90)

        85 |   }
        86 | 
        87 |   private static String getDecodedBasicAuth(String basicAuthEncoded) {
        88 |     try {
        89 |       return new String(BASE64_DECODER.decode(basicAuthEncoded.getBytes(UTF_8)), UTF_8);
>>>     90 |     } catch (Exception e) {
        91 |       throw AuthenticationException.newBuilder()
        92 |         .setSource(Source.local(Method.BASIC))
        93 |         .setMessage("Invalid basic header")
        94 |         .build();
        95 |     }

Added src/main/java/org/sonar/server/authentication/BasicAuthenticator.java (line 103)

        98 |   private UserDto authenticate(String login, String password, HttpServletRequest request) {
        99 |     if (isEmpty(password)) {
       100 |       UserDto userDto = authenticateFromUserToken(login);
       101 |       authenticationEvent.loginSuccess(request, userDto.getLogin(), Source.local(Method.BASIC_TOKEN));
       102 |       return userDto;
>>>    103 |     } else {
       104 |       return credentialsAuthenticator.authenticate(login, password, request, Method.BASIC);
       105 |     }
       106 |   }
       107 | 
       108 |   private UserDto authenticateFromUserToken(String token) {

Added src/main/java/org/sonar/server/authentication/CredentialsAuthenticator.java (line 90)

        85 | 
        86 |   @CheckForNull
        87 |   private static String checkPassword(@Nullable String cryptedPassword, @Nullable String salt, String userPassword) {
        88 |     if (cryptedPassword == null) {
        89 |       return "null password in DB";
>>>     90 |     } else if (salt == null) {
        91 |       return "null salt";
        92 |     } else if (!cryptedPassword.equals(encryptPassword(userPassword, salt))) {
        93 |       return "wrong password";
        94 |     }
        95 |     return null;
S1116 (java) on sonar-server - 0 issues removed, 6 issues added - new ruling file

Added src/test/java/org/sonar/server/computation/task/projectanalysis/issue/IssueCounterTest.java (line 142)

       137 |     .add(NEW_VULNERABILITIES_METRIC);
       138 | 
       139 |   @Rule
       140 |   public MeasureRepositoryRule measureRepository = MeasureRepositoryRule.create(treeRootHolder, metricRepository);
       141 | 
>>>    142 |   private IssueCounter underTest = new IssueCounter(periodsHolder, metricRepository, measureRepository);;
       143 | 
       144 |   @Test
       145 |   public void count_issues_by_status() {
       146 |     periodsHolder.setPeriod(null);
       147 | 

Added src/test/java/org/sonar/server/issue/notification/DoNotFixNotificationDispatcherTest.java (line 40)

        35 | public class DoNotFixNotificationDispatcherTest {
        36 |   NotificationManager notifications = mock(NotificationManager.class);
        37 |   NotificationDispatcher.Context context = mock(NotificationDispatcher.Context.class);
        38 |   NotificationChannel emailChannel = mock(NotificationChannel.class);
        39 |   NotificationChannel twitterChannel = mock(NotificationChannel.class);
>>>     40 |   DoNotFixNotificationDispatcher underTest = new DoNotFixNotificationDispatcher(notifications);;
        41 | 
        42 |   @Test
        43 |   public void test_metadata() throws Exception {
        44 |     NotificationDispatcherMetadata metadata = DoNotFixNotificationDispatcher.newMetadata();
        45 |     assertThat(metadata.getDispatcherKey()).isEqualTo(underTest.getKey());

Added src/test/java/org/sonar/server/qualitygate/ws/QualityGatesWsTest.java (line 212)

       207 |     Long id = 42L;
       208 |     String name = "New QG";
       209 |     when(qGates.rename(id, name)).thenReturn(new QualityGateDto().setId(id).setName(name));
       210 |     tester.newPostRequest("api/qualitygates", "rename").setParam("id", id.toString()).setParam("name", name).execute()
       211 |       .assertJson("{\"id\":42,\"name\":\"New QG\"}");
>>>    212 |     ;
       213 |   }
       214 | 
       215 |   @Test
       216 |   public void set_as_default_nominal() throws Exception {
       217 |     Long id = 42L;

Added src/test/java/org/sonar/server/rule/index/RuleIndexDefinitionTest.java (line 38)

        33 | 
        34 | import static org.assertj.core.api.Assertions.assertThat;
        35 | import static org.sonar.server.rule.index.RuleIndexDefinition.FIELD_RULE_HTML_DESCRIPTION;
        36 | import static org.sonar.server.rule.index.RuleIndexDefinition.FIELD_RULE_KEY;
        37 | import static org.sonar.server.rule.index.RuleIndexDefinition.FIELD_RULE_REPOSITORY;
>>>     38 | import static org.sonar.server.rule.index.RuleIndexDefinition.INDEX_TYPE_RULE;;
        39 | 
        40 | public class RuleIndexDefinitionTest {
        41 | 
        42 |   private MapSettings settings = new MapSettings();
        43 |   private RuleIndexDefinition underTest = new RuleIndexDefinition(settings.asConfig());

Added src/test/java/org/sonar/server/rule/ws/SearchActionTest.java (line 445)

       440 |     assertThat(searchedRule.getDefaultRemFnBaseEffort()).isEqualTo("15min");
       441 |     assertThat(searchedRule.getDefaultRemFnGapMultiplier()).isEqualTo("1h");
       442 |     assertThat(searchedRule.getDefaultRemFnType()).isEqualTo(DebtRemediationFunction.Type.LINEAR_OFFSET.name());
       443 |     assertThat(searchedRule.getDebtOverloaded()).isTrue();
       444 |     assertThat(searchedRule.getDebtRemFnCoeff()).isEmpty();
>>>    445 |     ;
       446 |     assertThat(searchedRule.getDebtRemFnOffset()).isEqualTo("5min");
       447 |     assertThat(searchedRule.getDebtRemFnType()).isEqualTo(DebtRemediationFunction.Type.CONSTANT_ISSUE.name());
       448 |   }
       449 | 
       450 |   @Test

Added src/test/java/org/sonar/server/test/index/TestResultSetIteratorTest.java (line 141)

       136 |     assertThat(doc).contains(
       137 |       entry(FIELD_PROJECT_UUID, "P1"),
       138 |       entry(FIELD_FILE_UUID, "F1"),
       139 |       entry(FIELD_TEST_UUID, "U1"),
       140 |       entry(FIELD_NAME, "N1"));
>>>    141 |     ;
       142 |     // null values
       143 |     assertThat(doc).containsKeys(
       144 |       FIELD_DURATION_IN_MS,
       145 |       FIELD_STACKTRACE,
       146 |       FIELD_MESSAGE,

... and 356 more rules with changes (diff too large to display fully)

@gitar-bot

gitar-bot Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Code Review ⚠️ Changes requested 0 closed / 2 findings

🟡 Medium risk · Relocating the ruling fixture and retargeting 187 baselines could misconfigure integration-test comparisons, weakening detection of analyzer regressions.

Relocates the sonar-server ruling fixture and its 187 expected baselines to expected/sonar-server with updated project keys, pointing the ruling test at the new fixture. Changes are requested before merge: its/sources is pinned to a commit on the unmerged ruling_java PR #18 branch, which could become unfetchable once that branch is deleted, so re-point it to the merged master commit after #18 lands. Also, AGENTS.md still lists sonarqube-6.5 as a ruling project and should be updated to sonar-server.

⚠️ Bug: Submodule pinned to unmerged ruling_java PR branch commit

📄 its/sources:1

its/sources now points to d4109b185897249a62b854248ad449215f0b5676. That is the head of the move-sonar-server branch of SonarSource/ruling_java#18, which is still open and is not in master's history (branches-where-head, PR #18). If #18 is squash- or rebase-merged and the branch is then deleted, this SHA can no longer be fetched from master, and git submodule update fails for every ruling CI run. Once #18 lands, re-point the submodule to the merge commit that ends up on ruling_java master, then merge this PR.

💡 Quality: AGENTS.md still lists sonarqube-6.5 as a ruling project

📄 its/ruling/src/test/java/org/sonar/java/it/JavaRulingTest.java:401-403

This PR renames the ruling project to sonar-server: the fixture moves, the expected baselines move to expected/sonar-server, and projectName in JavaRulingTest.sonarqube_server changes. AGENTS.md:299 still lists sonarqube-6.5 among the ruling projects. The same section says <projectKey> is the project's folder name under its/sources/ and that expected files live in expected/<project>/. Following it now leads to a directory and key prefix that no longer exist. That list is the documented ruling project names, so it should be updated to sonar-server.

Replace the stale project name in AGENTS.md.
Ruling tests validate that rule fixes don't break existing true positives. They run the analyzer against real-world Java projects (`guava`, `commons-beanutils`, `eclipse-jetty`, `sonar-server`, `jboss-ejb3-tutorial`, `regex-examples`, `mall`) and compare results to expected baselines.
🤖 Prompt for agents
Code Review: Relocates the sonar-server ruling fixture and its 187 expected baselines to `expected/sonar-server` with updated project keys, pointing the ruling test at the new fixture. Changes are requested before merge: `its/sources` is pinned to a commit on the unmerged ruling_java PR #18 branch, which could become unfetchable once that branch is deleted, so re-point it to the merged master commit after #18 lands. Also, AGENTS.md still lists `sonarqube-6.5` as a ruling project and should be updated to `sonar-server`.

1. ⚠️ Bug: Submodule pinned to unmerged ruling_java PR branch commit
   Files: its/sources:1

   `its/sources` now points to `d4109b185897249a62b854248ad449215f0b5676`. That is the head of the `move-sonar-server` branch of SonarSource/ruling_java#18, which is still open and is not in `master`'s history ([branches-where-head](https://api.github.com/repos/SonarSource/ruling_java/commits/d4109b185897249a62b854248ad449215f0b5676/branches-where-head), [PR #18](https://api.github.com/repos/SonarSource/ruling_java/pulls/18)). If #18 is squash- or rebase-merged and the branch is then deleted, this SHA can no longer be fetched from master, and `git submodule update` fails for every ruling CI run. Once #18 lands, re-point the submodule to the merge commit that ends up on ruling_java `master`, then merge this PR.

2. 💡 Quality: AGENTS.md still lists `sonarqube-6.5` as a ruling project
   Files: its/ruling/src/test/java/org/sonar/java/it/JavaRulingTest.java:401-403

   This PR renames the ruling project to `sonar-server`: the fixture moves, the expected baselines move to `expected/sonar-server`, and `projectName` in `JavaRulingTest.sonarqube_server` changes. AGENTS.md:299 still lists `sonarqube-6.5` among the ruling projects. The same section says `<projectKey>` is the project's folder name under `its/sources/` and that expected files live in `expected/<project>/`. Following it now leads to a directory and key prefix that no longer exist. That list is the [documented ruling project names](https://app.gitar.ai/dashboard/knowledge?fact=01a10b5c-6fcb-7092-954e-0dd6c8675dc4&organization=org_39IepXTlMfsacAJscTWZRzxocgg&organization=org_6yy8x4tTaz1NDNZ2), so it should be updated to `sonar-server`.

   Fix (Replace the stale project name in AGENTS.md.):
   Ruling tests validate that rule fixes don't break existing true positives. They run the analyzer against real-world Java projects (`guava`, `commons-beanutils`, `eclipse-jetty`, `sonar-server`, `jboss-ejb3-tutorial`, `regex-examples`, `mall`) and compare results to expected baselines.

Verification Knowledge 🔎 1 PRs 4 inspected

Functional validation No results

Rules 2 not applicable

Knowledge 🔎 1 informed a finding

🔎 Ruling baseline project-key format informed a finding, open -> AGENTS.md still lists sonarqube-6.5 as a ruling project

Broader impact PRs 4 inspected
Cross-PR 4 PRs inspected 0 open impacts

PR 18: RC-352 Move sonar-server ruling project to the repository root Inspected
PR 5628: SONARJAVA-6330 Lower rule S8692's severity and do not raise on System.currentTimeMillis() Inspected
PR 6429: Test ruling-diff action across all ruling projects Inspected
PR 6418: RC-353 Test Sarif diff Inspected

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.
Unblock → Override a blocking verdict and allow merging.

Comment with these commands to change the behavior for this request:

Auto-apply Compact Unblock
gitar auto-apply:on         
gitar display:verbose         
gitar unblock         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqube-next

Copy link
Copy Markdown
Contributor

Comment thread its/sources
@@ -1 +1 @@
Subproject commit 616f3f5a7dca9c5858fb35d5eeff64b28b6524c1
Subproject commit d4109b185897249a62b854248ad449215f0b5676

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Bug: Submodule pinned to unmerged ruling_java PR branch commit

its/sources now points to d4109b185897249a62b854248ad449215f0b5676. That is the head of the move-sonar-server branch of SonarSource/ruling_java#18, which is still open and is not in master's history (branches-where-head, PR #18). If #18 is squash- or rebase-merged and the branch is then deleted, this SHA can no longer be fetched from master, and git submodule update fails for every ruling CI run. Once #18 lands, re-point the submodule to the merge commit that ends up on ruling_java master, then merge this PR.

Was this helpful? React with 👍 / 👎

Comment on lines +401 to +403
// sonar-server (v.6.5)
String projectName = "sonar-server";
MavenBuild build = test_project(projectName)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Quality: AGENTS.md still lists sonarqube-6.5 as a ruling project

This PR renames the ruling project to sonar-server: the fixture moves, the expected baselines move to expected/sonar-server, and projectName in JavaRulingTest.sonarqube_server changes. AGENTS.md:299 still lists sonarqube-6.5 among the ruling projects. The same section says <projectKey> is the project's folder name under its/sources/ and that expected files live in expected/<project>/. Following it now leads to a directory and key prefix that no longer exist. That list is the documented ruling project names, so it should be updated to sonar-server.

Replace the stale project name in AGENTS.md.:

Ruling tests validate that rule fixes don't break existing true positives. They run the analyzer against real-world Java projects (`guava`, `commons-beanutils`, `eclipse-jetty`, `sonar-server`, `jboss-ejb3-tutorial`, `regex-examples`, `mall`) and compare results to expected baselines.
  • Apply fix

Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant