├── .cirrus.star ├── .cirrus.yml ├── .github ├── CODEOWNERS ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── PullRequestClosed.yml │ ├── PullRequestCreated.yml │ ├── RequestReview.yml │ ├── SubmitReview.yml │ ├── releasability.yaml │ └── release.yml ├── .gitignore ├── CHANGELOG.md ├── HEADER ├── LICENSE ├── README.md ├── SECURITY.md ├── build.gradle ├── check-api ├── build.gradle └── src │ └── main │ └── java │ └── org │ └── sonar │ └── check │ ├── BelongsToProfile.java │ ├── Cardinality.java │ ├── Message.java │ ├── Priority.java │ ├── Rule.java │ ├── RuleProperty.java │ └── package-info.java ├── docs ├── deprecation-policy.md ├── influencing-extensions-execution-order.md └── optimize-sensors.md ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── plugin-api ├── build.gradle └── src │ ├── main │ ├── java │ │ └── org │ │ │ ├── sonar │ │ │ └── api │ │ │ │ ├── Beta.java │ │ │ │ ├── CoreProperties.java │ │ │ │ ├── ExtensionPoint.java │ │ │ │ ├── Plugin.java │ │ │ │ ├── Properties.java │ │ │ │ ├── Property.java │ │ │ │ ├── PropertyField.java │ │ │ │ ├── PropertyType.java │ │ │ │ ├── SonarEdition.java │ │ │ │ ├── SonarProduct.java │ │ │ │ ├── SonarQubeSide.java │ │ │ │ ├── SonarRuntime.java │ │ │ │ ├── Startable.java │ │ │ │ ├── batch │ │ │ │ ├── DependedUpon.java │ │ │ │ ├── DependsUpon.java │ │ │ │ ├── InstantiationStrategy.java │ │ │ │ ├── Phase.java │ │ │ │ ├── ScannerSide.java │ │ │ │ ├── bootstrap │ │ │ │ │ ├── ProjectBuilder.java │ │ │ │ │ ├── ProjectDefinition.java │ │ │ │ │ ├── ProjectReactor.java │ │ │ │ │ ├── internal │ │ │ │ │ │ ├── ProjectBuilderContext.java │ │ │ │ │ │ └── package-info.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── fs │ │ │ │ │ ├── FilePredicate.java │ │ │ │ │ ├── FilePredicates.java │ │ │ │ │ ├── FileSystem.java │ │ │ │ │ ├── IndexedFile.java │ │ │ │ │ ├── InputComponent.java │ │ │ │ │ ├── InputDir.java │ │ │ │ │ ├── InputFile.java │ │ │ │ │ ├── InputFileFilter.java │ │ │ │ │ ├── InputModule.java │ │ │ │ │ ├── InputPath.java │ │ │ │ │ ├── TextPointer.java │ │ │ │ │ ├── TextRange.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── measure │ │ │ │ │ ├── Metric.java │ │ │ │ │ ├── MetricFinder.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── package-info.java │ │ │ │ ├── postjob │ │ │ │ │ ├── PostJob.java │ │ │ │ │ ├── PostJobContext.java │ │ │ │ │ ├── PostJobDescriptor.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── rule │ │ │ │ │ ├── ActiveRule.java │ │ │ │ │ ├── ActiveRules.java │ │ │ │ │ ├── CheckFactory.java │ │ │ │ │ ├── Checks.java │ │ │ │ │ ├── LoadedActiveRule.java │ │ │ │ │ ├── Rule.java │ │ │ │ │ ├── RuleParam.java │ │ │ │ │ ├── Severity.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── scm │ │ │ │ │ ├── BlameCommand.java │ │ │ │ │ ├── BlameLine.java │ │ │ │ │ ├── IgnoreCommand.java │ │ │ │ │ ├── ScmProvider.java │ │ │ │ │ └── package-info.java │ │ │ │ └── sensor │ │ │ │ │ ├── Sensor.java │ │ │ │ │ ├── SensorContext.java │ │ │ │ │ ├── SensorDescriptor.java │ │ │ │ │ ├── cache │ │ │ │ │ ├── ReadCache.java │ │ │ │ │ ├── WriteCache.java │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── code │ │ │ │ │ ├── NewSignificantCode.java │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── coverage │ │ │ │ │ ├── NewCoverage.java │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── cpd │ │ │ │ │ ├── NewCpdTokens.java │ │ │ │ │ ├── internal │ │ │ │ │ │ ├── TokensLine.java │ │ │ │ │ │ └── package-info.java │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── error │ │ │ │ │ ├── AnalysisError.java │ │ │ │ │ ├── NewAnalysisError.java │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── highlighting │ │ │ │ │ ├── NewHighlighting.java │ │ │ │ │ ├── TypeOfText.java │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── internal │ │ │ │ │ ├── SensorStorage.java │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── issue │ │ │ │ │ ├── ExternalIssue.java │ │ │ │ │ ├── IIssue.java │ │ │ │ │ ├── Issue.java │ │ │ │ │ ├── IssueLocation.java │ │ │ │ │ ├── MessageFormatting.java │ │ │ │ │ ├── NewExternalIssue.java │ │ │ │ │ ├── NewIssue.java │ │ │ │ │ ├── NewIssueLocation.java │ │ │ │ │ ├── NewMessageFormatting.java │ │ │ │ │ ├── fix │ │ │ │ │ │ ├── InputFileEdit.java │ │ │ │ │ │ ├── NewInputFileEdit.java │ │ │ │ │ │ ├── NewQuickFix.java │ │ │ │ │ │ ├── NewTextEdit.java │ │ │ │ │ │ ├── QuickFix.java │ │ │ │ │ │ ├── TextEdit.java │ │ │ │ │ │ └── package-info.java │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── measure │ │ │ │ │ ├── Measure.java │ │ │ │ │ ├── NewMeasure.java │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── package-info.java │ │ │ │ │ ├── rule │ │ │ │ │ ├── AdHocRule.java │ │ │ │ │ ├── NewAdHocRule.java │ │ │ │ │ └── package-info.java │ │ │ │ │ └── symbol │ │ │ │ │ ├── NewSymbol.java │ │ │ │ │ ├── NewSymbolTable.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── ce │ │ │ │ ├── ComputeEngineSide.java │ │ │ │ ├── measure │ │ │ │ │ ├── Component.java │ │ │ │ │ ├── Issue.java │ │ │ │ │ ├── Measure.java │ │ │ │ │ ├── MeasureComputer.java │ │ │ │ │ ├── RangeDistributionBuilder.java │ │ │ │ │ ├── Settings.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── package-info.java │ │ │ │ └── posttask │ │ │ │ │ ├── Analysis.java │ │ │ │ │ ├── Branch.java │ │ │ │ │ ├── CeTask.java │ │ │ │ │ ├── Organization.java │ │ │ │ │ ├── PostProjectAnalysisTask.java │ │ │ │ │ ├── Project.java │ │ │ │ │ ├── QualityGate.java │ │ │ │ │ ├── ScannerContext.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── config │ │ │ │ ├── Category.java │ │ │ │ ├── Configuration.java │ │ │ │ ├── EmailSettings.java │ │ │ │ ├── GlobalPropertyChangeHandler.java │ │ │ │ ├── PropertyDefinition.java │ │ │ │ ├── PropertyDefinitions.java │ │ │ │ ├── PropertyFieldDefinition.java │ │ │ │ ├── Settings.java │ │ │ │ ├── SubCategory.java │ │ │ │ └── package-info.java │ │ │ │ ├── issue │ │ │ │ ├── DefaultTransitions.java │ │ │ │ ├── Issue.java │ │ │ │ ├── IssueStatus.java │ │ │ │ ├── NoSonarFilter.java │ │ │ │ ├── impact │ │ │ │ │ ├── Severity.java │ │ │ │ │ ├── SoftwareQuality.java │ │ │ │ │ └── package-info.java │ │ │ │ └── package-info.java │ │ │ │ ├── measures │ │ │ │ ├── CoreMetrics.java │ │ │ │ ├── FileLinesContext.java │ │ │ │ ├── FileLinesContextFactory.java │ │ │ │ ├── Metric.java │ │ │ │ ├── Metrics.java │ │ │ │ └── package-info.java │ │ │ │ ├── notifications │ │ │ │ ├── AnalysisWarnings.java │ │ │ │ └── package-info.java │ │ │ │ ├── package-info.java │ │ │ │ ├── platform │ │ │ │ ├── NewUserHandler.java │ │ │ │ ├── Server.java │ │ │ │ ├── ServerFileSystem.java │ │ │ │ ├── ServerStartHandler.java │ │ │ │ ├── ServerStopHandler.java │ │ │ │ ├── ServerUpgradeStatus.java │ │ │ │ └── package-info.java │ │ │ │ ├── resources │ │ │ │ ├── AbstractLanguage.java │ │ │ │ ├── Language.java │ │ │ │ ├── Languages.java │ │ │ │ ├── Qualifiers.java │ │ │ │ ├── ResourceType.java │ │ │ │ ├── ResourceTypeTree.java │ │ │ │ ├── ResourceTypes.java │ │ │ │ ├── Scopes.java │ │ │ │ └── package-info.java │ │ │ │ ├── rule │ │ │ │ ├── RuleKey.java │ │ │ │ ├── RuleScope.java │ │ │ │ ├── RuleStatus.java │ │ │ │ ├── Severity.java │ │ │ │ └── package-info.java │ │ │ │ ├── rules │ │ │ │ ├── CleanCodeAttribute.java │ │ │ │ ├── CleanCodeAttributeCategory.java │ │ │ │ ├── Rule.java │ │ │ │ ├── RuleAnnotationUtils.java │ │ │ │ ├── RuleFinder.java │ │ │ │ ├── RuleParam.java │ │ │ │ ├── RulePriority.java │ │ │ │ ├── RuleQuery.java │ │ │ │ ├── RuleType.java │ │ │ │ └── package-info.java │ │ │ │ ├── scan │ │ │ │ ├── filesystem │ │ │ │ │ ├── FileExclusions.java │ │ │ │ │ ├── PathResolver.java │ │ │ │ │ └── package-info.java │ │ │ │ └── issue │ │ │ │ │ └── filter │ │ │ │ │ ├── FilterableIssue.java │ │ │ │ │ ├── IssueFilter.java │ │ │ │ │ ├── IssueFilterChain.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── scanner │ │ │ │ ├── ScannerSide.java │ │ │ │ ├── fs │ │ │ │ │ ├── InputProject.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── package-info.java │ │ │ │ └── sensor │ │ │ │ │ ├── ProjectSensor.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── security │ │ │ │ ├── Authenticator.java │ │ │ │ ├── DefaultGroups.java │ │ │ │ ├── ExternalGroupsProvider.java │ │ │ │ ├── ExternalUsersProvider.java │ │ │ │ ├── SecurityRealm.java │ │ │ │ ├── UserDetails.java │ │ │ │ └── package-info.java │ │ │ │ ├── server │ │ │ │ ├── ServerSide.java │ │ │ │ ├── authentication │ │ │ │ │ ├── BaseIdentityProvider.java │ │ │ │ │ ├── Display.java │ │ │ │ │ ├── IdentityProvider.java │ │ │ │ │ ├── OAuth2IdentityProvider.java │ │ │ │ │ ├── UnauthorizedException.java │ │ │ │ │ ├── UserIdentity.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── debt │ │ │ │ │ ├── DebtRemediationFunction.java │ │ │ │ │ ├── internal │ │ │ │ │ │ ├── DefaultDebtRemediationFunction.java │ │ │ │ │ │ └── package-info.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── http │ │ │ │ │ ├── Cookie.java │ │ │ │ │ ├── HttpRequest.java │ │ │ │ │ └── HttpResponse.java │ │ │ │ ├── impl │ │ │ │ │ └── RulesDefinitionContext.java │ │ │ │ ├── package-info.java │ │ │ │ ├── profile │ │ │ │ │ ├── BuiltInQualityProfileAnnotationLoader.java │ │ │ │ │ ├── BuiltInQualityProfilesDefinition.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── rule │ │ │ │ │ ├── Context.java │ │ │ │ │ ├── ContextAwareRuleDescriptionSection.java │ │ │ │ │ ├── DefaultRuleDescriptionSection.java │ │ │ │ │ ├── RuleDescriptionSection.java │ │ │ │ │ ├── RuleDescriptionSectionBuilder.java │ │ │ │ │ ├── RuleParamType.java │ │ │ │ │ ├── RuleTagFormat.java │ │ │ │ │ ├── RuleTagsToTypeConverter.java │ │ │ │ │ ├── RulesDefinition.java │ │ │ │ │ ├── RulesDefinitionAnnotationLoader.java │ │ │ │ │ ├── RulesDefinitionXmlLoader.java │ │ │ │ │ ├── StringPatternValidator.java │ │ │ │ │ ├── internal │ │ │ │ │ │ ├── DefaultDebtRemediationFunctions.java │ │ │ │ │ │ ├── DefaultNewParam.java │ │ │ │ │ │ ├── DefaultNewRepository.java │ │ │ │ │ │ ├── DefaultNewRule.java │ │ │ │ │ │ ├── DefaultParam.java │ │ │ │ │ │ ├── DefaultRepository.java │ │ │ │ │ │ ├── DefaultRule.java │ │ │ │ │ │ ├── ImpactMapper.java │ │ │ │ │ │ └── package-info.java │ │ │ │ │ └── package-info.java │ │ │ │ └── ws │ │ │ │ │ ├── Change.java │ │ │ │ │ ├── Definable.java │ │ │ │ │ ├── LocalConnector.java │ │ │ │ │ ├── Request.java │ │ │ │ │ ├── RequestHandler.java │ │ │ │ │ ├── Response.java │ │ │ │ │ ├── WebService.java │ │ │ │ │ ├── impl │ │ │ │ │ ├── PartImpl.java │ │ │ │ │ └── ValidatingRequest.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── user │ │ │ │ ├── User.java │ │ │ │ ├── UserGroupValidation.java │ │ │ │ ├── UserQuery.java │ │ │ │ └── package-info.java │ │ │ │ ├── utils │ │ │ │ ├── AnnotationUtils.java │ │ │ │ ├── DateUtils.java │ │ │ │ ├── Duration.java │ │ │ │ ├── Durations.java │ │ │ │ ├── FieldUtils2.java │ │ │ │ ├── HttpDownloader.java │ │ │ │ ├── KeyValueFormat.java │ │ │ │ ├── LocalizedMessages.java │ │ │ │ ├── ManifestUtils.java │ │ │ │ ├── MessageException.java │ │ │ │ ├── Paging.java │ │ │ │ ├── ParsingUtils.java │ │ │ │ ├── PathUtils.java │ │ │ │ ├── Preconditions.java │ │ │ │ ├── SonarException.java │ │ │ │ ├── System2.java │ │ │ │ ├── TempFolder.java │ │ │ │ ├── TimeUtils.java │ │ │ │ ├── UriReader.java │ │ │ │ ├── ValidationMessages.java │ │ │ │ ├── Version.java │ │ │ │ ├── WildcardPattern.java │ │ │ │ ├── ZipUtils.java │ │ │ │ ├── command │ │ │ │ │ ├── Command.java │ │ │ │ │ ├── CommandException.java │ │ │ │ │ ├── CommandExecutor.java │ │ │ │ │ ├── StreamConsumer.java │ │ │ │ │ ├── StringStreamConsumer.java │ │ │ │ │ ├── TimeoutException.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── dag │ │ │ │ │ ├── CyclicDependenciesException.java │ │ │ │ │ ├── DirectAcyclicGraph.java │ │ │ │ │ ├── Node.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── log │ │ │ │ │ ├── DefaultProfiler.java │ │ │ │ │ ├── Logger.java │ │ │ │ │ ├── LoggerLevel.java │ │ │ │ │ ├── Loggers.java │ │ │ │ │ ├── NullProfiler.java │ │ │ │ │ ├── Profiler.java │ │ │ │ │ ├── Slf4jLogger.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── package-info.java │ │ │ │ └── text │ │ │ │ │ ├── CsvWriter.java │ │ │ │ │ ├── JsonWriter.java │ │ │ │ │ ├── WriterException.java │ │ │ │ │ ├── XmlWriter.java │ │ │ │ │ └── package-info.java │ │ │ │ └── web │ │ │ │ ├── AbstractUrlPattern.java │ │ │ │ ├── FilterChain.java │ │ │ │ ├── HttpFilter.java │ │ │ │ ├── UrlPattern.java │ │ │ │ ├── UserRole.java │ │ │ │ ├── WebAnalytics.java │ │ │ │ ├── package-info.java │ │ │ │ └── page │ │ │ │ ├── Context.java │ │ │ │ ├── Page.java │ │ │ │ ├── PageDefinition.java │ │ │ │ └── package-info.java │ │ │ └── sonarsource │ │ │ └── api │ │ │ └── sonarlint │ │ │ ├── SonarLintSide.java │ │ │ └── package-info.java │ └── resources │ │ └── sonar-api-version.txt │ └── test │ ├── java │ └── org │ │ └── sonar │ │ └── api │ │ ├── batch │ │ ├── bootstrap │ │ │ ├── ProjectBuilderTest.java │ │ │ ├── ProjectDefinitionTest.java │ │ │ └── ProjectReactorTest.java │ │ ├── fs │ │ │ └── IndexedFileTest.java │ │ ├── rule │ │ │ ├── AbstractCheck.java │ │ │ ├── CheckWithKey.java │ │ │ ├── CheckWithOverriddenPropertyKey.java │ │ │ ├── CheckWithPrimitiveProperties.java │ │ │ ├── CheckWithStringProperty.java │ │ │ ├── CheckWithUnsupportedPropertyType.java │ │ │ ├── CheckWithoutProperties.java │ │ │ ├── ChecksTest.java │ │ │ └── ImplementedCheck.java │ │ ├── scm │ │ │ ├── BlameLineTest.java │ │ │ └── ScmProviderTest.java │ │ └── sensor │ │ │ └── highlighting │ │ │ └── TypeOfTextTest.java │ │ ├── ce │ │ ├── measure │ │ │ └── RangeDistributionBuilderTest.java │ │ └── posttask │ │ │ ├── CeTaskBuilder_PostProjectAnalysisTaskTesterTest.java │ │ │ ├── ConditionBuilder_PostProjectAnalysisTaskTesterTest.java │ │ │ ├── PostProjectAnalysisTaskTest.java │ │ │ ├── ProjectBuilder_PostProjectAnalysisTaskTesterTest.java │ │ │ └── QualityGateBuilder_PostProjectAnalysisTaskTesterTest.java │ │ ├── config │ │ ├── CategoryTest.java │ │ ├── ConfigurationTest.java │ │ ├── EmailSettingsTest.java │ │ ├── GlobalPropertyChangeHandlerTest.java │ │ ├── MapConfiguration.java │ │ ├── PropertyDefinitionTest.java │ │ ├── PropertyDefinitionsTest.java │ │ ├── SettingsTest.java │ │ └── SubCategoryTest.java │ │ ├── issue │ │ ├── DefaultTransitionsTest.java │ │ ├── IssueStatusTest.java │ │ └── IssueTest.java │ │ ├── measures │ │ └── MetricTest.java │ │ ├── platform │ │ └── NewUserHandlerTest.java │ │ ├── resources │ │ ├── AbstractLanguageTest.java │ │ ├── CoreMetricsTest.java │ │ ├── LanguagesTest.java │ │ ├── ResourceTypeTest.java │ │ ├── ResourceTypeTreeTest.java │ │ ├── ResourceTypesTest.java │ │ └── ScopesTest.java │ │ ├── rule │ │ ├── RuleKeyTest.java │ │ ├── RuleStatusTest.java │ │ └── SeverityTest.java │ │ ├── rules │ │ ├── AnnotatedCheck.java │ │ ├── AnnotatedCheckWithParameters.java │ │ ├── CleanCodeAttributeTest.java │ │ ├── RuleAnnotationUtilsTest.java │ │ ├── RulePriorityTest.java │ │ ├── RuleTest.java │ │ └── RuleTypeTest.java │ │ ├── scan │ │ └── filesystem │ │ │ ├── FileExclusionsTest.java │ │ │ └── PathResolverTest.java │ │ ├── security │ │ ├── DefaultGroupsTest.java │ │ ├── ExternalGroupsProviderTest.java │ │ ├── ExternalUsersProviderTest.java │ │ ├── SecurityRealmTest.java │ │ └── UserDetailsTest.java │ │ ├── server │ │ ├── authentication │ │ │ ├── DisplayTest.java │ │ │ └── UserIdentityTest.java │ │ ├── debt │ │ │ └── DefaultDebtRemediationFunctionTest.java │ │ ├── impl │ │ │ └── RulesDefinitionContextTest.java │ │ ├── profile │ │ │ ├── BuiltInQualityProfileAnnotationLoaderTest.java │ │ │ └── BuiltInQualityProfilesDefinitionTest.java │ │ ├── rule │ │ │ ├── ContextAwareRuleDescriptionSectionTest.java │ │ │ ├── ContextTest.java │ │ │ ├── DefaultRuleDescriptionSectionTest.java │ │ │ ├── RuleDescriptionSectionBuilderTest.java │ │ │ ├── RuleParamTypeTest.java │ │ │ ├── RuleTagFormatTest.java │ │ │ ├── RuleTagsToTypeConverterTest.java │ │ │ ├── RulesDefinitionAnnotationLoaderTest.java │ │ │ ├── RulesDefinitionXmlLoaderTest.java │ │ │ ├── StringPatternValidatorTest.java │ │ │ └── internal │ │ │ │ ├── DefaultNewRuleTest.java │ │ │ │ ├── DefaultRepositoryTest.java │ │ │ │ ├── DefaultRuleTest.java │ │ │ │ └── ImpactMapperTest.java │ │ └── ws │ │ │ ├── RequestTest.java │ │ │ └── WebServiceTest.java │ │ ├── user │ │ ├── UserGroupValidationTest.java │ │ └── UserQueryTest.java │ │ ├── utils │ │ ├── AnnotationUtilsTest.java │ │ ├── DateUtilsTest.java │ │ ├── DurationTest.java │ │ ├── DurationsTest.java │ │ ├── ExceptionCauseMatcher.java │ │ ├── FieldUtils2Test.java │ │ ├── KeyValueFormatTest.java │ │ ├── LocalizedMessagesTest.java │ │ ├── ManifestUtilsTest.java │ │ ├── MessageExceptionTest.java │ │ ├── PagingTest.java │ │ ├── ParsingUtilsTest.java │ │ ├── PathUtilsTest.java │ │ ├── System2Test.java │ │ ├── TestUtils.java │ │ ├── TimeUtilsTest.java │ │ ├── UriReaderTest.java │ │ ├── ValidationMessagesTest.java │ │ ├── VersionTest.java │ │ ├── WildcardPatternTest.java │ │ ├── ZipUtilsTest.java │ │ ├── command │ │ │ ├── CommandExecutorTest.java │ │ │ └── CommandTest.java │ │ ├── dag │ │ │ └── DirectAcyclicGraphTest.java │ │ ├── log │ │ │ ├── DefaultProfilerTest.java │ │ │ ├── LoggersTest.java │ │ │ ├── NullProfilerTest.java │ │ │ ├── ProfilerTest.java │ │ │ └── Slf4jLoggerTest.java │ │ └── text │ │ │ ├── CsvWriterTest.java │ │ │ ├── JsonWriterTest.java │ │ │ └── XmlWriterTest.java │ │ └── web │ │ ├── HttpFilterTest.java │ │ ├── UrlPatternTest.java │ │ └── page │ │ ├── ContextTest.java │ │ ├── PageDefinitionTest.java │ │ └── PageTest.java │ ├── resources │ ├── logback-test.xml │ ├── org │ │ └── sonar │ │ │ └── api │ │ │ ├── server │ │ │ ├── rule │ │ │ │ ├── RuleDescriptionSectionBuilderTest.html │ │ │ │ ├── RulesDefinitionTest │ │ │ │ │ ├── sample.html │ │ │ │ │ └── sample.md │ │ │ │ └── RulesDefinitionXmlLoaderTest │ │ │ │ │ ├── deprecated.xml │ │ │ │ │ ├── invalid.xml │ │ │ │ │ ├── rules.xml │ │ │ │ │ ├── utf8-with-bom.xml │ │ │ │ │ └── utf8.xml │ │ │ └── ws │ │ │ │ └── WebServiceTest │ │ │ │ └── response-example.txt │ │ │ └── utils │ │ │ ├── UriReaderTest │ │ │ └── foo.txt │ │ │ └── ZipUtilsTest │ │ │ ├── shouldUnzipFile.zip │ │ │ ├── shouldZipDirectory │ │ │ ├── bar.txt │ │ │ ├── dir1 │ │ │ │ └── hello.properties │ │ │ └── foo.txt │ │ │ ├── zip-bomb.zip │ │ │ └── zip-slip.zip │ └── sonar │ │ └── bundles │ │ ├── PluginFoo.properties │ │ ├── PluginFoo_es.properties │ │ ├── Test.properties │ │ └── Test_fr.properties │ └── scripts │ ├── echo.bat │ ├── echo.sh │ ├── forever.bat │ ├── forever.sh │ ├── output.bat │ └── output.sh ├── settings.gradle └── test-fixtures ├── build.gradle └── src ├── main └── java │ └── org │ └── sonar │ └── api │ └── testfixtures │ ├── log │ ├── AbstractLogTester.java │ ├── ConcurrentListAppender.java │ ├── LogAndArguments.java │ ├── LogTester.java │ └── LogTesterJUnit5.java │ ├── measure │ ├── TestComponent.java │ ├── TestIssue.java │ ├── TestMeasure.java │ ├── TestMeasureComputerContext.java │ ├── TestMeasureComputerDefinition.java │ ├── TestMeasureComputerDefinitionContext.java │ └── TestSettings.java │ └── posttask │ └── PostProjectAnalysisTaskTester.java └── test └── java └── org └── sonar └── api └── testfixtures ├── log ├── LogAndArgumentsTest.java ├── LogTesterJUnit5Test.java └── LogTesterTest.java ├── measure ├── TestComponentTest.java ├── TestIssueTest.java ├── TestMeasureComputerContextTest.java ├── TestMeasureComputerDefinitionTest.java ├── TestMeasureTest.java └── TestSettingsTest.java └── posttask └── PostProjectAnalysisTaskTesterTest.java /.cirrus.star: -------------------------------------------------------------------------------- 1 | load("github.com/SonarSource/cirrus-modules@v3", "load_features") 2 | 3 | def main(ctx): 4 | return load_features(ctx) 5 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners 2 | * @sonarsource/orchestration-processing-squad 3 | -------------------------------------------------------------------------------- /.github/workflows/PullRequestClosed.yml: -------------------------------------------------------------------------------- 1 | name: Pull Request Closed 2 | 3 | on: 4 | pull_request: 5 | types: [closed] 6 | 7 | jobs: 8 | PullRequestClosed_job: 9 | name: Pull Request Closed 10 | runs-on: ubuntu-latest-large 11 | permissions: 12 | id-token: write 13 | pull-requests: read 14 | # For external PR, ticket should be moved manually 15 | if: | 16 | github.event.pull_request.head.repo.full_name == github.repository 17 | steps: 18 | - id: secrets 19 | uses: SonarSource/vault-action-wrapper@v3 20 | with: 21 | secrets: | 22 | development/kv/data/jira user | JIRA_USER; 23 | development/kv/data/jira token | JIRA_TOKEN; 24 | - uses: sonarsource/gh-action-lt-backlog/PullRequestClosed@v2 25 | with: 26 | github-token: ${{secrets.GITHUB_TOKEN}} 27 | jira-user: ${{ fromJSON(steps.secrets.outputs.vault).JIRA_USER }} 28 | jira-token: ${{ fromJSON(steps.secrets.outputs.vault).JIRA_TOKEN }} 29 | -------------------------------------------------------------------------------- /.github/workflows/PullRequestCreated.yml: -------------------------------------------------------------------------------- 1 | name: Pull Request Created 2 | 3 | on: 4 | pull_request: 5 | types: ["opened"] 6 | 7 | jobs: 8 | PullRequestCreated_job: 9 | name: Pull Request Created 10 | runs-on: ubuntu-latest-large 11 | permissions: 12 | id-token: write 13 | # For external PR, ticket should be created manually 14 | if: | 15 | github.event.pull_request.head.repo.full_name == github.repository 16 | steps: 17 | - id: secrets 18 | uses: SonarSource/vault-action-wrapper@v3 19 | with: 20 | secrets: | 21 | development/github/token/{REPO_OWNER_NAME_DASH}-jira token | GITHUB_TOKEN; 22 | development/kv/data/jira user | JIRA_USER; 23 | development/kv/data/jira token | JIRA_TOKEN; 24 | - uses: sonarsource/gh-action-lt-backlog/PullRequestCreated@v2 25 | with: 26 | github-token: ${{ fromJSON(steps.secrets.outputs.vault).GITHUB_TOKEN }} 27 | jira-user: ${{ fromJSON(steps.secrets.outputs.vault).JIRA_USER }} 28 | jira-token: ${{ fromJSON(steps.secrets.outputs.vault).JIRA_TOKEN }} 29 | jira-project: PLUGINAPI 30 | -------------------------------------------------------------------------------- /.github/workflows/RequestReview.yml: -------------------------------------------------------------------------------- 1 | name: Request review 2 | 3 | on: 4 | pull_request: 5 | types: ["review_requested"] 6 | 7 | jobs: 8 | RequestReview_job: 9 | name: Request review 10 | runs-on: ubuntu-latest-large 11 | permissions: 12 | id-token: write 13 | # For external PR, ticket should be moved manually 14 | if: | 15 | github.event.pull_request.head.repo.full_name == github.repository 16 | steps: 17 | - id: secrets 18 | uses: SonarSource/vault-action-wrapper@v3 19 | with: 20 | secrets: | 21 | development/github/token/{REPO_OWNER_NAME_DASH}-jira token | GITHUB_TOKEN; 22 | development/kv/data/jira user | JIRA_USER; 23 | development/kv/data/jira token | JIRA_TOKEN; 24 | - uses: sonarsource/gh-action-lt-backlog/RequestReview@v2 25 | with: 26 | github-token: ${{ fromJSON(steps.secrets.outputs.vault).GITHUB_TOKEN }} 27 | jira-user: ${{ fromJSON(steps.secrets.outputs.vault).JIRA_USER }} 28 | jira-token: ${{ fromJSON(steps.secrets.outputs.vault).JIRA_TOKEN }} 29 | -------------------------------------------------------------------------------- /.github/workflows/SubmitReview.yml: -------------------------------------------------------------------------------- 1 | name: Submit Review 2 | 3 | on: 4 | pull_request_review: 5 | types: [submitted] 6 | 7 | jobs: 8 | SubmitReview_job: 9 | name: Submit Review 10 | runs-on: ubuntu-latest-large 11 | permissions: 12 | id-token: write 13 | pull-requests: read 14 | # For external PR, ticket should be moved manually 15 | if: | 16 | github.event.pull_request.head.repo.full_name == github.repository 17 | && (github.event.review.state == 'changes_requested' 18 | || github.event.review.state == 'approved') 19 | steps: 20 | - id: secrets 21 | uses: SonarSource/vault-action-wrapper@v3 22 | with: 23 | secrets: | 24 | development/kv/data/jira user | JIRA_USER; 25 | development/kv/data/jira token | JIRA_TOKEN; 26 | - uses: sonarsource/gh-action-lt-backlog/SubmitReview@v2 27 | with: 28 | github-token: ${{secrets.GITHUB_TOKEN}} 29 | jira-user: ${{ fromJSON(steps.secrets.outputs.vault).JIRA_USER }} 30 | jira-token: ${{ fromJSON(steps.secrets.outputs.vault).JIRA_TOKEN }} 31 | -------------------------------------------------------------------------------- /.github/workflows/releasability.yaml: -------------------------------------------------------------------------------- 1 | # yamllint disable rule:line-length 2 | --- 3 | name: Releasability status 4 | 'on': 5 | check_suite: 6 | types: 7 | - completed 8 | jobs: 9 | update_releasability_status: 10 | runs-on: ubuntu-latest-large 11 | name: Releasability status 12 | permissions: 13 | id-token: write 14 | statuses: write 15 | contents: read 16 | if: >- 17 | (contains(fromJSON('["main", "master"]'), github.event.check_suite.head_branch) || startsWith(github.event.check_suite.head_branch, 'dogfood-') || startsWith(github.event.check_suite.head_branch, 'branch-')) 18 | && github.event.check_suite.conclusion == 'success' 19 | && github.event.check_suite.app.slug == 'cirrus-ci' 20 | steps: 21 | - uses: SonarSource/gh-action_releasability/releasability-status@2.1.2 22 | with: 23 | optional_checks: "Jira" 24 | env: 25 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 26 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: sonar-release 2 | 3 | on: 4 | release: 5 | types: 6 | - published 7 | 8 | jobs: 9 | release: 10 | permissions: 11 | id-token: write 12 | contents: write 13 | uses: SonarSource/gh-action_release/.github/workflows/main.yaml@v5 14 | with: 15 | publishToBinaries: true 16 | mavenCentralSync: true 17 | slackChannel: ops-analysis-experience 18 | publishJavadoc: true 19 | publicRelease: true 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # ---- Maven 2 | target/ 3 | 4 | # ---- IntelliJ IDEA 5 | *.iws 6 | *.iml 7 | *.ipr 8 | .idea/ 9 | 10 | # ---- Eclipse 11 | .classpath 12 | .project 13 | .settings 14 | 15 | # ---- Mac OS X 16 | .DS_Store? 17 | Icon? 18 | # Thumbnails 19 | ._* 20 | # Files that might appear on external disk 21 | .Spotlight-V100 22 | .Trashes 23 | 24 | # ---- Windows 25 | # Windows image file caches 26 | Thumbs.db 27 | # Folder config file 28 | Desktop.ini 29 | 30 | # ---- Gradle 31 | .gradle 32 | build/ 33 | out/ 34 | /bin/ 35 | -------------------------------------------------------------------------------- /HEADER: -------------------------------------------------------------------------------- 1 | Sonar Plugin API 2 | Copyright (C) 2009-2025 SonarSource SA 3 | mailto:info AT sonarsource DOT com 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 3 of the License, or (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this program; if not, write to the Free Software Foundation, 17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Reporting Security Issues 2 | 3 | A mature software vulnerability treatment process is a cornerstone of a robust information security management system. Contributions from the community play an important role in the evolution and security of our products, and in safeguarding the security and privacy of our users. 4 | 5 | If you believe you have discovered a security vulnerability in Sonar's products, we encourage you to report it immediately. 6 | 7 | To responsibly report a security issue, please email us at [security@sonarsource.com](mailto:security@sonarsource.com). Sonar’s security team will acknowledge your report, guide you through the next steps, or request additional information if necessary. Customers with a support contract can also report the vulnerability directly through the support channel. 8 | 9 | For security vulnerabilities found in third-party libraries, please also contact the library's owner or maintainer directly. 10 | 11 | ## Responsible Disclosure Policy 12 | 13 | For more information about disclosing a security vulnerability to Sonar, please refer to our community post: [Responsible Vulnerability Disclosure](https://community.sonarsource.com/t/responsible-vulnerability-disclosure/9317). -------------------------------------------------------------------------------- /check-api/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compileOnly libs.jsr305 3 | } 4 | -------------------------------------------------------------------------------- /check-api/src/main/java/org/sonar/check/BelongsToProfile.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.check; 21 | 22 | import java.lang.annotation.ElementType; 23 | import java.lang.annotation.Retention; 24 | import java.lang.annotation.RetentionPolicy; 25 | import java.lang.annotation.Target; 26 | 27 | /** 28 | * @since 2.1 29 | */ 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Target(ElementType.TYPE) 32 | public @interface BelongsToProfile { 33 | 34 | String title(); 35 | 36 | Priority priority(); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /check-api/src/main/java/org/sonar/check/Cardinality.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.check; 21 | 22 | /** 23 | * @since 2.3 24 | * @deprecated since 4.4 25 | */ 26 | @Deprecated 27 | public enum Cardinality { 28 | SINGLE, MULTIPLE 29 | } 30 | -------------------------------------------------------------------------------- /check-api/src/main/java/org/sonar/check/Message.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.check; 21 | 22 | import java.util.Locale; 23 | 24 | /** 25 | * @deprecated in 2.3 26 | */ 27 | @Deprecated 28 | public interface Message { 29 | 30 | Object getChecker(); 31 | 32 | Integer getLine(); 33 | 34 | String getText(Locale locale); 35 | } 36 | -------------------------------------------------------------------------------- /check-api/src/main/java/org/sonar/check/Priority.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.check; 21 | 22 | public enum Priority { 23 | /** 24 | * WARNING : DO NOT CHANGE THE ENUMERATION ORDER 25 | * the enum ordinal is used for db persistence 26 | */ 27 | INFO, MINOR, MAJOR, CRITICAL, BLOCKER 28 | } 29 | -------------------------------------------------------------------------------- /check-api/src/main/java/org/sonar/check/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.check; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | group=org.sonarsource.api.plugin 2 | version=12.1-SNAPSHOT 3 | description=Plugin API for SonarQube, SonarCloud and SonarLint 4 | org.gradle.jvmargs=-Xmx2048m 5 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSource/sonar-plugin-api/993f9bc9c6c7b671e0a8a14fdf4fb88c7b91e1ae/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/ExtensionPoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api; 21 | 22 | import java.lang.annotation.Documented; 23 | import java.lang.annotation.ElementType; 24 | import java.lang.annotation.Retention; 25 | import java.lang.annotation.RetentionPolicy; 26 | import java.lang.annotation.Target; 27 | 28 | /** 29 | * Marker annotation for all the interfaces that are extension point (ie can be implemented by plugins 30 | * and will be called at some point of time by the platform). 31 | * 32 | * @since 5.2 33 | */ 34 | @Documented 35 | @Retention(RetentionPolicy.RUNTIME) 36 | @Target(ElementType.TYPE) 37 | public @interface ExtensionPoint { 38 | } 39 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/SonarEdition.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api; 21 | 22 | public enum SonarEdition { 23 | COMMUNITY("Community"), 24 | DEVELOPER("Developer"), 25 | ENTERPRISE("Enterprise"), 26 | DATACENTER("Data Center"), 27 | SONARCLOUD("SonarCloud"); 28 | 29 | private final String label; 30 | 31 | SonarEdition(String label) { 32 | this.label = label; 33 | } 34 | 35 | public String getLabel() { 36 | return label; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/SonarProduct.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api; 21 | 22 | /** 23 | * List of different products/runtimes. 24 | * @since 6.0 25 | */ 26 | public enum SonarProduct { 27 | 28 | SONARQUBE, 29 | SONARLINT 30 | 31 | } 32 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/SonarQubeSide.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api; 21 | 22 | /** 23 | * Runtime stack in SonarQube product. 24 | * @see SonarRuntime#getSonarQubeSide() 25 | * @since 6.0 26 | */ 27 | public enum SonarQubeSide { 28 | 29 | SCANNER, 30 | SERVER, 31 | COMPUTE_ENGINE 32 | 33 | } 34 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/DependedUpon.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch; 21 | 22 | import java.lang.annotation.ElementType; 23 | import java.lang.annotation.Retention; 24 | import java.lang.annotation.RetentionPolicy; 25 | import java.lang.annotation.Target; 26 | 27 | /** 28 | * @since 1.10 29 | */ 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Target({ElementType.TYPE, ElementType.METHOD}) 32 | public @interface DependedUpon { 33 | 34 | /** 35 | * Used only on classes. Must be keep empty on methods. 36 | * 37 | * @see org.sonar.api.batch.DecoratorBarriers for a list of possible values. 38 | */ 39 | String[] value() default {}; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/DependsUpon.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch; 21 | 22 | import java.lang.annotation.ElementType; 23 | import java.lang.annotation.Retention; 24 | import java.lang.annotation.RetentionPolicy; 25 | import java.lang.annotation.Target; 26 | 27 | /** 28 | * @since 1.10 29 | */ 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Target({ElementType.TYPE, ElementType.METHOD}) 32 | public @interface DependsUpon { 33 | 34 | /** 35 | * Used only on classes. Must be keep empty on methods. 36 | */ 37 | String[] value() default {}; 38 | } 39 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/Phase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch; 21 | 22 | import java.lang.annotation.ElementType; 23 | import java.lang.annotation.Retention; 24 | import java.lang.annotation.RetentionPolicy; 25 | import java.lang.annotation.Target; 26 | 27 | /** 28 | * @since 1.10 29 | */ 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Target(ElementType.TYPE) 32 | public @interface Phase { 33 | 34 | Name name(); 35 | 36 | enum Name { 37 | PRE, DEFAULT, POST 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/bootstrap/internal/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.batch.bootstrap.internal; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/bootstrap/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.batch.bootstrap; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/fs/FilePredicate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.fs; 21 | 22 | /** 23 | * Determines if a file must be kept in search results. See {@link org.sonar.api.batch.fs.FileSystem} 24 | * and {@link org.sonar.api.batch.fs.FilePredicates}. 25 | * @since 4.2 26 | */ 27 | public interface FilePredicate { 28 | /** 29 | * Test if provided file is valid for this predicate 30 | */ 31 | boolean apply(InputFile inputFile); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/fs/InputComponent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.fs; 21 | 22 | /** 23 | * Common interface for all input components. 24 | * 25 | * @since 5.2 26 | * @see InputFile 27 | * @see InputDir 28 | * @see InputModule 29 | * @see org.sonar.api.scanner.fs.InputProject 30 | */ 31 | public interface InputComponent { 32 | 33 | /** 34 | * Component key shared by all part of SonarQube (scanner, server, WS...). 35 | * It doesn't include the branch. 36 | * Warning. Do not use in SonarLint. 37 | */ 38 | String key(); 39 | 40 | /** 41 | * Is the component an {@link InputFile} 42 | */ 43 | boolean isFile(); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/fs/InputFileFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.fs; 21 | 22 | import org.sonar.api.ExtensionPoint; 23 | import org.sonar.api.scanner.ScannerSide; 24 | import org.sonarsource.api.sonarlint.SonarLintSide; 25 | 26 | /** 27 | * Extension point to exclude some files from inspection 28 | * @since 4.2 29 | * @since 7.6 evaluated at project level 30 | */ 31 | @ScannerSide 32 | @SonarLintSide 33 | @ExtensionPoint 34 | @FunctionalInterface 35 | public interface InputFileFilter { 36 | 37 | boolean accept(InputFile f); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/fs/InputModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.fs; 21 | 22 | 23 | import javax.annotation.concurrent.Immutable; 24 | 25 | import org.sonar.api.batch.sensor.SensorContext; 26 | 27 | /** 28 | * Used to create issues and measures on modules. You can access InputModule using {@link SensorContext#module()} 29 | * 30 | * @since 5.2 31 | * @deprecated since 7.6 modules are deprecated. Use {@link org.sonar.api.scanner.fs.InputProject} instead. 32 | */ 33 | @Deprecated 34 | @Immutable 35 | public interface InputModule extends InputComponent { 36 | } 37 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/fs/TextPointer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.fs; 21 | 22 | /** 23 | * Represents a position in a text file {@link InputFile} 24 | * 25 | * @since 5.2 26 | */ 27 | public interface TextPointer extends Comparable { 28 | 29 | /** 30 | * The logical line where this pointer is located. First line is 1. 31 | */ 32 | int line(); 33 | 34 | /** 35 | * The offset of this pointer in the current line. First position in a line is 0. 36 | */ 37 | int lineOffset(); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/fs/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.batch.fs; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | 25 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/measure/Metric.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.measure; 21 | 22 | import java.io.Serializable; 23 | 24 | /** 25 | * @since 4.4 26 | */ 27 | public interface Metric { 28 | 29 | String key(); 30 | 31 | Class valueType(); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/measure/MetricFinder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.measure; 21 | 22 | import java.io.Serializable; 23 | import java.util.Collection; 24 | import java.util.List; 25 | import javax.annotation.CheckForNull; 26 | import javax.annotation.concurrent.ThreadSafe; 27 | 28 | import org.sonar.api.scanner.ScannerSide; 29 | 30 | /** 31 | * @since 4.5 32 | */ 33 | @ScannerSide 34 | @ThreadSafe 35 | public interface MetricFinder { 36 | 37 | @CheckForNull 38 | Metric findByKey(String key); 39 | 40 | Collection> findAll(List metricKeys); 41 | 42 | Collection> findAll(); 43 | } 44 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/measure/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @javax.annotation.ParametersAreNonnullByDefault 21 | package org.sonar.api.batch.measure; 22 | 23 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @javax.annotation.ParametersAreNonnullByDefault 21 | package org.sonar.api.batch; 22 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/postjob/PostJobContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.postjob; 21 | 22 | import org.sonar.api.config.Configuration; 23 | 24 | /** 25 | * See {@link PostJob#execute(PostJobContext)} 26 | * @since 5.2 27 | */ 28 | public interface PostJobContext { 29 | 30 | /** 31 | * Get configuration of the current project. 32 | * @since 6.5 33 | */ 34 | Configuration config(); 35 | } 36 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/postjob/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @javax.annotation.ParametersAreNonnullByDefault 21 | package org.sonar.api.batch.postjob; 22 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/rule/CheckFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.rule; 21 | 22 | import org.sonar.api.scanner.ScannerSide; 23 | 24 | /** 25 | * Creates {@link org.sonar.api.batch.rule.Checks}. This class is available 26 | * by dependency injection. It must not be extended by plugins. 27 | * 28 | * @since 4.2 29 | */ 30 | @ScannerSide 31 | public class CheckFactory { 32 | 33 | private final ActiveRules activeRules; 34 | 35 | public CheckFactory(ActiveRules activeRules) { 36 | this.activeRules = activeRules; 37 | } 38 | 39 | public Checks create(String repository) { 40 | return new Checks<>(activeRules, repository); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/rule/Rule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.rule; 21 | 22 | import java.util.Collection; 23 | import javax.annotation.CheckForNull; 24 | import org.sonar.api.rule.RuleKey; 25 | import org.sonar.api.rule.RuleStatus; 26 | 27 | /** 28 | * @since 4.2 29 | */ 30 | public interface Rule { 31 | 32 | RuleKey key(); 33 | 34 | String name(); 35 | 36 | @CheckForNull 37 | String description(); 38 | 39 | @CheckForNull 40 | String internalKey(); 41 | 42 | String severity(); 43 | 44 | @CheckForNull 45 | RuleParam param(String paramKey); 46 | 47 | Collection params(); 48 | 49 | RuleStatus status(); 50 | } 51 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/rule/RuleParam.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.rule; 21 | 22 | import javax.annotation.concurrent.Immutable; 23 | 24 | /** 25 | * @since 4.2 26 | */ 27 | @Immutable 28 | public interface RuleParam { 29 | String key(); 30 | 31 | String description(); 32 | } 33 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/rule/Severity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.rule; 21 | 22 | /** 23 | * @since 5.2 24 | */ 25 | public enum Severity { 26 | INFO, 27 | MINOR, 28 | MAJOR, 29 | CRITICAL, 30 | BLOCKER 31 | } 32 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/rule/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.batch.rule; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/scm/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.batch.scm; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | 25 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/sensor/cache/ReadCache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.sensor.cache; 21 | 22 | import java.io.InputStream; 23 | import org.sonar.api.Beta; 24 | 25 | @Beta 26 | public interface ReadCache { 27 | /** 28 | * Returns an input stream for the data cached with the key. 29 | * It's the responsibility of the caller to close the stream. 30 | * @throws IllegalArgumentException if cache doesn't contain key 31 | */ 32 | InputStream read(String key); 33 | 34 | /** 35 | * Checks whether the cache contains a key 36 | */ 37 | boolean contains(String key); 38 | } 39 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/sensor/cache/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @javax.annotation.ParametersAreNonnullByDefault 21 | package org.sonar.api.batch.sensor.cache; 22 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/sensor/code/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @javax.annotation.ParametersAreNonnullByDefault 21 | package org.sonar.api.batch.sensor.code; 22 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/sensor/coverage/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @javax.annotation.ParametersAreNonnullByDefault 21 | package org.sonar.api.batch.sensor.coverage; 22 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/internal/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @javax.annotation.ParametersAreNonnullByDefault 21 | package org.sonar.api.batch.sensor.cpd.internal; 22 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/sensor/cpd/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @javax.annotation.ParametersAreNonnullByDefault 21 | package org.sonar.api.batch.sensor.cpd; 22 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/sensor/error/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @javax.annotation.ParametersAreNonnullByDefault 21 | package org.sonar.api.batch.sensor.error; 22 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/sensor/highlighting/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @javax.annotation.ParametersAreNonnullByDefault 21 | package org.sonar.api.batch.sensor.highlighting; 22 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/sensor/internal/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @javax.annotation.ParametersAreNonnullByDefault 21 | package org.sonar.api.batch.sensor.internal; 22 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/IIssue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.sensor.issue; 21 | 22 | import java.util.List; 23 | import org.sonar.api.batch.sensor.issue.Issue.Flow; 24 | import org.sonar.api.rule.RuleKey; 25 | 26 | /** 27 | * @since 7.2 28 | */ 29 | public interface IIssue { 30 | /** 31 | * The {@link RuleKey} of this issue. 32 | */ 33 | RuleKey ruleKey(); 34 | 35 | /** 36 | * Primary locations for this issue. 37 | */ 38 | IssueLocation primaryLocation(); 39 | 40 | /** 41 | * List of flows for this issue. Can be empty. 42 | */ 43 | List flows(); 44 | } 45 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/MessageFormatting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.sensor.issue; 21 | 22 | /** 23 | * Represents the data of the formatted part of the text in the issue message 24 | * @since 9.13 25 | */ 26 | public interface MessageFormatting { 27 | 28 | enum Type { 29 | CODE 30 | } 31 | 32 | /** 33 | * The index of the first character in the string that will be formatted 34 | */ 35 | int start(); 36 | 37 | /** 38 | * The index of the last character in the string that will be formatted 39 | */ 40 | int end(); 41 | 42 | /** 43 | * Type of the text that will be formatted 44 | */ 45 | Type type(); 46 | } 47 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/fix/InputFileEdit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.sensor.issue.fix; 21 | 22 | import java.util.List; 23 | import org.sonar.api.batch.fs.InputFile; 24 | 25 | /** 26 | * Represents a file edit for a {@link QuickFix} as a collection of {@link TextEdit}s on a given {@link InputFile}. 27 | * @since 9.13 28 | */ 29 | public interface InputFileEdit { 30 | 31 | /** 32 | * @return the file on which to apply the {@link #textEdits()} 33 | */ 34 | InputFile target(); 35 | 36 | /** 37 | * @return the list of text edits to apply in this {@link #target()} 38 | */ 39 | List textEdits(); 40 | } 41 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/fix/QuickFix.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.sensor.issue.fix; 21 | 22 | 23 | import java.util.List; 24 | 25 | /** 26 | * Represents a quick fix for an {@link org.sonar.api.batch.sensor.issue.Issue}, with a description and a collection of {@link InputFileEdit}. 27 | * @since 9.13 28 | */ 29 | public interface QuickFix { 30 | 31 | /** 32 | * @return the message for this quick fix, which will be shown to the user as an action item. 33 | */ 34 | String message(); 35 | 36 | /** 37 | * Create a new input file edit 38 | * @return the list of input file edits for this quick fix 39 | */ 40 | List inputFileEdits(); 41 | } 42 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/fix/TextEdit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.sensor.issue.fix; 21 | 22 | import org.sonar.api.batch.fs.TextRange; 23 | 24 | /** 25 | * Represents a text edit, composed of a replacement text and the text range to replace 26 | * @since 9.13 27 | */ 28 | public interface TextEdit { 29 | 30 | /** 31 | * @return the range on which to apply this edit 32 | */ 33 | TextRange range(); 34 | 35 | /** 36 | * @return the replacement text 37 | */ 38 | String newText(); 39 | } 40 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/fix/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @javax.annotation.ParametersAreNonnullByDefault 21 | package org.sonar.api.batch.sensor.issue.fix; 22 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @javax.annotation.ParametersAreNonnullByDefault 21 | package org.sonar.api.batch.sensor.issue; 22 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @javax.annotation.ParametersAreNonnullByDefault 21 | package org.sonar.api.batch.sensor.measure; 22 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/sensor/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @javax.annotation.ParametersAreNonnullByDefault 21 | package org.sonar.api.batch.sensor; 22 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/sensor/rule/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @javax.annotation.ParametersAreNonnullByDefault 21 | package org.sonar.api.batch.sensor.rule; 22 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/batch/sensor/symbol/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @javax.annotation.ParametersAreNonnullByDefault 21 | package org.sonar.api.batch.sensor.symbol; 22 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/ce/ComputeEngineSide.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.ce; 21 | 22 | import java.lang.annotation.Documented; 23 | import java.lang.annotation.ElementType; 24 | import java.lang.annotation.Retention; 25 | import java.lang.annotation.RetentionPolicy; 26 | import java.lang.annotation.Target; 27 | import org.sonar.api.scanner.ScannerSide; 28 | 29 | /** 30 | * Same as {@link ScannerSide} but for components for the Compute Engine Server. 31 | * 32 | * @since 5.5 33 | */ 34 | @Documented 35 | @Retention(RetentionPolicy.RUNTIME) 36 | @Target(ElementType.TYPE) 37 | public @interface ComputeEngineSide { 38 | } 39 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/ce/measure/Settings.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.ce.measure; 21 | 22 | import javax.annotation.CheckForNull; 23 | 24 | /** 25 | * Settings of the current component used in {@link MeasureComputer} 26 | * 27 | * @since 5.2 28 | */ 29 | public interface Settings { 30 | 31 | /** 32 | * Returns the property as a string 33 | * Matching on key is case sensitive 34 | */ 35 | @CheckForNull 36 | String getString(String key); 37 | 38 | /** 39 | * Returns the property as a an array 40 | * Returns an empty array if no property is found for this key 41 | * Matching on key is case sensitive 42 | */ 43 | String[] getStringArray(String key); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/ce/measure/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.ce.measure; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/ce/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.ce; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/ce/posttask/Analysis.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.ce.posttask; 21 | 22 | import java.util.Date; 23 | import java.util.Optional; 24 | 25 | public interface Analysis { 26 | /** 27 | * UUID of the analysis 28 | */ 29 | String getAnalysisUuid(); 30 | 31 | /** 32 | * Date of the analysis. 33 | */ 34 | Date getDate(); 35 | 36 | /** 37 | * SCM revision, if declared during analysis 38 | * @since 7.8 39 | */ 40 | Optional getRevision(); 41 | } 42 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/ce/posttask/Branch.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.ce.posttask; 21 | 22 | import java.util.Optional; 23 | 24 | /** 25 | * @since 6.6 26 | */ 27 | public interface Branch { 28 | 29 | enum Type { 30 | BRANCH, PULL_REQUEST 31 | } 32 | 33 | boolean isMain(); 34 | 35 | Optional getName(); 36 | 37 | Type getType(); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/ce/posttask/CeTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.ce.posttask; 21 | 22 | /** 23 | * @since 5.5 24 | */ 25 | public interface CeTask { 26 | /** 27 | * Id of the Compute Engine task. 28 | *

