@Override
  public void start() {
    if (isDisabled()) {
      LOG.debug(MESSAGE_SCM_STEP_IS_DISABLED_BY_CONFIGURATION);
      return;
    }
    if (settings.hasKey(SCM_PROVIDER_KEY)) {
      settings.get(SCM_PROVIDER_KEY).ifPresent(this::setProviderIfSupported);
    } else {
      autodetection();
      if (this.provider == null) {
        considerOldScmUrl();
      }
      if (this.provider == null) {
        String message = "SCM provider autodetection failed. Please use \"" + SCM_PROVIDER_KEY + "\" to define SCM of " +
          "your project, or disable the SCM Sensor in the project settings.";
        LOG.warn(message);
        analysisWarnings.addUnique(message);
      }
    }
    if (isExclusionDisabled()) {
      LOG.info(MESSAGE_SCM_EXCLUSIONS_IS_DISABLED_BY_CONFIGURATION);
    }
  }
@Test
  void fail_when_multiple_scm_providers_claim_support() {
    when(scmProvider.supports(any())).thenReturn(true);
    when(scmProvider.key()).thenReturn("key1", "key2");

    ScmProvider[] providers = {scmProvider, scmProvider};
    ScmConfiguration underTest = new ScmConfiguration(inputModuleHierarchy, settings, analysisWarnings, providers);

    assertThatThrownBy(() -> underTest.start())
      .isInstanceOf(MessageException.class)
      .hasMessageContaining("SCM provider autodetection failed. "
        + "Both key2 and key2 claim to support this project. "
        + "Please use \"sonar.scm.provider\" to define SCM of your project.");
  }