29 | * This is the id under which the processing of the project analysis report has been added to the Compute Engine 30 | * queue. 31 | * 32 | */ 33 | String getId(); 34 | 35 | /** 36 | * Indicates whether the Compute Engine task ended successfully or not. 37 | */ 38 | Status getStatus(); 39 | 40 | enum Status { 41 | SUCCESS, FAILED 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/ce/posttask/Organization.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.ce.posttask; 21 | 22 | public interface Organization { 23 | String getName(); 24 | 25 | String getKey(); 26 | } 27 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/ce/posttask/Project.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.ce.posttask; 21 | 22 | /** 23 | * @since 5.5 24 | */ 25 | public interface Project { 26 | /** 27 | * The UUID of the project. 28 | */ 29 | String getUuid(); 30 | 31 | /** 32 | * The key of the project. 33 | */ 34 | String getKey(); 35 | 36 | /** 37 | * The name of the project. 38 | */ 39 | String getName(); 40 | } 41 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/ce/posttask/ScannerContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.ce.posttask; 21 | 22 | import java.util.Map; 23 | 24 | /** 25 | * @since 6.1 26 | */ 27 | public interface ScannerContext { 28 | 29 | /** 30 | * @return immutable map of properties sent by scanner 31 | */ 32 | Map getProperties(); 33 | } 34 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/ce/posttask/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.ce.posttask; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/config/SubCategory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.config; 21 | 22 | /** 23 | * @since 3.7 24 | */ 25 | public class SubCategory extends Category { 26 | 27 | SubCategory(String originalKey) { 28 | super(originalKey); 29 | } 30 | 31 | SubCategory(String originalKey, boolean special) { 32 | super(originalKey, special); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/config/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.config; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/issue/impact/Severity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.issue.impact; 21 | 22 | public enum Severity { 23 | INFO, 24 | LOW, 25 | MEDIUM, 26 | HIGH, 27 | BLOCKER 28 | } 29 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/issue/impact/SoftwareQuality.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.issue.impact; 21 | 22 | public enum SoftwareQuality { 23 | MAINTAINABILITY, 24 | RELIABILITY, 25 | SECURITY 26 | } 27 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/issue/impact/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.issue.impact; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | 25 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/issue/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.issue; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/measures/FileLinesContextFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.measures; 21 | 22 | import org.sonar.api.scanner.ScannerSide; 23 | import org.sonar.api.batch.fs.InputFile; 24 | 25 | /** 26 | *

This interface is not intended to be implemented by clients. 27 | * 28 | * @since 2.14 29 | */ 30 | @ScannerSide 31 | public interface FileLinesContextFactory { 32 | 33 | /** 34 | * @since 4.2 35 | */ 36 | FileLinesContext createFor(InputFile inputFile); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/measures/Metrics.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.measures; 21 | 22 | import java.util.List; 23 | import org.sonar.api.ExtensionPoint; 24 | import org.sonar.api.ce.ComputeEngineSide; 25 | import org.sonar.api.scanner.ScannerSide; 26 | import org.sonar.api.server.ServerSide; 27 | 28 | /** 29 | * This is the extension point used by plugins to declare new metrics. 30 | * @since 1.10 31 | */ 32 | @ScannerSide 33 | @ServerSide 34 | @ComputeEngineSide 35 | @ExtensionPoint 36 | public interface Metrics { 37 | List getMetrics(); 38 | } 39 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/measures/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.measures; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | 25 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/notifications/AnalysisWarnings.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.notifications; 21 | 22 | import org.sonar.api.scanner.ScannerSide; 23 | 24 | /** 25 | * Record user-friendly warnings that will be visible on SonarQube 26 | * to users with browse access to the project. 27 | * 28 | * @since 7.4 29 | */ 30 | @ScannerSide 31 | public interface AnalysisWarnings { 32 | 33 | /** 34 | * Add a single message, if it was not already added. 35 | */ 36 | void addUnique(String text); 37 | } 38 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/notifications/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.notifications; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/platform/ServerFileSystem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.platform; 21 | 22 | import java.io.File; 23 | import org.sonar.api.ce.ComputeEngineSide; 24 | import org.sonar.api.server.ServerSide; 25 | 26 | /** 27 | * @since 2.3 28 | */ 29 | @ServerSide 30 | @ComputeEngineSide 31 | public interface ServerFileSystem { 32 | 33 | /** 34 | * Root directory of the server installation 35 | * @return an existing directory 36 | */ 37 | File getHomeDir(); 38 | 39 | /** 40 | * Temporary directory, clean up on restarts 41 | * @return an existing directory 42 | */ 43 | File getTempDir(); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/platform/ServerStartHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.platform; 21 | 22 | import org.sonar.api.ExtensionPoint; 23 | import org.sonar.api.ce.ComputeEngineSide; 24 | import org.sonar.api.server.ServerSide; 25 | 26 | /** 27 | * @since 2.2 28 | */ 29 | @ServerSide 30 | @ComputeEngineSide 31 | @ExtensionPoint 32 | public interface ServerStartHandler { 33 | 34 | void onServerStart(Server server); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/platform/ServerStopHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.platform; 21 | 22 | import org.sonar.api.ExtensionPoint; 23 | import org.sonar.api.ce.ComputeEngineSide; 24 | import org.sonar.api.server.ServerSide; 25 | 26 | /** 27 | * @since 2.2 28 | */ 29 | @ServerSide 30 | @ComputeEngineSide 31 | @ExtensionPoint 32 | public interface ServerStopHandler { 33 | 34 | void onServerStop(Server server); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/platform/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.platform; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/resources/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.resources; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/rule/RuleScope.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.rule; 21 | 22 | /** 23 | * @since 7.1 24 | * 25 | */ 26 | public enum RuleScope { 27 | MAIN, TEST, ALL; 28 | 29 | public static RuleScope defaultScope() { 30 | return MAIN; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/rule/RuleStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.rule; 21 | 22 | /** 23 | * @since 4.2 24 | */ 25 | public enum RuleStatus { 26 | BETA, DEPRECATED, READY, REMOVED; 27 | 28 | public static RuleStatus defaultStatus() { 29 | return READY; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/rule/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.rule; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/rules/CleanCodeAttributeCategory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.rules; 21 | 22 | public enum CleanCodeAttributeCategory { 23 | ADAPTABLE, 24 | CONSISTENT, 25 | INTENTIONAL, 26 | RESPONSIBLE; 27 | } 28 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/rules/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.rules; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/scan/filesystem/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | /** 21 | * Replaced by {@link org.sonar.api.batch.fs} 22 | */ 23 | @ParametersAreNonnullByDefault 24 | package org.sonar.api.scan.filesystem; 25 | 26 | import javax.annotation.ParametersAreNonnullByDefault; 27 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/scan/issue/filter/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.scan.issue.filter; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/scanner/fs/InputProject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.scanner.fs; 21 | 22 | 23 | import javax.annotation.concurrent.Immutable; 24 | import org.sonar.api.batch.fs.InputComponent; 25 | import org.sonar.api.batch.sensor.SensorContext; 26 | 27 | /** 28 | * Used to create issues and measures on project. You can access InputProject using {@link SensorContext#project()} 29 | * 30 | * @since 7.6 31 | */ 32 | @Immutable 33 | public interface InputProject extends InputComponent { 34 | } 35 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/scanner/fs/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @javax.annotation.ParametersAreNonnullByDefault 21 | package org.sonar.api.scanner.fs; 22 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/scanner/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @javax.annotation.ParametersAreNonnullByDefault 21 | package org.sonar.api.scanner; 22 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/scanner/sensor/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @javax.annotation.ParametersAreNonnullByDefault 21 | package org.sonar.api.scanner.sensor; 22 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/security/DefaultGroups.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.security; 21 | 22 | import javax.annotation.Nullable; 23 | 24 | /** 25 | * Name of the default user groups 26 | * 27 | * @since 3.2 28 | */ 29 | public final class DefaultGroups { 30 | 31 | public static final String ANYONE = "Anyone"; 32 | public static final String ADMINISTRATORS = "sonar-administrators"; 33 | public static final String USERS = "sonar-users"; 34 | 35 | private DefaultGroups() { 36 | // only statics 37 | } 38 | 39 | public static boolean isAnyone(@Nullable String groupName) { 40 | return ANYONE.equalsIgnoreCase(groupName); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/security/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.security; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/server/ServerSide.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.server; 21 | 22 | import java.lang.annotation.Documented; 23 | import java.lang.annotation.ElementType; 24 | import java.lang.annotation.Retention; 25 | import java.lang.annotation.RetentionPolicy; 26 | import java.lang.annotation.Target; 27 | import org.sonar.api.scanner.ScannerSide; 28 | 29 | /** 30 | * Same as {@link ScannerSide} but for server-side components. 31 | * 32 | * @since 5.2 33 | */ 34 | @Documented 35 | @Retention(RetentionPolicy.RUNTIME) 36 | @Target(ElementType.TYPE) 37 | public @interface ServerSide { 38 | } 39 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/server/authentication/UnauthorizedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.server.authentication; 21 | 22 | /** 23 | * This exception should be used when a functional error is generated by an Identity Provider plugin. 24 | * The user will be redirected to an unauthorized page and the exception's message will be displayed in the UI. 25 | * 26 | * @since 5.5 27 | */ 28 | public class UnauthorizedException extends RuntimeException { 29 | 30 | public UnauthorizedException(String message) { 31 | super(message); 32 | } 33 | 34 | public UnauthorizedException(String message, Throwable cause) { 35 | super(message, cause); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/server/authentication/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.server.authentication; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/server/debt/internal/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.server.debt.internal; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/server/debt/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.server.debt; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/server/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.server; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/server/profile/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.server.profile; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/server/rule/ContextAwareRuleDescriptionSection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.server.rule; 21 | 22 | import java.util.Optional; 23 | 24 | import static java.util.Objects.requireNonNull; 25 | 26 | class ContextAwareRuleDescriptionSection extends DefaultRuleDescriptionSection { 27 | 28 | private final Context context; 29 | 30 | ContextAwareRuleDescriptionSection(String key, Context context, String htmlContent) { 31 | super(key, htmlContent); 32 | requireNonNull(context, "context must be provided"); 33 | this.context = context; 34 | } 35 | 36 | @Override 37 | public Optional getContext() { 38 | return Optional.of(context); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/server/rule/internal/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.server.rule.internal; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/server/rule/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.server.rule; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/server/ws/Change.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.server.ws; 21 | 22 | import javax.annotation.concurrent.Immutable; 23 | 24 | /** 25 | * Used to describe the changes that occurred on a web service action 26 | * 27 | * @since 6.4 28 | */ 29 | @Immutable 30 | public class Change { 31 | private final String version; 32 | private final String description; 33 | 34 | public Change(String version, String description) { 35 | this.version = version; 36 | this.description = description; 37 | } 38 | 39 | public String getVersion() { 40 | return version; 41 | } 42 | 43 | public String getDescription() { 44 | return description; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/server/ws/Definable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.server.ws; 21 | 22 | public interface Definable { 23 | 24 | void define(T context); 25 | } 26 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/server/ws/RequestHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.server.ws; 21 | 22 | import org.sonar.api.ExtensionPoint; 23 | import org.sonar.api.server.ServerSide; 24 | 25 | /** 26 | * Extension point to execute a HTTP request. 27 | * @since 4.2 28 | * @see WebService 29 | */ 30 | @ServerSide 31 | @ExtensionPoint 32 | public interface RequestHandler { 33 | 34 | void handle(Request request, Response response) throws Exception; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/server/ws/impl/PartImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.server.ws.impl; 21 | 22 | import java.io.InputStream; 23 | import org.sonar.api.server.ws.Request; 24 | 25 | public class PartImpl implements Request.Part { 26 | 27 | private final InputStream inputStream; 28 | private final String fileName; 29 | 30 | public PartImpl(InputStream inputStream, String fileName) { 31 | this.inputStream = inputStream; 32 | this.fileName = fileName; 33 | } 34 | 35 | @Override 36 | public InputStream getInputStream() { 37 | return inputStream; 38 | } 39 | 40 | @Override 41 | public String getFileName() { 42 | return fileName; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/server/ws/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.server.ws; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | 25 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/user/User.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.user; 21 | 22 | import java.io.Serializable; 23 | 24 | /** 25 | * @since 3.6 26 | */ 27 | public interface User extends Serializable { 28 | String login(); 29 | String name(); 30 | String email(); 31 | boolean active(); 32 | } 33 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/user/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.user; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/utils/command/CommandException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.utils.command; 21 | 22 | public class CommandException extends RuntimeException { 23 | 24 | private final transient Command command; 25 | 26 | public CommandException(Command command, String message, Throwable throwable) { 27 | super(message + " [command: " + command + "]", throwable); 28 | this.command = command; 29 | } 30 | 31 | public CommandException(Command command, Throwable throwable) { 32 | super(throwable); 33 | this.command = command; 34 | } 35 | 36 | public Command getCommand() { 37 | return command; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/utils/command/StreamConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.utils.command; 21 | 22 | @FunctionalInterface 23 | public interface StreamConsumer { 24 | 25 | void consumeLine(String line); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/utils/command/StringStreamConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.utils.command; 21 | 22 | /** 23 | * @since 5.0 24 | */ 25 | public class StringStreamConsumer implements StreamConsumer { 26 | private StringBuilder string = new StringBuilder(); 27 | 28 | private String ls = System.getProperty("line.separator"); 29 | 30 | @Override 31 | public void consumeLine(String line) { 32 | string.append(line + ls); 33 | } 34 | 35 | public String getOutput() { 36 | return string.toString(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/utils/command/TimeoutException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.utils.command; 21 | 22 | /** 23 | * Unchecked version of {@link java.util.concurrent.TimeoutException} 24 | * 25 | * @since 4.4 26 | */ 27 | public class TimeoutException extends CommandException { 28 | 29 | public TimeoutException(Command command, String message, Throwable throwable) { 30 | super(command, message, throwable); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/utils/command/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.utils.command; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | 25 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/utils/dag/CyclicDependenciesException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.utils.dag; 21 | 22 | import org.sonar.api.utils.SonarException; 23 | 24 | /** 25 | * @since 1.10 26 | */ 27 | public class CyclicDependenciesException extends SonarException { 28 | public CyclicDependenciesException(String s) { 29 | super(s); 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/utils/dag/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.utils.dag; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | 25 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/utils/log/LoggerLevel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.utils.log; 21 | 22 | /** 23 | * @deprecated since 9.15 in favor of {@link org.slf4j.event.Level} 24 | */ 25 | @Deprecated(since = "9.15") 26 | public enum LoggerLevel { 27 | TRACE, 28 | DEBUG, 29 | INFO, 30 | WARN, 31 | ERROR; 32 | } 33 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/utils/log/Loggers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.utils.log; 21 | 22 | import org.slf4j.LoggerFactory; 23 | 24 | /** 25 | * @deprecated since 9.15 in favor of {@link org.slf4j.LoggerFactory} 26 | */ 27 | @Deprecated(since = "9.15") 28 | public abstract class Loggers { 29 | 30 | public static Logger get(Class aClass) { 31 | return new Slf4jLogger(LoggerFactory.getLogger(aClass)); 32 | } 33 | 34 | public static Logger get(String name) { 35 | return new Slf4jLogger(LoggerFactory.getLogger(name)); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/utils/log/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.utils.log; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | 25 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/utils/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.utils; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | 25 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/utils/text/WriterException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.utils.text; 21 | 22 | /** 23 | * @since 4.2 24 | */ 25 | public class WriterException extends RuntimeException { 26 | 27 | public WriterException(String message) { 28 | super(message); 29 | } 30 | 31 | public WriterException(String message, Throwable cause) { 32 | super(message, cause); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/utils/text/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.utils.text; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | 25 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/web/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.web; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonar/api/web/page/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonar.api.web.page; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | 25 | -------------------------------------------------------------------------------- /plugin-api/src/main/java/org/sonarsource/api/sonarlint/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | @ParametersAreNonnullByDefault 21 | package org.sonarsource.api.sonarlint; 22 | 23 | import javax.annotation.ParametersAreNonnullByDefault; 24 | -------------------------------------------------------------------------------- /plugin-api/src/main/resources/sonar-api-version.txt: -------------------------------------------------------------------------------- 1 | @project.buildVersion@ -------------------------------------------------------------------------------- /plugin-api/src/test/java/org/sonar/api/batch/rule/AbstractCheck.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.rule; 21 | 22 | import org.sonar.check.RuleProperty; 23 | 24 | public abstract class AbstractCheck { 25 | 26 | @RuleProperty 27 | private Integer max; 28 | 29 | public Integer getMax() { 30 | return max; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /plugin-api/src/test/java/org/sonar/api/batch/rule/CheckWithKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.rule; 21 | 22 | import org.sonar.check.Priority; 23 | import org.sonar.check.Rule; 24 | 25 | @Rule(key = "S0001", priority = Priority.CRITICAL) 26 | public class CheckWithKey { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /plugin-api/src/test/java/org/sonar/api/batch/rule/CheckWithOverriddenPropertyKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.rule; 21 | 22 | import org.sonar.check.Priority; 23 | import org.sonar.check.Rule; 24 | import org.sonar.check.RuleProperty; 25 | 26 | @Rule(priority = Priority.CRITICAL) 27 | public class CheckWithOverriddenPropertyKey{ 28 | 29 | @RuleProperty(key = "maximum") 30 | private int max = 50; 31 | 32 | public int getMax() { 33 | return max; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /plugin-api/src/test/java/org/sonar/api/batch/rule/CheckWithPrimitiveProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.rule; 21 | 22 | import org.sonar.check.Priority; 23 | import org.sonar.check.Rule; 24 | import org.sonar.check.RuleProperty; 25 | 26 | @Rule(priority = Priority.CRITICAL) 27 | public class CheckWithPrimitiveProperties { 28 | 29 | @RuleProperty(description = "Maximum threshold") 30 | private int max = 50; 31 | 32 | @RuleProperty 33 | private boolean ignore; 34 | 35 | public int getMax() { 36 | return max; 37 | } 38 | 39 | public boolean isIgnore() { 40 | return ignore; 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /plugin-api/src/test/java/org/sonar/api/batch/rule/CheckWithStringProperty.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.rule; 21 | 22 | import org.sonar.check.Priority; 23 | import org.sonar.check.Rule; 24 | import org.sonar.check.RuleProperty; 25 | 26 | @Rule(priority = Priority.CRITICAL) 27 | public class CheckWithStringProperty { 28 | 29 | @RuleProperty 30 | private String pattern; 31 | 32 | public String getPattern() { 33 | return pattern; 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /plugin-api/src/test/java/org/sonar/api/batch/rule/CheckWithUnsupportedPropertyType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.rule; 21 | 22 | import org.sonar.check.Priority; 23 | import org.sonar.check.Rule; 24 | import org.sonar.check.RuleProperty; 25 | 26 | @Rule(priority = Priority.CRITICAL) 27 | class CheckWithUnsupportedPropertyType { 28 | 29 | @RuleProperty 30 | private StringBuilder max = null; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /plugin-api/src/test/java/org/sonar/api/batch/rule/CheckWithoutProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.rule; 21 | 22 | import org.sonar.check.Priority; 23 | import org.sonar.check.Rule; 24 | 25 | @Rule(priority = Priority.CRITICAL) 26 | public class CheckWithoutProperties { 27 | 28 | } 29 | 30 | -------------------------------------------------------------------------------- /plugin-api/src/test/java/org/sonar/api/batch/rule/ImplementedCheck.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.rule; 21 | 22 | import org.sonar.check.Priority; 23 | import org.sonar.check.Rule; 24 | 25 | @Rule(priority = Priority.CRITICAL) 26 | public class ImplementedCheck extends AbstractCheck { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /plugin-api/src/test/java/org/sonar/api/batch/sensor/highlighting/TypeOfTextTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.batch.sensor.highlighting; 21 | 22 | import org.junit.Test; 23 | 24 | import static org.assertj.core.api.Assertions.assertThat; 25 | 26 | public class TypeOfTextTest { 27 | 28 | @Test 29 | public void testForCss() { 30 | assertThat(TypeOfText.forCssClass("k")).isEqualTo(TypeOfText.KEYWORD); 31 | assertThat(TypeOfText.KEYWORD_LIGHT.cssClass()).isEqualTo("h"); 32 | } 33 | 34 | @Test(expected = IllegalArgumentException.class) 35 | public void throwIfUnknowCss() { 36 | TypeOfText.forCssClass("w"); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /plugin-api/src/test/java/org/sonar/api/config/SubCategoryTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.config; 21 | 22 | import org.junit.Test; 23 | 24 | import static org.assertj.core.api.Assertions.assertThat; 25 | 26 | public class SubCategoryTest { 27 | 28 | // see processProperties in application_controller.rb 29 | @Test 30 | public void defaultSubCategoryShouldEqualParentCategory() { 31 | assertThat(new Category("general")).isEqualTo(new SubCategory("general")); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /plugin-api/src/test/java/org/sonar/api/issue/DefaultTransitionsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.issue; 21 | 22 | import org.junit.Test; 23 | 24 | import static org.assertj.core.api.Assertions.assertThat; 25 | 26 | public class DefaultTransitionsTest { 27 | 28 | @Test 29 | public void ALLfield_shouldNotBeEmpty() { 30 | assertThat(DefaultTransitions.ALL).isNotEmpty(); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /plugin-api/src/test/java/org/sonar/api/issue/IssueTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.issue; 21 | 22 | import org.junit.Test; 23 | 24 | import static org.assertj.core.api.Assertions.assertThat; 25 | 26 | public class IssueTest { 27 | 28 | @Test 29 | public void STATUSESfield_shouldNotBeEmpty() { 30 | assertThat(Issue.STATUSES).isNotEmpty(); 31 | } 32 | 33 | @Test 34 | public void RESOLUTIONSfield_shouldNotBeEmpty() { 35 | assertThat(Issue.RESOLUTIONS).isNotEmpty(); 36 | } 37 | 38 | @Test 39 | public void SECURITY_HOTSPOT_RESOLUTIONSfield_shouldNotBeEmpty() { 40 | assertThat(Issue.SECURITY_HOTSPOT_RESOLUTIONS).isNotEmpty(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /plugin-api/src/test/java/org/sonar/api/rule/RuleStatusTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.rule; 21 | 22 | import org.junit.Test; 23 | 24 | import static org.assertj.core.api.Assertions.assertThat; 25 | 26 | public class RuleStatusTest { 27 | @Test 28 | public void default_is_ready() { 29 | assertThat(RuleStatus.defaultStatus()).isEqualTo(RuleStatus.READY); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /plugin-api/src/test/java/org/sonar/api/rule/SeverityTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.rule; 21 | 22 | import org.junit.Test; 23 | 24 | import static org.assertj.core.api.Assertions.assertThat; 25 | 26 | public class SeverityTest { 27 | 28 | @Test 29 | public void test_ALL() { 30 | assertThat(Severity.ALL).hasSize(5).containsSubsequence("INFO", "MINOR", "MAJOR", "CRITICAL", "BLOCKER"); 31 | } 32 | 33 | @Test 34 | public void default_is_major() { 35 | assertThat(Severity.defaultSeverity()).isEqualTo(Severity.MAJOR); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /plugin-api/src/test/java/org/sonar/api/rules/AnnotatedCheck.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.rules; 21 | 22 | @org.sonar.check.Rule(name ="Annotated Check", description = "Description") 23 | public class AnnotatedCheck { 24 | } 25 | -------------------------------------------------------------------------------- /plugin-api/src/test/java/org/sonar/api/rules/AnnotatedCheckWithParameters.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.rules; 21 | 22 | import org.sonar.check.RuleProperty; 23 | 24 | @org.sonar.check.Rule(key = "overridden_key", name = "Check with parameters", description = "Has parameters") 25 | public class AnnotatedCheckWithParameters { 26 | 27 | @RuleProperty(description = "Maximum value") 28 | private String max; 29 | 30 | @RuleProperty(key = "overridden_min", description = "Minimum value") 31 | protected String min; 32 | 33 | private int nonConfigurableProperty; 34 | 35 | public String getMax() { 36 | return max; 37 | } 38 | 39 | public void setMax(String max) { 40 | this.max = max; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /plugin-api/src/test/java/org/sonar/api/rules/RuleAnnotationUtilsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.rules; 21 | 22 | import org.junit.Test; 23 | 24 | import static org.hamcrest.core.Is.is; 25 | import static org.junit.Assert.assertThat; 26 | 27 | public class RuleAnnotationUtilsTest { 28 | 29 | @Test 30 | public void defaultKeyShouldBeTheClassName() { 31 | String key = RuleAnnotationUtils.getRuleKey(AnnotatedCheck.class); 32 | assertThat(key, is(AnnotatedCheck.class.getName())); 33 | } 34 | 35 | @Test 36 | public void shouldGetKey() { 37 | String key = RuleAnnotationUtils.getRuleKey(AnnotatedCheckWithParameters.class); 38 | assertThat(key, is("overridden_key")); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /plugin-api/src/test/java/org/sonar/api/security/DefaultGroupsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.security; 21 | 22 | import org.junit.Test; 23 | 24 | import static org.assertj.core.api.Assertions.assertThat; 25 | 26 | public class DefaultGroupsTest { 27 | @Test 28 | public void isAnyone_is_not_case_sensitive() { 29 | assertThat(DefaultGroups.isAnyone("ANYONE")).isTrue(); 30 | assertThat(DefaultGroups.isAnyone("anyone")).isTrue(); 31 | assertThat(DefaultGroups.isAnyone(DefaultGroups.ANYONE)).isTrue(); 32 | 33 | assertThat(DefaultGroups.isAnyone(DefaultGroups.ADMINISTRATORS)).isFalse(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /plugin-api/src/test/java/org/sonar/api/security/SecurityRealmTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.security; 21 | 22 | import org.junit.Test; 23 | 24 | import static org.assertj.core.api.Assertions.assertThat; 25 | import static org.mockito.Mockito.mock; 26 | 27 | public class SecurityRealmTest { 28 | 29 | @Test 30 | public void doGetAuthenticator() { 31 | final Authenticator authenticator = mock(Authenticator.class); 32 | SecurityRealm realm = new SecurityRealm() { 33 | @Override 34 | public Authenticator doGetAuthenticator() { 35 | return authenticator; 36 | } 37 | }; 38 | assertThat(realm.doGetAuthenticator()).isSameAs(authenticator); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /plugin-api/src/test/java/org/sonar/api/utils/log/LoggersTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.utils.log; 21 | 22 | import org.junit.Test; 23 | import org.sonar.api.Plugin; 24 | 25 | import static org.assertj.core.api.Assertions.assertThat; 26 | 27 | public class LoggersTest { 28 | 29 | @Test 30 | public void factory() { 31 | assertThat(Loggers.get("foo")).isInstanceOf(Slf4jLogger.class); 32 | assertThat(Loggers.get(Plugin.class)).isInstanceOf(Slf4jLogger.class); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /plugin-api/src/test/java/org/sonar/api/web/page/PageDefinitionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.web.page; 21 | 22 | import org.junit.Test; 23 | 24 | import static org.assertj.core.api.Assertions.assertThat; 25 | 26 | /** 27 | * Used for the documentation 28 | */ 29 | public class PageDefinitionTest { 30 | @Test 31 | public void test_page_definition() { 32 | PageDefinition underTest = context -> context.addPage(Page.builder("my_plugin/my_page").setName("My Page").build()); 33 | Context context = new Context(); 34 | 35 | underTest.define(context); 36 | 37 | assertThat(context.getPages()).extracting(Page::getKey).contains("my_plugin/my_page"); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /plugin-api/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | [%d{yyyy.MM.dd HH:mm:ss}][%logger{15}][%-5level] %msg%n 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /plugin-api/src/test/resources/org/sonar/api/server/rule/RuleDescriptionSectionBuilderTest.html: -------------------------------------------------------------------------------- 1 | test HTML description file 2 | -------------------------------------------------------------------------------- /plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionTest/sample.html: -------------------------------------------------------------------------------- 1 | description of rule loaded from file 2 | -------------------------------------------------------------------------------- /plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionTest/sample.md: -------------------------------------------------------------------------------- 1 | description of rule loaded from file 2 | -------------------------------------------------------------------------------- /plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest/deprecated.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Methods Count Check 4 | Checker/TreeWalker/org.sonar.it.checkstyle.MethodsCountCheck 5 | Count methods 6 | 7 | description of param 8 | 9 | 10 | -------------------------------------------------------------------------------- /plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest/invalid.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest/rules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | complete 5 | Complete 6 | 7 | 8 | 9 | Checker/TreeWalker/LocalVariableName 10 | BLOCKER 11 | MULTIPLE 12 | BETA 13 | BUG 14 | misra 15 | spring 16 | 17 | tokens 18 | 19 | 22 | 23 | 24 | 25 | ignore 26 | 27 | Ignore ? 28 | 29 | false 30 | 31 | 32 | 33 | 34 | 35 | 36 | minimal 37 | Minimal 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest/utf8-with-bom.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | com.puppycrawl.tools.checkstyle.checks.naming.LocalVariableNameCheck 4 | BLOCKER 5 | Checker/TreeWalker/LocalVariableName 6 | M & M 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /plugin-api/src/test/resources/org/sonar/api/server/rule/RulesDefinitionXmlLoaderTest/utf8.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.puppycrawl.tools.checkstyle.checks.naming.LocalVariableNameCheck 4 | BLOCKER 5 | Checker/TreeWalker/LocalVariableName 6 | M & M 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /plugin-api/src/test/resources/org/sonar/api/server/ws/WebServiceTest/response-example.txt: -------------------------------------------------------------------------------- 1 | example of WS response 2 | -------------------------------------------------------------------------------- /plugin-api/src/test/resources/org/sonar/api/utils/UriReaderTest/foo.txt: -------------------------------------------------------------------------------- 1 | in foo -------------------------------------------------------------------------------- /plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/shouldUnzipFile.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSource/sonar-plugin-api/993f9bc9c6c7b671e0a8a14fdf4fb88c7b91e1ae/plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/shouldUnzipFile.zip -------------------------------------------------------------------------------- /plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/shouldZipDirectory/bar.txt: -------------------------------------------------------------------------------- 1 | barrrrrrrrr -------------------------------------------------------------------------------- /plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/shouldZipDirectory/dir1/hello.properties: -------------------------------------------------------------------------------- 1 | a=b -------------------------------------------------------------------------------- /plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/shouldZipDirectory/foo.txt: -------------------------------------------------------------------------------- 1 | fooooooooooo -------------------------------------------------------------------------------- /plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/zip-bomb.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSource/sonar-plugin-api/993f9bc9c6c7b671e0a8a14fdf4fb88c7b91e1ae/plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/zip-bomb.zip -------------------------------------------------------------------------------- /plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/zip-slip.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SonarSource/sonar-plugin-api/993f9bc9c6c7b671e0a8a14fdf4fb88c7b91e1ae/plugin-api/src/test/resources/org/sonar/api/utils/ZipUtilsTest/zip-slip.zip -------------------------------------------------------------------------------- /plugin-api/src/test/resources/sonar/bundles/PluginFoo.properties: -------------------------------------------------------------------------------- 1 | foo.hello=Hello 2 | foo.world=World -------------------------------------------------------------------------------- /plugin-api/src/test/resources/sonar/bundles/PluginFoo_es.properties: -------------------------------------------------------------------------------- 1 | foo.hello=Hola 2 | foo.world=Mundo 3 | only.in.spanish=bueno -------------------------------------------------------------------------------- /plugin-api/src/test/resources/sonar/bundles/Test.properties: -------------------------------------------------------------------------------- 1 | test.one=One 2 | test.two=Two 3 | with.string.params=Continuous %1$s will %2$s ! -------------------------------------------------------------------------------- /plugin-api/src/test/resources/sonar/bundles/Test_fr.properties: -------------------------------------------------------------------------------- 1 | test.one=Un 2 | test.two=Deux -------------------------------------------------------------------------------- /plugin-api/src/test/scripts/echo.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | @ECHO %CD% > echo.log 3 | @ECHO Parameter: %1 >> echo.log 4 | @ECHO Environment variable: %ENVVAR% >> echo.log 5 | -------------------------------------------------------------------------------- /plugin-api/src/test/scripts/echo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | WORKING_DIR=`pwd` 4 | echo $WORKING_DIR > echo.log 5 | echo "Parameter: $1" >> echo.log 6 | echo "Environment variable: $ENVVAR" >> echo.log 7 | -------------------------------------------------------------------------------- /plugin-api/src/test/scripts/forever.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | :LOOP 4 | @rem Next line may lead to freeze of build process on Windows 7 due to non-terminated ping-processes 5 | @rem ping 1.1.1.1 -n 2 -w 60000 > nul 6 | GOTO LOOP 7 | -------------------------------------------------------------------------------- /plugin-api/src/test/scripts/forever.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | while test "notempty" 4 | do 5 | sleep 5s 6 | done 7 | -------------------------------------------------------------------------------- /plugin-api/src/test/scripts/output.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | @ECHO stdOut: first line 3 | @ECHO stdOut: second line 4 | @ECHO stdErr: first line 1>&2 5 | @ECHO stdErr: second line 1>&2 6 | -------------------------------------------------------------------------------- /plugin-api/src/test/scripts/output.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo stdOut: first line 4 | echo stdOut: second line 5 | echo stdErr: first line 1>&2 6 | echo stdErr: second line 1>&2 7 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name='sonar-plugin-api' 2 | include 'plugin-api' 3 | include 'check-api' 4 | include 'test-fixtures' 5 | 6 | dependencyResolutionManagement { 7 | versionCatalogs { 8 | libs { 9 | version('slf4j', '1.7.30') 10 | library('commons-io', 'commons-io:commons-io:2.16.1') 11 | library('commons-lang3', 'org.apache.commons:commons-lang3:3.14.0') 12 | library('commons-text', 'org.apache.commons:commons-text:1.12.0') 13 | library('commons-validator', 'commons-validator:commons-validator:1.9.0') 14 | library('guava', 'com.google.guava:guava:31.1-jre') 15 | library('gson', 'com.google.code.gson:gson:2.11.0') 16 | library('jsr305', 'com.google.code.findbugs:jsr305:3.0.2') 17 | library('junit4', 'junit:junit:4.13.2') 18 | library('junit5', 'org.junit.jupiter:junit-jupiter-api:5.10.3') 19 | library('jupiter-engine', 'org.junit.jupiter:junit-jupiter-engine:5.10.3') 20 | library('jupiter-vintage-engine', 'org.junit.vintage:junit-vintage-engine:5.10.3') 21 | library('slf4j', 'org.slf4j', 'slf4j-api').versionRef('slf4j') 22 | library('logback-classic', 'ch.qos.logback:logback-classic:1.2.9') 23 | library('assertj', 'org.assertj:assertj-core:3.26.0') 24 | library('mockito', 'org.mockito:mockito-core:5.12.0') 25 | library('junit-dataprovider', 'com.tngtech.java:junit-dataprovider:1.13.1') 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /test-fixtures/src/main/java/org/sonar/api/testfixtures/log/ConcurrentListAppender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.testfixtures.log; 21 | 22 | import ch.qos.logback.core.AppenderBase; 23 | import java.util.Queue; 24 | import java.util.concurrent.ConcurrentLinkedQueue; 25 | 26 | public class ConcurrentListAppender extends AppenderBase { 27 | public final Queue list = new ConcurrentLinkedQueue(); 28 | 29 | protected void append(E e) { 30 | list.add(e); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /test-fixtures/src/main/java/org/sonar/api/testfixtures/measure/TestMeasureComputerDefinitionContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Sonar Plugin API 3 | * Copyright (C) 2009-2025 SonarSource SA 4 | * mailto:info AT sonarsource DOT com 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 3 of the License, or (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program; if not, write to the Free Software Foundation, 18 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | package org.sonar.api.testfixtures.measure; 21 | 22 | import org.sonar.api.ce.measure.MeasureComputer; 23 | 24 | public class TestMeasureComputerDefinitionContext implements MeasureComputer.MeasureComputerDefinitionContext { 25 | @Override 26 | public MeasureComputer.MeasureComputerDefinition.Builder newDefinitionBuilder() { 27 | return new TestMeasureComputerDefinition.MeasureComputerDefinitionBuilderImpl(); 28 | } 29 | } 30 | --------------------------------------------------------------------------------