id stringlengths 7 14 | test_class dict | test_case dict | focal_class dict | focal_method dict | repository dict |
|---|---|---|---|---|---|
9755019_76 | {
"fields": [
{
"declarator": "analyzerScheduler",
"modifier": "private",
"original_string": "private QualityAnalyzerScheduler analyzerScheduler;",
"type": "QualityAnalyzerScheduler",
"var_name": "analyzerScheduler"
},
{
"declarator": "projectRepository",
"modifie... | {
"body": "@Test\n public void scheduledProjectShouldNotBeMarkedAsHadAnalysis() {\n analyzerScheduler.scheduleAnalyzer(project);\n assertThat(project.hadAnalysis()).isFalse();\n }",
"class_method_signature": "DefaultQualityAnalyzerSchedulerTest.scheduledProjectShouldNotBeMarkedAsHadAnalysis()",
"construct... | {
"fields": [
{
"declarator": "DEFAULT_POOL_SIZE = 10",
"modifier": "private static final",
"original_string": "private static final int DEFAULT_POOL_SIZE = 10;",
"type": "int",
"var_name": "DEFAULT_POOL_SIZE"
},
{
"declarator": "scheduler = new ThreadPoolTaskScheduler(... | {
"body": "public boolean scheduleAnalyzer(Project project) {\n if (alreadyScheduledProjects.contains(project)) {\n log.info(\"Project {} is already scheduled!\", project.getName());\n return false;\n }\n alreadyScheduledProjects.add(project);\n\n QualityAnalyzerService qualityAnalyzerService = ... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_100 | {
"fields": [
{
"declarator": "generator",
"modifier": "private",
"original_string": "private InvestmentOpportunitiesJsonGenerator generator;",
"type": "InvestmentOpportunitiesJsonGenerator",
"var_name": "generator"
},
{
"declarator": "weightedProfitCalculator",
"... | {
"body": "@Test\n public void profitablePacakgesAndArtefactsShouldBeFilteredProperly() throws IOException {\n Artefact artefact1 = new Artefact(\"org.project.test.util.C\", \"DUMMY\");\n Artefact artefact2 = new Artefact(\"org.project.test.util.D\", \"DUMMY\");\n Artefact artefact3 = new Artefact(\"org.pro... | {
"fields": [
{
"declarator": "MAPPER = new ObjectMapper()",
"modifier": "private static final",
"original_string": "private static final ObjectMapper MAPPER = new ObjectMapper();",
"type": "ObjectMapper",
"var_name": "MAPPER"
},
{
"declarator": "PACKAGE_SPLITTER = Spli... | {
"body": "public String generate(QualityAnalysis analysis) throws JsonProcessingException {\n Set<String> alreadyAddedArtefacts = Sets.newHashSet();\n Map<String, PackageNode> nodeLookupTable = Maps.newHashMap();\n RootNode rootNode = new RootNode(analysis.getProject().getName());\n\n for (QualityViolati... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_101 | {
"fields": [
{
"declarator": "validName = \"MyProject\"",
"modifier": "private final",
"original_string": "private final String validName = \"MyProject\";",
"type": "String",
"var_name": "validName"
},
{
"declarator": "validCronExpression = \"* * * * * *\"",
"mod... | {
"body": "@Test\n public void shouldSupportProjectType() {\n assertThat(validator.supports(Project.class)).isTrue();\n }",
"class_method_signature": "ProjectValidatorTest.shouldSupportProjectType()",
"constructor": false,
"full_signature": "@Test public void shouldSupportProjectType()",
"identifier": "s... | {
"fields": [
{
"declarator": "projectRepository",
"modifier": "private final",
"original_string": "private final ProjectRepository projectRepository;",
"type": "ProjectRepository",
"var_name": "projectRepository"
},
{
"declarator": "profileRepository",
"modifier"... | {
"body": "@Override\n public boolean supports(Class<?> clazz) {\n return Project.class.equals(clazz);\n }",
"class_method_signature": "ProjectValidator.supports(Class<?> clazz)",
"constructor": false,
"full_signature": "@Override public boolean supports(Class<?> clazz)",
"identifier": "supports",
"inv... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_98 | {
"fields": [
{
"declarator": "generator",
"modifier": "private",
"original_string": "private InvestmentOpportunitiesJsonGenerator generator;",
"type": "InvestmentOpportunitiesJsonGenerator",
"var_name": "generator"
},
{
"declarator": "weightedProfitCalculator",
"... | {
"body": "@Test\n public void analysisWithOneArtefact() throws IOException {\n Artefact artefact = new Artefact(\"org.project.MyClass\", \"DUMMY\");\n artefact.setChangeProbability(0.6);\n QualityViolation violation = new QualityViolation(artefact, null, 5, 10, 0, \"\");\n QualityAnalysis analysis = Qua... | {
"fields": [
{
"declarator": "MAPPER = new ObjectMapper()",
"modifier": "private static final",
"original_string": "private static final ObjectMapper MAPPER = new ObjectMapper();",
"type": "ObjectMapper",
"var_name": "MAPPER"
},
{
"declarator": "PACKAGE_SPLITTER = Spli... | {
"body": "public String generate(QualityAnalysis analysis) throws JsonProcessingException {\n Set<String> alreadyAddedArtefacts = Sets.newHashSet();\n Map<String, PackageNode> nodeLookupTable = Maps.newHashMap();\n RootNode rootNode = new RootNode(analysis.getProject().getName());\n\n for (QualityViolati... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_77 | {
"fields": [
{
"declarator": "analyzerScheduler",
"modifier": "private",
"original_string": "private QualityAnalyzerScheduler analyzerScheduler;",
"type": "QualityAnalyzerScheduler",
"var_name": "analyzerScheduler"
},
{
"declarator": "projectRepository",
"modifie... | {
"body": "@Test\n public void executedProjectShouldBeSavedToDatabaseAfterMarkedAsHadAnalysis() {\n analyzerScheduler.executeAnalyzer(project);\n InOrder inOrder = inOrder(project, projectRepository);\n inOrder.verify(project).setHadAnalysis(true);\n inOrder.verify(projectRepository).save(project);\n }"... | {
"fields": [
{
"declarator": "DEFAULT_POOL_SIZE = 10",
"modifier": "private static final",
"original_string": "private static final int DEFAULT_POOL_SIZE = 10;",
"type": "int",
"var_name": "DEFAULT_POOL_SIZE"
},
{
"declarator": "scheduler = new ThreadPoolTaskScheduler(... | {
"body": "public void executeAnalyzer(Project project) {\n project.setHadAnalysis(true);\n projectRepository.save(project);\n\n QualityAnalyzerService qualityAnalyzerService = createDefaultQualityAnalyzer();\n scheduler.execute(new AnalyzerRunnable(project, projectRepository, qualityAnalyzerService));\n ... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_20 | {
"fields": [],
"file": "investment-decision-making/src/test/java/org/codeqinvest/investment/profit/WeightedProfitCalculatorTest.java",
"identifier": "WeightedProfitCalculatorTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldDivideProfitOfViolationByWeightingMetricValue() {\n ProfitCalculator profitCalculator = mock(ProfitCalculator.class);\n when(profitCalculator.calculateProfit(any(QualityViolation.class))).thenReturn(20.0);\n\n QualityViolation violation = mock(QualityViolation.class);\n ... | {
"fields": [
{
"declarator": "profitCalculator",
"modifier": "private final",
"original_string": "private final ProfitCalculator profitCalculator;",
"type": "ProfitCalculator",
"var_name": "profitCalculator"
}
],
"file": "investment-decision-making/src/main/java/org/codeqinv... | {
"body": "public double calculateWeightedProfit(QualityViolation violation) {\n return profitCalculator.calculateProfit(violation) / violation.getWeightingMetricValue();\n }",
"class_method_signature": "WeightedProfitCalculator.calculateWeightedProfit(QualityViolation violation)",
"constructor": false,
"fu... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_36 | {
"fields": [
{
"declarator": "A = new ProjectInformation(\"A\", \"\")",
"modifier": "private",
"original_string": "private ProjectInformation A = new ProjectInformation(\"A\", \"\");",
"type": "ProjectInformation",
"var_name": "A"
},
{
"declarator": "B = new ProjectInf... | {
"body": "@Test\n public void A_and_a_are_the_same() {\n assertThat(a.compareTo(A)).isEqualTo(areTheSame);\n }",
"class_method_signature": "ProjectInformationTest.A_and_a_are_the_same()",
"constructor": false,
"full_signature": "@Test public void A_and_a_are_the_same()",
"identifier": "A_and_a_are_the_s... | {
"fields": [
{
"declarator": "name",
"modifier": "private",
"original_string": "private String name;",
"type": "String",
"var_name": "name"
},
{
"declarator": "resourceKey",
"modifier": "private",
"original_string": "private String resourceKey;",
"typ... | {
"body": "@Override\n public int compareTo(Object o) {\n if (o != null) {\n ProjectInformation otherProjectInformation = (ProjectInformation) o;\n if (otherProjectInformation.getName() != null && this.getName() != null) {\n return this.name.compareToIgnoreCase(otherProjectInformati... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_61 | {
"fields": [
{
"declarator": "secureChangeProbabilityCalculator",
"modifier": "private",
"original_string": "private SecureChangeProbabilityCalculator secureChangeProbabilityCalculator;",
"type": "SecureChangeProbabilityCalculator",
"var_name": "secureChangeProbabilityCalculator"
... | {
"body": "@Test\n public void profileWithNoChangeRiskAssessmentFunctions() throws ResourceNotFoundException {\n assertThat(secureChangeProbabilityCalculator.calculateSecureChangeProbability(\n profile, mock(SonarConnectionSettings.class), mock(Artefact.class))).isEqualTo(1.0);\n }",
"class_method_signa... | {
"fields": [
{
"declarator": "metricCollectorService",
"modifier": "private final",
"original_string": "private final MetricCollectorService metricCollectorService;",
"type": "MetricCollectorService",
"var_name": "metricCollectorService"
}
],
"file": "quality-assessment/src/... | {
"body": "public double calculateSecureChangeProbability(QualityProfile qualityProfile, SonarConnectionSettings sonarConnectionSettings, Artefact artefact) throws ResourceNotFoundException {\n log.info(\"Calculate secure change probability for artefact {}\", artefact.getName());\n double secureChangeProbabilit... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_16 | {
"fields": [
{
"declarator": "parser",
"modifier": "private",
"original_string": "private InvestmentAmountParser parser;",
"type": "InvestmentAmountParser",
"var_name": "parser"
}
],
"file": "investment-decision-making/src/test/java/org/codeqinvest/investment/InvestmentAmoun... | {
"body": "@Test(expected = InvestmentParsingException.class)\n public void shouldThrowExceptionWhenGivenStringIsNotParsable() throws InvestmentParsingException {\n parser.parseMinutes(\"abc0m\");\n }",
"class_method_signature": "InvestmentAmountParserTest.shouldThrowExceptionWhenGivenStringIsNotParsable()",
... | {
"fields": [],
"file": "investment-decision-making/src/main/java/org/codeqinvest/investment/InvestmentAmountParser.java",
"identifier": "InvestmentAmountParser",
"interfaces": "",
"methods": [
{
"class_method_signature": "InvestmentAmountParser.parseMinutes(String formattedInvestmentAmount)",
... | {
"body": "public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException {\n if (formattedInvestmentAmount.isEmpty()) {\n return 0;\n }\n\n Pattern pattern = Pattern.compile(\"(\\\\d*h)?\\\\s?(\\\\d*m)?\");\n Matcher matcher = pattern.matcher(formattedInvestmentAmount);\... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_41 | {
"fields": [],
"file": "metrics-collector/src/test/java/org/codeqinvest/sonar/ResourcesCollectorServiceTest.java",
"identifier": "ResourcesCollectorServiceTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test(expected = IllegalArgumentException.class)\n public void shouldFailWhenConnectionSettingsMissProjectAttribute() {\n new ResourcesCollectorService().collectAllResourcesForProject(new SonarConnectionSettings(\"dummy\"));\n }",
"class_method_signature": "ResourcesCollectorServiceTest.shouldFailWh... | {
"fields": [],
"file": "metrics-collector/src/main/java/org/codeqinvest/sonar/ResourcesCollectorService.java",
"identifier": "ResourcesCollectorService",
"interfaces": "",
"methods": [
{
"class_method_signature": "ResourcesCollectorService.collectAllResourcesForProject(SonarConnectionSettings conne... | {
"body": "public Collection<Resource> collectAllResourcesForProject(SonarConnectionSettings connectionSettings) {\n if (!connectionSettings.hasProject()) {\n throw new IllegalArgumentException(\"you can only collect resources with connection settings that has a project\");\n }\n log.info(\"Start collec... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_57 | {
"fields": [
{
"declarator": "codeChangeProbabilityCalculatorFactory",
"modifier": "@Autowired\n private",
"original_string": "@Autowired\n private CodeChangeProbabilityCalculatorFactory codeChangeProbabilityCalculatorFactory;",
"type": "CodeChangeProbabilityCalculatorFactory",
"v... | {
"body": "@Test\n public void createCalculatorForDefaultSetting() {\n assertThat(codeChangeProbabilityCalculatorFactory.create(CodeChangeSettings.defaultSetting(0)))\n .isInstanceOf(DefaultCodeChangeProbabilityCalculator.class);\n }",
"class_method_signature": "CodeChangeProbabilityCalculatorFactoryTes... | {
"fields": [
{
"declarator": "codeChurnCalculatorFactory",
"modifier": "@Getter\n private final",
"original_string": "@Getter\n private final CodeChurnCalculatorFactory codeChurnCalculatorFactory;",
"type": "CodeChurnCalculatorFactory",
"var_name": "codeChurnCalculatorFactory"
... | {
"body": "CodeChangeProbabilityCalculator create(CodeChangeSettings codeChangeSettings) {\n if (codeChangeSettings.getMethod() == SupportedCodeChangeProbabilityMethod.WEIGHTED.getId()) {\n return new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, LocalDate.now(), codeChangeSettings.getDa... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_94 | {
"fields": [
{
"declarator": "roiDistributionFilter",
"modifier": "private",
"original_string": "private RoiDistributionFilter roiDistributionFilter;",
"type": "RoiDistributionFilter",
"var_name": "roiDistributionFilter"
}
],
"file": "web-ui/src/test/java/org/codeqinvest/web... | {
"body": "@Test\n public void filterBestRoisFromManyDistributions() {\n Map<String, Integer> roiByArtefactOneInvest = Maps.newHashMap();\n roiByArtefactOneInvest.put(\"A\", 10);\n roiByArtefactOneInvest.put(\"B\", 1);\n roiByArtefactOneInvest.put(\"C\", 2);\n roiByArtefactOneInvest.put(\"D\", 9);\n ... | {
"fields": [],
"file": "web-ui/src/main/java/org/codeqinvest/web/investment/roi/RoiDistributionFilter.java",
"identifier": "RoiDistributionFilter",
"interfaces": "",
"methods": [
{
"class_method_signature": "RoiDistributionFilter.filterHighestRoi(Collection<RoiDistribution> roiDistributions, int nu... | {
"body": "Collection<RoiDistribution> filterHighestRoi(Collection<RoiDistribution> roiDistributions, int numberOfBestElements) {\n Map<Integer, RoiDistribution> filteredRoiDistributionsByInvest = Maps.newHashMap();\n for (RoiDistribution distribution : roiDistributions) {\n filteredRoiDistributionsByInves... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_1 | {
"fields": [
{
"declarator": "investmentPlanService",
"modifier": "private",
"original_string": "private QualityInvestmentPlanService investmentPlanService;",
"type": "QualityInvestmentPlanService",
"var_name": "investmentPlanService"
},
{
"declarator": "profitCalculat... | {
"body": "@Test\n public void calculatesOverallProfitForAllQualityViolations() {\n QualityInvestmentPlan qualityInvestmentPlan = investmentPlanService.computeInvestmentPlan(analysis, \"\", 80);\n assertThat(qualityInvestmentPlan.getProfitInMinutes())\n .as(\"The overall profit should be calculated base... | {
"fields": [
{
"declarator": "profitCalculator",
"modifier": "private final",
"original_string": "private final ProfitCalculator profitCalculator;",
"type": "ProfitCalculator",
"var_name": "profitCalculator"
}
],
"file": "investment-decision-making/src/main/java/org/codeqinv... | {
"body": "public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) {\n Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create();\n for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(basePackage,... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_82 | {
"fields": [],
"file": "quality-assessment/src/test/java/org/codeqinvest/quality/ArtefactTest.java",
"identifier": "ArtefactTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldConvertClassNameToFilenameProperly() {\n assertThat(new Artefact(\"AbcDe\", \"\").getFilename()).isEqualTo(\"AbcDe.java\");\n }",
"class_method_signature": "ArtefactTest.shouldConvertClassNameToFilenameProperly()",
"constructor": false,
"full_signature": "@Test public v... | {
"fields": [
{
"declarator": "id",
"modifier": "@Id\n @GeneratedValue\n private",
"original_string": "@Id\n @GeneratedValue\n private Long id;",
"type": "Long",
"var_name": "id"
},
{
"declarator": "name",
"modifier": "@Column(nullable = false)\n private",
... | {
"body": "public String getFilename() {\n if (name.isEmpty()) {\n return \"\";\n }\n return name.replace('.', '/') + \".java\";\n }",
"class_method_signature": "Artefact.getFilename()",
"constructor": false,
"full_signature": "public String getFilename()",
"identifier": "getFilename",
"invoc... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_89 | {
"fields": [
{
"declarator": "validator",
"modifier": "private",
"original_string": "private SonarServerValidator validator;",
"type": "SonarServerValidator",
"var_name": "validator"
}
],
"file": "web-ui/src/test/java/org/codeqinvest/web/sonar/SonarServerValidatorTest.java",... | {
"body": "@Test\n public void shouldSupportSonarServerType() {\n assertThat(validator.supports(SonarServer.class)).isTrue();\n }",
"class_method_signature": "SonarServerValidatorTest.shouldSupportSonarServerType()",
"constructor": false,
"full_signature": "@Test public void shouldSupportSonarServerType()"... | {
"fields": [],
"file": "web-ui/src/main/java/org/codeqinvest/web/sonar/SonarServerValidator.java",
"identifier": "SonarServerValidator",
"interfaces": "implements Validator",
"methods": [
{
"class_method_signature": "SonarServerValidator.supports(Class<?> clazz)",
"constructor": false,
... | {
"body": "@Override\n public boolean supports(Class<?> clazz) {\n return SonarServer.class.equals(clazz);\n }",
"class_method_signature": "SonarServerValidator.supports(Class<?> clazz)",
"constructor": false,
"full_signature": "@Override public boolean supports(Class<?> clazz)",
"identifier": "supports"... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_66 | {
"fields": [
{
"declarator": "analyzerRunnable",
"modifier": "private",
"original_string": "private AnalyzerRunnable analyzerRunnable;",
"type": "AnalyzerRunnable",
"var_name": "analyzerRunnable"
},
{
"declarator": "project",
"modifier": "private",
"origina... | {
"body": "@Test\n public void executedProjectShouldBeSavedToDatabaseAfterMarkedAsHadAnalysis() {\n analyzerRunnable.run();\n InOrder inOrder = inOrder(project, projectRepository);\n inOrder.verify(project).setHadAnalysis(true);\n inOrder.verify(projectRepository).save(project);\n }",
"class_method_si... | {
"fields": [
{
"declarator": "projectId",
"modifier": "private final",
"original_string": "private final long projectId;",
"type": "long",
"var_name": "projectId"
},
{
"declarator": "projectRepository",
"modifier": "private final",
"original_string": "priva... | {
"body": "@Override\n public void run() {\n Project project = projectRepository.findOne(projectId);\n if (project != null) {\n project.setHadAnalysis(true);\n projectRepository.save(project);\n\n log.info(\"Start analyzer run for project {}\", project.getName());\n qualityAnalyzerService.a... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_31 | {
"fields": [],
"file": "code-changes-analyzer/src/test/java/org/codeqinvest/codechanges/scm/svn/SvnFileTest.java",
"identifier": "SvnFileTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldNotFailOnEmptyText() {\n assertThat(new SvnFile(\"\", \"a\").countLines()).isEqualTo(0);\n }",
"class_method_signature": "SvnFileTest.shouldNotFailOnEmptyText()",
"constructor": false,
"full_signature": "@Test public void shouldNotFailOnEmptyText()",
"identifier": "sh... | {
"fields": [
{
"declarator": "content",
"modifier": "private final",
"original_string": "private final String content;",
"type": "String",
"var_name": "content"
},
{
"declarator": "lineSeparator",
"modifier": "private final",
"original_string": "private fin... | {
"body": "int countLines() {\n if (content.isEmpty()) {\n return 0;\n }\n return content.split(lineSeparator).length;\n }",
"class_method_signature": "SvnFile.countLines()",
"constructor": false,
"full_signature": " int countLines()",
"identifier": "countLines",
"invocations": [
"isEmpty... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_27 | {
"fields": [
{
"declarator": "availabilityCheckerService",
"modifier": "private",
"original_string": "private SvnServerAvailabilityCheckerService availabilityCheckerService;",
"type": "SvnServerAvailabilityCheckerService",
"var_name": "availabilityCheckerService"
}
],
"file"... | {
"body": "@Test\n public void notAvailableWhenUrlOfScmSettingsIsNull() {\n assertThat(availabilityCheckerService.isAvailable(new ScmConnectionSettings(null))).isFalse();\n }",
"class_method_signature": "SvnServerAvailabilityCheckerServiceTest.notAvailableWhenUrlOfScmSettingsIsNull()",
"constructor": false,
... | {
"fields": [],
"file": "code-changes-analyzer/src/main/java/org/codeqinvest/codechanges/scm/svn/SvnServerAvailabilityCheckerService.java",
"identifier": "SvnServerAvailabilityCheckerService",
"interfaces": "implements ScmAvailabilityCheckerService",
"methods": [
{
"class_method_signature": "SvnServ... | {
"body": "@Override\n public boolean isAvailable(ScmConnectionSettings connectionSettings) {\n if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) {\n return false;\n }\n\n try {\n SvnRepositoryFactory.create(connectionSettings).testConnection();\n log.info(... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_70 | {
"fields": [
{
"declarator": "defaultSonarHost = \"http://localhost\"",
"modifier": "private final",
"original_string": "private final String defaultSonarHost = \"http://localhost\";",
"type": "String",
"var_name": "defaultSonarHost"
},
{
"declarator": "profile",
... | {
"body": "@Test\n public void noViolationsWhenNoRequirementsAreViolated() {\n FakeResourcesCollectorService resourcesCollectorService = new FakeResourcesCollectorService();\n resourcesCollectorService.addResource(\"A\");\n resourcesCollectorService.addResource(\"B\");\n\n FakeMetricCollectorService metr... | {
"fields": [
{
"declarator": "sonarConnectionCheckerService",
"modifier": "private final",
"original_string": "private final SonarConnectionCheckerService sonarConnectionCheckerService;",
"type": "SonarConnectionCheckerService",
"var_name": "sonarConnectionCheckerService"
},
... | {
"body": "ViolationsAnalysisResult calculateAllViolation(Project project) {\n if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) {\n return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(),\n \"sonar project is not reachable... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_106 | {
"fields": [
{
"declarator": "validator",
"modifier": "private",
"original_string": "private ProjectConnectionsValidator validator;",
"type": "ProjectConnectionsValidator",
"var_name": "validator"
},
{
"declarator": "projectValidator",
"modifier": "private",
... | {
"body": "@Test\n public void shouldNotSupportOtherTypeThanProject() {\n assertThat(validator.supports(Object.class)).isFalse();\n }",
"class_method_signature": "ProjectConnectionsValidatorTest.shouldNotSupportOtherTypeThanProject()",
"constructor": false,
"full_signature": "@Test public void shouldNotSup... | {
"fields": [
{
"declarator": "projectValidator",
"modifier": "private final",
"original_string": "private final ProjectValidator projectValidator;",
"type": "ProjectValidator",
"var_name": "projectValidator"
},
{
"declarator": "sonarConnectionCheckerService",
"mo... | {
"body": "@Override\n public boolean supports(Class<?> clazz) {\n return Project.class.equals(clazz);\n }",
"class_method_signature": "ProjectConnectionsValidator.supports(Class<?> clazz)",
"constructor": false,
"full_signature": "@Override public boolean supports(Class<?> clazz)",
"identifier": "suppor... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_85 | {
"fields": [],
"file": "quality-assessment/src/test/java/org/codeqinvest/quality/ArtefactTest.java",
"identifier": "ArtefactTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldConvertFullyQualifiedClassNameWithoutPackagesToShortClassName() {\n assertThat(new Artefact(\"Class123\", \"\").getShortClassName()).isEqualTo(\"Class123\");\n }",
"class_method_signature": "ArtefactTest.shouldConvertFullyQualifiedClassNameWithoutPackagesToShortClassName()"... | {
"fields": [
{
"declarator": "id",
"modifier": "@Id\n @GeneratedValue\n private",
"original_string": "@Id\n @GeneratedValue\n private Long id;",
"type": "Long",
"var_name": "id"
},
{
"declarator": "name",
"modifier": "@Column(nullable = false)\n private",
... | {
"body": "public String getShortClassName() {\n String className = null;\n for (String packageName : Splitter.on('.').split(name)) {\n className = packageName;\n }\n return className;\n }",
"class_method_signature": "Artefact.getShortClassName()",
"constructor": false,
"full_signature": "publ... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_6 | {
"fields": [
{
"declarator": "investmentPlanService",
"modifier": "private",
"original_string": "private QualityInvestmentPlanService investmentPlanService;",
"type": "QualityInvestmentPlanService",
"var_name": "investmentPlanService"
},
{
"declarator": "profitCalculat... | {
"body": "@Test\n public void shouldOnlyConsiderArtefactThatStartWithBasePackageName() {\n QualityInvestmentPlan qualityInvestmentPlan = investmentPlanService.computeInvestmentPlan(analysis, \"org.project\", 80);\n assertThat(qualityInvestmentPlan.getEntries()).hasSize(1);\n assertThat(qualityInvestmentPla... | {
"fields": [
{
"declarator": "profitCalculator",
"modifier": "private final",
"original_string": "private final ProfitCalculator profitCalculator;",
"type": "ProfitCalculator",
"var_name": "profitCalculator"
}
],
"file": "investment-decision-making/src/main/java/org/codeqinv... | {
"body": "public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) {\n Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create();\n for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(basePackage,... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_93 | {
"fields": [
{
"declarator": "roiDistributionFilter",
"modifier": "private",
"original_string": "private RoiDistributionFilter roiDistributionFilter;",
"type": "RoiDistributionFilter",
"var_name": "roiDistributionFilter"
}
],
"file": "web-ui/src/test/java/org/codeqinvest/web... | {
"body": "@Test\n public void filterBestRoisFromOneDistribution() {\n Map<String, Integer> roiByArtefact = Maps.newHashMap();\n roiByArtefact.put(\"A\", 10);\n roiByArtefact.put(\"B\", 11);\n roiByArtefact.put(\"C\", 9);\n roiByArtefact.put(\"D\", 12);\n List<RoiDistribution> roiDistribution = Arr... | {
"fields": [],
"file": "web-ui/src/main/java/org/codeqinvest/web/investment/roi/RoiDistributionFilter.java",
"identifier": "RoiDistributionFilter",
"interfaces": "",
"methods": [
{
"class_method_signature": "RoiDistributionFilter.filterHighestRoi(Collection<RoiDistribution> roiDistributions, int nu... | {
"body": "Collection<RoiDistribution> filterHighestRoi(Collection<RoiDistribution> roiDistributions, int numberOfBestElements) {\n Map<Integer, RoiDistribution> filteredRoiDistributionsByInvest = Maps.newHashMap();\n for (RoiDistribution distribution : roiDistributions) {\n filteredRoiDistributionsByInves... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_50 | {
"fields": [
{
"declarator": "profile",
"modifier": "private",
"original_string": "private QualityProfile profile;",
"type": "QualityProfile",
"var_name": "profile"
},
{
"declarator": "firstRequirement",
"modifier": "private",
"original_string": "private Qu... | {
"body": "@Test\n public void takeCostsFromSuppliedCostCalculator() throws CodeChurnCalculationException, ScmConnectionEncodingException, ResourceNotFoundException {\n ViolationOccurence violation = new ViolationOccurence(firstRequirement, new Artefact(\"A\", \"A\"), 0);\n\n ViolationsCalculatorService violat... | {
"fields": [
{
"declarator": "violationsCalculatorService",
"modifier": "private final",
"original_string": "private final ViolationsCalculatorService violationsCalculatorService;",
"type": "ViolationsCalculatorService",
"var_name": "violationsCalculatorService"
},
{
"... | {
"body": "@Override\n public QualityAnalysis analyzeProject(Project project) {\n try {\n ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project);\n if (!violationsAnalysisResult.isSuccessful()) {\n log.error(\"Quality analysis for project {}... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_46 | {
"fields": [
{
"declarator": "profile",
"modifier": "private",
"original_string": "private QualityProfile profile;",
"type": "QualityProfile",
"var_name": "profile"
},
{
"declarator": "firstRequirement",
"modifier": "private",
"original_string": "private Qu... | {
"body": "@Test\n public void succeededAnalysisWithManyViolations() throws CodeChurnCalculationException, ScmConnectionEncodingException {\n Artefact artefactA = new Artefact(\"A\", \"A\");\n Artefact artefactB = new Artefact(\"B\", \"B\");\n Artefact artefactC = new Artefact(\"C\", \"C\");\n QualityAna... | {
"fields": [
{
"declarator": "violationsCalculatorService",
"modifier": "private final",
"original_string": "private final ViolationsCalculatorService violationsCalculatorService;",
"type": "ViolationsCalculatorService",
"var_name": "violationsCalculatorService"
},
{
"... | {
"body": "@Override\n public QualityAnalysis analyzeProject(Project project) {\n try {\n ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project);\n if (!violationsAnalysisResult.isSuccessful()) {\n log.error(\"Quality analysis for project {}... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_11 | {
"fields": [
{
"declarator": "investmentPlanService",
"modifier": "private",
"original_string": "private QualityInvestmentPlanService investmentPlanService;",
"type": "QualityInvestmentPlanService",
"var_name": "investmentPlanService"
},
{
"declarator": "profitCalculat... | {
"body": "@Test\n public void shouldGenerateInvestmentPlanForOneSubPackage() {\n QualityViolation violation1 = new QualityViolation(new Artefact(\"org.project.a.test.A\", \"\"), createRequirementOnlyWithCriteria(new QualityCriteria(\"cc\", \"<\", 5.0)), 50, 0, 0.0, \"ncloc\");\n QualityViolation violation2 = ... | {
"fields": [
{
"declarator": "profitCalculator",
"modifier": "private final",
"original_string": "private final ProfitCalculator profitCalculator;",
"type": "ProfitCalculator",
"var_name": "profitCalculator"
}
],
"file": "investment-decision-making/src/main/java/org/codeqinv... | {
"body": "public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) {\n Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create();\n for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(basePackage,... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_10 | {
"fields": [
{
"declarator": "investmentPlanService",
"modifier": "private",
"original_string": "private QualityInvestmentPlanService investmentPlanService;",
"type": "QualityInvestmentPlanService",
"var_name": "investmentPlanService"
},
{
"declarator": "profitCalculat... | {
"body": "@Test\n public void shouldGenerateInvestmentPlanForOneArtefact() {\n QualityViolation violation1 = new QualityViolation(new Artefact(\"org.project.A\", \"\"), createRequirementOnlyWithCriteria(new QualityCriteria(\"cc\", \"<\", 5.0)), 50, 0, 0.0, \"ncloc\");\n QualityViolation violation2 = new Quali... | {
"fields": [
{
"declarator": "profitCalculator",
"modifier": "private final",
"original_string": "private final ProfitCalculator profitCalculator;",
"type": "ProfitCalculator",
"var_name": "profitCalculator"
}
],
"file": "investment-decision-making/src/main/java/org/codeqinv... | {
"body": "public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) {\n Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create();\n for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(basePackage,... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_47 | {
"fields": [
{
"declarator": "profile",
"modifier": "private",
"original_string": "private QualityProfile profile;",
"type": "QualityProfile",
"var_name": "profile"
},
{
"declarator": "firstRequirement",
"modifier": "private",
"original_string": "private Qu... | {
"body": "@Test\n public void addCodeChangeProbabilityToArtefacts() throws CodeChurnCalculationException, ScmConnectionEncodingException, ResourceNotFoundException {\n Artefact artefactA = new Artefact(\"A\", \"A\");\n Artefact artefactB = new Artefact(\"B\", \"B\");\n\n ViolationOccurence violationA = new... | {
"fields": [
{
"declarator": "violationsCalculatorService",
"modifier": "private final",
"original_string": "private final ViolationsCalculatorService violationsCalculatorService;",
"type": "ViolationsCalculatorService",
"var_name": "violationsCalculatorService"
},
{
"... | {
"body": "@Override\n public QualityAnalysis analyzeProject(Project project) {\n try {\n ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project);\n if (!violationsAnalysisResult.isSuccessful()) {\n log.error(\"Quality analysis for project {}... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_51 | {
"fields": [
{
"declarator": "profile",
"modifier": "private",
"original_string": "private QualityProfile profile;",
"type": "QualityProfile",
"var_name": "profile"
},
{
"declarator": "firstRequirement",
"modifier": "private",
"original_string": "private Qu... | {
"body": "@Test\n public void failedAnalysisWhenViolationAnalysisWasNotSuccessful() throws CodeChurnCalculationException, ScmConnectionEncodingException {\n ViolationsCalculatorService violationsCalculatorService = mock(ViolationsCalculatorService.class);\n when(violationsCalculatorService.calculateAllViolati... | {
"fields": [
{
"declarator": "violationsCalculatorService",
"modifier": "private final",
"original_string": "private final ViolationsCalculatorService violationsCalculatorService;",
"type": "ViolationsCalculatorService",
"var_name": "violationsCalculatorService"
},
{
"... | {
"body": "@Override\n public QualityAnalysis analyzeProject(Project project) {\n try {\n ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project);\n if (!violationsAnalysisResult.isSuccessful()) {\n log.error(\"Quality analysis for project {}... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_92 | {
"fields": [
{
"declarator": "roiDistributionFilter",
"modifier": "private",
"original_string": "private RoiDistributionFilter roiDistributionFilter;",
"type": "RoiDistributionFilter",
"var_name": "roiDistributionFilter"
}
],
"file": "web-ui/src/test/java/org/codeqinvest/web... | {
"body": "@Test\n public void notFailWhenNumberOfArtefactsToFilterIsBiggerThanActualArtefacts() {\n Map<String, Integer> roiByArtefact = Maps.newHashMap();\n roiByArtefact.put(\"A\", 10);\n List<RoiDistribution> roiDistribution = Arrays.asList(new RoiDistribution(0, roiByArtefact));\n assertThat(roiDist... | {
"fields": [],
"file": "web-ui/src/main/java/org/codeqinvest/web/investment/roi/RoiDistributionFilter.java",
"identifier": "RoiDistributionFilter",
"interfaces": "",
"methods": [
{
"class_method_signature": "RoiDistributionFilter.filterHighestRoi(Collection<RoiDistribution> roiDistributions, int nu... | {
"body": "Collection<RoiDistribution> filterHighestRoi(Collection<RoiDistribution> roiDistributions, int numberOfBestElements) {\n Map<Integer, RoiDistribution> filteredRoiDistributionsByInvest = Maps.newHashMap();\n for (RoiDistribution distribution : roiDistributions) {\n filteredRoiDistributionsByInves... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_7 | {
"fields": [
{
"declarator": "investmentPlanService",
"modifier": "private",
"original_string": "private QualityInvestmentPlanService investmentPlanService;",
"type": "QualityInvestmentPlanService",
"var_name": "investmentPlanService"
},
{
"declarator": "profitCalculat... | {
"body": "@Test\n public void shouldChooseViolationsWithMoreProfit() {\n QualityViolation violation1 = new QualityViolation(new Artefact(\"org.A\", \"\"), createRequirementOnlyWithCriteria(new QualityCriteria(\"cc\", \"<\", 5.0)), 50, 0, 0.0, \"ncloc\");\n QualityViolation violation2 = new QualityViolation(ne... | {
"fields": [
{
"declarator": "profitCalculator",
"modifier": "private final",
"original_string": "private final ProfitCalculator profitCalculator;",
"type": "ProfitCalculator",
"var_name": "profitCalculator"
}
],
"file": "investment-decision-making/src/main/java/org/codeqinv... | {
"body": "public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) {\n Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create();\n for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(basePackage,... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_84 | {
"fields": [],
"file": "quality-assessment/src/test/java/org/codeqinvest/quality/ArtefactTest.java",
"identifier": "ArtefactTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldConvertFullyQualifiedClassNameToShortClassName() {\n assertThat(new Artefact(\"org.util.MyClass\", \"\").getShortClassName()).isEqualTo(\"MyClass\");\n }",
"class_method_signature": "ArtefactTest.shouldConvertFullyQualifiedClassNameToShortClassName()",
"constructor": fals... | {
"fields": [
{
"declarator": "id",
"modifier": "@Id\n @GeneratedValue\n private",
"original_string": "@Id\n @GeneratedValue\n private Long id;",
"type": "Long",
"var_name": "id"
},
{
"declarator": "name",
"modifier": "@Column(nullable = false)\n private",
... | {
"body": "public String getShortClassName() {\n String className = null;\n for (String packageName : Splitter.on('.').split(name)) {\n className = packageName;\n }\n return className;\n }",
"class_method_signature": "Artefact.getShortClassName()",
"constructor": false,
"full_signature": "publ... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_107 | {
"fields": [
{
"declarator": "validator",
"modifier": "private",
"original_string": "private ProjectConnectionsValidator validator;",
"type": "ProjectConnectionsValidator",
"var_name": "validator"
},
{
"declarator": "projectValidator",
"modifier": "private",
... | {
"body": "@Test\n public void shouldCallSuppliedProjectValidator() {\n when(sonarConnectionCheckerService.isReachable(any(SonarConnectionSettings.class))).thenReturn(true);\n mockAvailableScmSystem();\n validateProject(project);\n verify(projectValidator).validate(any(), any(Errors.class));\n }",
"cl... | {
"fields": [
{
"declarator": "projectValidator",
"modifier": "private final",
"original_string": "private final ProjectValidator projectValidator;",
"type": "ProjectValidator",
"var_name": "projectValidator"
},
{
"declarator": "sonarConnectionCheckerService",
"mo... | {
"body": "@Override\n public void validate(Object target, Errors errors) {\n ValidationUtils.invokeValidator(projectValidator, target, errors);\n Project project = (Project) target;\n if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) {\n errors.rejectValue(\"sonarCo... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_71 | {
"fields": [
{
"declarator": "defaultSonarHost = \"http://localhost\"",
"modifier": "private final",
"original_string": "private final String defaultSonarHost = \"http://localhost\";",
"type": "String",
"var_name": "defaultSonarHost"
},
{
"declarator": "profile",
... | {
"body": "@Test\n public void violationsWhenRequirementsAreViolatedInOneArtefact() {\n FakeResourcesCollectorService resourcesCollectorService = new FakeResourcesCollectorService();\n resourcesCollectorService.addResource(\"A\");\n resourcesCollectorService.addResource(\"B\");\n\n FakeMetricCollectorSer... | {
"fields": [
{
"declarator": "sonarConnectionCheckerService",
"modifier": "private final",
"original_string": "private final SonarConnectionCheckerService sonarConnectionCheckerService;",
"type": "SonarConnectionCheckerService",
"var_name": "sonarConnectionCheckerService"
},
... | {
"body": "ViolationsAnalysisResult calculateAllViolation(Project project) {\n if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) {\n return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(),\n \"sonar project is not reachable... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_26 | {
"fields": [
{
"declarator": "availabilityCheckerService",
"modifier": "private",
"original_string": "private SvnServerAvailabilityCheckerService availabilityCheckerService;",
"type": "SvnServerAvailabilityCheckerService",
"var_name": "availabilityCheckerService"
}
],
"file"... | {
"body": "@Test\n public void notAvailableWhenScmSettingsAreNull() {\n assertThat(availabilityCheckerService.isAvailable(null)).isFalse();\n }",
"class_method_signature": "SvnServerAvailabilityCheckerServiceTest.notAvailableWhenScmSettingsAreNull()",
"constructor": false,
"full_signature": "@Test public v... | {
"fields": [],
"file": "code-changes-analyzer/src/main/java/org/codeqinvest/codechanges/scm/svn/SvnServerAvailabilityCheckerService.java",
"identifier": "SvnServerAvailabilityCheckerService",
"interfaces": "implements ScmAvailabilityCheckerService",
"methods": [
{
"class_method_signature": "SvnServ... | {
"body": "@Override\n public boolean isAvailable(ScmConnectionSettings connectionSettings) {\n if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) {\n return false;\n }\n\n try {\n SvnRepositoryFactory.create(connectionSettings).testConnection();\n log.info(... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_30 | {
"fields": [],
"file": "code-changes-analyzer/src/test/java/org/codeqinvest/codechanges/scm/svn/SvnFileTest.java",
"identifier": "SvnFileTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void countLinesWithSuppliedSeparator() {\n assertThat(new SvnFile(\"1a2a3\", \"a\").countLines()).isEqualTo(3);\n }",
"class_method_signature": "SvnFileTest.countLinesWithSuppliedSeparator()",
"constructor": false,
"full_signature": "@Test public void countLinesWithSuppliedSeparat... | {
"fields": [
{
"declarator": "content",
"modifier": "private final",
"original_string": "private final String content;",
"type": "String",
"var_name": "content"
},
{
"declarator": "lineSeparator",
"modifier": "private final",
"original_string": "private fin... | {
"body": "int countLines() {\n if (content.isEmpty()) {\n return 0;\n }\n return content.split(lineSeparator).length;\n }",
"class_method_signature": "SvnFile.countLines()",
"constructor": false,
"full_signature": " int countLines()",
"identifier": "countLines",
"invocations": [
"isEmpty... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_88 | {
"fields": [
{
"declarator": "analyzerRunsSchedulerOnStartup",
"modifier": "private",
"original_string": "private QualityAnalyzerRunsSchedulerOnStartup analyzerRunsSchedulerOnStartup;",
"type": "QualityAnalyzerRunsSchedulerOnStartup",
"var_name": "analyzerRunsSchedulerOnStartup"
... | {
"body": "@Test\n public void preventSchedulingProjectsTwice() {\n analyzerRunsSchedulerOnStartup.onApplicationEvent(null);\n analyzerRunsSchedulerOnStartup.onApplicationEvent(null);\n verify(analyzerScheduler, times(1)).scheduleAnalyzer(projectA);\n verify(analyzerScheduler, times(1)).scheduleAnalyzer(... | {
"fields": [
{
"declarator": "analyzerScheduler",
"modifier": "private final",
"original_string": "private final QualityAnalyzerScheduler analyzerScheduler;",
"type": "QualityAnalyzerScheduler",
"var_name": "analyzerScheduler"
},
{
"declarator": "projectRepository",
... | {
"body": "@Override\n public void onApplicationEvent(ContextRefreshedEvent event) {\n if (alreadyExecuted.compareAndSet(false, true)) {\n List<Project> projects = projectRepository.findAll();\n log.info(\"Schedule analyzer jobs for {} projects\", projects.size());\n for (Project project : projects... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_67 | {
"fields": [
{
"declarator": "analyzerRunnable",
"modifier": "private",
"original_string": "private AnalyzerRunnable analyzerRunnable;",
"type": "AnalyzerRunnable",
"var_name": "analyzerRunnable"
},
{
"declarator": "project",
"modifier": "private",
"origina... | {
"body": "@Test\n public void notFailWhenProjectIsNotRetrievableViaRepository() {\n when(projectRepository.findOne(1L)).thenReturn(null);\n analyzerRunnable.run();\n }",
"class_method_signature": "AnalyzerRunnableTest.notFailWhenProjectIsNotRetrievableViaRepository()",
"constructor": false,
"full_signa... | {
"fields": [
{
"declarator": "projectId",
"modifier": "private final",
"original_string": "private final long projectId;",
"type": "long",
"var_name": "projectId"
},
{
"declarator": "projectRepository",
"modifier": "private final",
"original_string": "priva... | {
"body": "@Override\n public void run() {\n Project project = projectRepository.findOne(projectId);\n if (project != null) {\n project.setHadAnalysis(true);\n projectRepository.save(project);\n\n log.info(\"Start analyzer run for project {}\", project.getName());\n qualityAnalyzerService.a... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_48 | {
"fields": [
{
"declarator": "profile",
"modifier": "private",
"original_string": "private QualityProfile profile;",
"type": "QualityProfile",
"var_name": "profile"
},
{
"declarator": "firstRequirement",
"modifier": "private",
"original_string": "private Qu... | {
"body": "@Test\n public void addSecureChangeProbabilityToArtefacts() throws CodeChurnCalculationException, ScmConnectionEncodingException, ResourceNotFoundException {\n Artefact artefactA = new Artefact(\"A\", \"A\");\n Artefact artefactB = new Artefact(\"B\", \"B\");\n\n ViolationOccurence violationA = n... | {
"fields": [
{
"declarator": "violationsCalculatorService",
"modifier": "private final",
"original_string": "private final ViolationsCalculatorService violationsCalculatorService;",
"type": "ViolationsCalculatorService",
"var_name": "violationsCalculatorService"
},
{
"... | {
"body": "@Override\n public QualityAnalysis analyzeProject(Project project) {\n try {\n ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project);\n if (!violationsAnalysisResult.isSuccessful()) {\n log.error(\"Quality analysis for project {}... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_104 | {
"fields": [
{
"declarator": "validator",
"modifier": "private",
"original_string": "private CodeChangeSettingsValidator validator;",
"type": "CodeChangeSettingsValidator",
"var_name": "validator"
}
],
"file": "web-ui/src/test/java/org/codeqinvest/web/project/CodeChangeSetti... | {
"body": "@Test\n public void shouldNotSupportOtherTypeThanCodeChangeSettings() {\n assertThat(validator.supports(Object.class)).isFalse();\n }",
"class_method_signature": "CodeChangeSettingsValidatorTest.shouldNotSupportOtherTypeThanCodeChangeSettings()",
"constructor": false,
"full_signature": "@Test pu... | {
"fields": [],
"file": "web-ui/src/main/java/org/codeqinvest/web/project/CodeChangeSettingsValidator.java",
"identifier": "CodeChangeSettingsValidator",
"interfaces": "implements Validator",
"methods": [
{
"class_method_signature": "CodeChangeSettingsValidator.supports(Class<?> clazz)",
"cons... | {
"body": "@Override\n public boolean supports(Class<?> clazz) {\n return CodeChangeSettings.class.equals(clazz);\n }",
"class_method_signature": "CodeChangeSettingsValidator.supports(Class<?> clazz)",
"constructor": false,
"full_signature": "@Override public boolean supports(Class<?> clazz)",
"identifie... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_72 | {
"fields": [
{
"declarator": "defaultSonarHost = \"http://localhost\"",
"modifier": "private final",
"original_string": "private final String defaultSonarHost = \"http://localhost\";",
"type": "String",
"var_name": "defaultSonarHost"
},
{
"declarator": "profile",
... | {
"body": "@Test\n public void violationsWhenRequirementsAreViolatedInManyArtefact() {\n FakeResourcesCollectorService resourcesCollectorService = new FakeResourcesCollectorService();\n resourcesCollectorService.addResource(\"A\");\n resourcesCollectorService.addResource(\"B\");\n resourcesCollectorServi... | {
"fields": [
{
"declarator": "sonarConnectionCheckerService",
"modifier": "private final",
"original_string": "private final SonarConnectionCheckerService sonarConnectionCheckerService;",
"type": "SonarConnectionCheckerService",
"var_name": "sonarConnectionCheckerService"
},
... | {
"body": "ViolationsAnalysisResult calculateAllViolation(Project project) {\n if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) {\n return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(),\n \"sonar project is not reachable... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_25 | {
"fields": [
{
"declarator": "codeChurnCalculatorFactory",
"modifier": "@Autowired\n private",
"original_string": "@Autowired\n private CodeChurnCalculatorFactory codeChurnCalculatorFactory;",
"type": "CodeChurnCalculatorFactory",
"var_name": "codeChurnCalculatorFactory"
}
]... | {
"body": "@Test\n public void createSvnCodeChurnCalculatorForSvnType() {\n ScmConnectionSettings connectionSettings = mock(ScmConnectionSettings.class);\n when(connectionSettings.getType()).thenReturn(SupportedScmSystem.SVN.getType());\n assertThat(codeChurnCalculatorFactory.create(connectionSettings)).isI... | {
"fields": [
{
"declarator": "svnCodeChurnCalculator",
"modifier": "private final",
"original_string": "private final SvnCodeChurnCalculatorService svnCodeChurnCalculator;",
"type": "SvnCodeChurnCalculatorService",
"var_name": "svnCodeChurnCalculator"
}
],
"file": "code-chan... | {
"body": "public CodeChurnCalculator create(ScmConnectionSettings connectionSettings) {\n if (connectionSettings.getType() == SupportedScmSystem.SVN.getType()) {\n return svnCodeChurnCalculator;\n }\n throw new UnsupportedScmSystem();\n }",
"class_method_signature": "CodeChurnCalculatorFactory.creat... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_33 | {
"fields": [
{
"declarator": "A = new ProjectInformation(\"A\", \"\")",
"modifier": "private",
"original_string": "private ProjectInformation A = new ProjectInformation(\"A\", \"\");",
"type": "ProjectInformation",
"var_name": "A"
},
{
"declarator": "B = new ProjectInf... | {
"body": "@Test\n public void A_is_sorted_before_B() {\n assertThat(A.compareTo(B)).isEqualTo(comesBefore);\n }",
"class_method_signature": "ProjectInformationTest.A_is_sorted_before_B()",
"constructor": false,
"full_signature": "@Test public void A_is_sorted_before_B()",
"identifier": "A_is_sorted_befo... | {
"fields": [
{
"declarator": "name",
"modifier": "private",
"original_string": "private String name;",
"type": "String",
"var_name": "name"
},
{
"declarator": "resourceKey",
"modifier": "private",
"original_string": "private String resourceKey;",
"typ... | {
"body": "@Override\n public int compareTo(Object o) {\n if (o != null) {\n ProjectInformation otherProjectInformation = (ProjectInformation) o;\n if (otherProjectInformation.getName() != null && this.getName() != null) {\n return this.name.compareToIgnoreCase(otherProjectInformati... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_64 | {
"fields": [
{
"declarator": "analyzerRunnable",
"modifier": "private",
"original_string": "private AnalyzerRunnable analyzerRunnable;",
"type": "AnalyzerRunnable",
"var_name": "analyzerRunnable"
},
{
"declarator": "project",
"modifier": "private",
"origina... | {
"body": "@Test\n public void retrieveProjectWithRepositoryFromDatabaseAndTriggerAnalysisAfterwards() {\n analyzerRunnable.run();\n InOrder inOrder = inOrder(projectRepository, analyzerService);\n inOrder.verify(projectRepository).findOne(1L);\n inOrder.verify(analyzerService).analyzeProject(project);\n... | {
"fields": [
{
"declarator": "projectId",
"modifier": "private final",
"original_string": "private final long projectId;",
"type": "long",
"var_name": "projectId"
},
{
"declarator": "projectRepository",
"modifier": "private final",
"original_string": "priva... | {
"body": "@Override\n public void run() {\n Project project = projectRepository.findOne(projectId);\n if (project != null) {\n project.setHadAnalysis(true);\n projectRepository.save(project);\n\n log.info(\"Start analyzer run for project {}\", project.getName());\n qualityAnalyzerService.a... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_8 | {
"fields": [
{
"declarator": "investmentPlanService",
"modifier": "private",
"original_string": "private QualityInvestmentPlanService investmentPlanService;",
"type": "QualityInvestmentPlanService",
"var_name": "investmentPlanService"
},
{
"declarator": "profitCalculat... | {
"body": "@Test\n public void shouldChooseViolationWithBiggerRoiWhenProfitIsTheSame() {\n QualityViolation violationWithSmallerRoi = new QualityViolation(new Artefact(\"org.A\", \"\"), createRequirementOnlyWithCriteria(new QualityCriteria(\"cc\", \"<\", 5.0)), 50, 0, 0.0, \"ncloc\");\n QualityViolation violat... | {
"fields": [
{
"declarator": "profitCalculator",
"modifier": "private final",
"original_string": "private final ProfitCalculator profitCalculator;",
"type": "ProfitCalculator",
"var_name": "profitCalculator"
}
],
"file": "investment-decision-making/src/main/java/org/codeqinv... | {
"body": "public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) {\n Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create();\n for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(basePackage,... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_13 | {
"fields": [
{
"declarator": "parser",
"modifier": "private",
"original_string": "private InvestmentAmountParser parser;",
"type": "InvestmentAmountParser",
"var_name": "parser"
}
],
"file": "investment-decision-making/src/test/java/org/codeqinvest/investment/InvestmentAmoun... | {
"body": "@Test\n public void shouldParseHoursProperly() throws InvestmentParsingException {\n assertThat(parser.parseMinutes(\"3h\")).isEqualTo(180);\n }",
"class_method_signature": "InvestmentAmountParserTest.shouldParseHoursProperly()",
"constructor": false,
"full_signature": "@Test public void shouldP... | {
"fields": [],
"file": "investment-decision-making/src/main/java/org/codeqinvest/investment/InvestmentAmountParser.java",
"identifier": "InvestmentAmountParser",
"interfaces": "",
"methods": [
{
"class_method_signature": "InvestmentAmountParser.parseMinutes(String formattedInvestmentAmount)",
... | {
"body": "public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException {\n if (formattedInvestmentAmount.isEmpty()) {\n return 0;\n }\n\n Pattern pattern = Pattern.compile(\"(\\\\d*h)?\\\\s?(\\\\d*m)?\");\n Matcher matcher = pattern.matcher(formattedInvestmentAmount);\... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_108 | {
"fields": [
{
"declarator": "validator",
"modifier": "private",
"original_string": "private ScmConnectionSettingsValidator validator;",
"type": "ScmConnectionSettingsValidator",
"var_name": "validator"
}
],
"file": "web-ui/src/test/java/org/codeqinvest/web/project/ScmConnec... | {
"body": "@Test\n public void shouldSupportScmConnectionSettingsType() {\n assertThat(validator.supports(ScmConnectionSettings.class)).isTrue();\n }",
"class_method_signature": "ScmConnectionSettingsValidatorTest.shouldSupportScmConnectionSettingsType()",
"constructor": false,
"full_signature": "@Test pub... | {
"fields": [],
"file": "web-ui/src/main/java/org/codeqinvest/web/project/ScmConnectionSettingsValidator.java",
"identifier": "ScmConnectionSettingsValidator",
"interfaces": "implements Validator",
"methods": [
{
"class_method_signature": "ScmConnectionSettingsValidator.supports(Class<?> clazz)",
... | {
"body": "@Override\n public boolean supports(Class<?> clazz) {\n return ScmConnectionSettings.class.equals(clazz);\n }",
"class_method_signature": "ScmConnectionSettingsValidator.supports(Class<?> clazz)",
"constructor": false,
"full_signature": "@Override public boolean supports(Class<?> clazz)",
"ide... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_44 | {
"fields": [
{
"declarator": "sonarConnectionCheckerService",
"modifier": "private",
"original_string": "private SonarConnectionCheckerService sonarConnectionCheckerService;",
"type": "SonarConnectionCheckerService",
"var_name": "sonarConnectionCheckerService"
}
],
"file": "... | {
"body": "@Test\n public void notReachableWhenUrlOfConnectionSettingsIsEmpty() {\n assertThat(sonarConnectionCheckerService.isReachable(new SonarConnectionSettings(\"\"))).isFalse();\n }",
"class_method_signature": "SonarConnectionCheckerServiceTest.notReachableWhenUrlOfConnectionSettingsIsEmpty()",
"constr... | {
"fields": [
{
"declarator": "OK = 200",
"modifier": "private static final",
"original_string": "private static final int OK = 200;",
"type": "int",
"var_name": "OK"
}
],
"file": "metrics-collector/src/main/java/org/codeqinvest/sonar/SonarConnectionCheckerService.java",
"i... | {
"body": "public boolean isReachable(SonarConnectionSettings connectionSettings) {\n if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) {\n return false;\n }\n\n HttpClient4Connector connector = new HttpClient4Connector(connectionSettings.asHostObject());\n try {\n... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_52 | {
"fields": [
{
"declarator": "profile",
"modifier": "private",
"original_string": "private QualityProfile profile;",
"type": "QualityProfile",
"var_name": "profile"
},
{
"declarator": "firstRequirement",
"modifier": "private",
"original_string": "private Qu... | {
"body": "@Test\n public void failedAnalysisWhenScmSystemIsNotAvailable() {\n // set up scm system that is not available\n ScmAvailabilityCheckerService notAvailableScmSystem = mock(ScmAvailabilityCheckerService.class);\n when(notAvailableScmSystem.isAvailable(any(ScmConnectionSettings.class))).thenReturn(... | {
"fields": [
{
"declarator": "violationsCalculatorService",
"modifier": "private final",
"original_string": "private final ViolationsCalculatorService violationsCalculatorService;",
"type": "ViolationsCalculatorService",
"var_name": "violationsCalculatorService"
},
{
"... | {
"body": "@Override\n public QualityAnalysis analyzeProject(Project project) {\n try {\n ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project);\n if (!violationsAnalysisResult.isSuccessful()) {\n log.error(\"Quality analysis for project {}... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_91 | {
"fields": [
{
"declarator": "roiDistributionFilter",
"modifier": "private",
"original_string": "private RoiDistributionFilter roiDistributionFilter;",
"type": "RoiDistributionFilter",
"var_name": "roiDistributionFilter"
}
],
"file": "web-ui/src/test/java/org/codeqinvest/web... | {
"body": "@Test\n public void filterCorrectNumberOfBestRois() {\n Map<String, Integer> roiByArtefact = Maps.newHashMap();\n roiByArtefact.put(\"A\", 10);\n roiByArtefact.put(\"B\", 10);\n roiByArtefact.put(\"C\", 10);\n List<RoiDistribution> roiDistribution = Arrays.asList(new RoiDistribution(0, roiB... | {
"fields": [],
"file": "web-ui/src/main/java/org/codeqinvest/web/investment/roi/RoiDistributionFilter.java",
"identifier": "RoiDistributionFilter",
"interfaces": "",
"methods": [
{
"class_method_signature": "RoiDistributionFilter.filterHighestRoi(Collection<RoiDistribution> roiDistributions, int nu... | {
"body": "Collection<RoiDistribution> filterHighestRoi(Collection<RoiDistribution> roiDistributions, int numberOfBestElements) {\n Map<Integer, RoiDistribution> filteredRoiDistributionsByInvest = Maps.newHashMap();\n for (RoiDistribution distribution : roiDistributions) {\n filteredRoiDistributionsByInves... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_29 | {
"fields": [],
"file": "code-changes-analyzer/src/test/java/org/codeqinvest/codechanges/scm/svn/SvnFileRevisionTest.java",
"identifier": "SvnFileRevisionTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldParseFilePartOutOfOldPathProperly() throws SVNException {\n ScmConnectionSettings connectionSettings = new ScmConnectionSettings(\"http://svn.apache.org/repos/asf/commons/proper/configuration/trunk/src/main/java\");\n SvnFileRevision fileRevision = new SvnFileRevision(0L,\n... | {
"fields": [
{
"declarator": "revision",
"modifier": "private final",
"original_string": "private final long revision;",
"type": "long",
"var_name": "revision"
},
{
"declarator": "oldPath",
"modifier": "private final",
"original_string": "private final Stri... | {
"body": "String getFilePartOfOldPath(ScmConnectionSettings connectionSettings) throws SVNException {\n SVNURL svnurl = SVNURL.parseURIEncoded(connectionSettings.getUrl());\n\n List<String> splittedBasePath = splitUrl(svnurl.getPath());\n List<String> splittedOldPath = splitUrl(oldPath);\n int i = 0;\n ... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_4 | {
"fields": [
{
"declarator": "investmentPlanService",
"modifier": "private",
"original_string": "private QualityInvestmentPlanService investmentPlanService;",
"type": "QualityInvestmentPlanService",
"var_name": "investmentPlanService"
},
{
"declarator": "profitCalculat... | {
"body": "@Test\n public void calculatesRoiBasedOnRemediationCostsAndProfit() {\n QualityInvestmentPlan qualityInvestmentPlan = investmentPlanService.computeInvestmentPlan(analysis, \"\", 80);\n assertThat(qualityInvestmentPlan.getRoi()).isEqualTo(375); // 300 / 80 * 100\n }",
"class_method_signature": "Qu... | {
"fields": [
{
"declarator": "profitCalculator",
"modifier": "private final",
"original_string": "private final ProfitCalculator profitCalculator;",
"type": "ProfitCalculator",
"var_name": "profitCalculator"
}
],
"file": "investment-decision-making/src/main/java/org/codeqinv... | {
"body": "public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) {\n Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create();\n for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(basePackage,... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_68 | {
"fields": [
{
"declarator": "defaultSonarHost = \"http://localhost\"",
"modifier": "private final",
"original_string": "private final String defaultSonarHost = \"http://localhost\";",
"type": "String",
"var_name": "defaultSonarHost"
},
{
"declarator": "profile",
... | {
"body": "@Test\n public void failedViolationAnalysisResultWhenSonarProjectIsNotReachable() {\n SonarConnectionSettings connectionSettings = new SonarConnectionSettings(defaultSonarHost, \"abc\");\n Project project = mock(Project.class);\n when(project.getSonarConnectionSettings()).thenReturn(connectionSet... | {
"fields": [
{
"declarator": "sonarConnectionCheckerService",
"modifier": "private final",
"original_string": "private final SonarConnectionCheckerService sonarConnectionCheckerService;",
"type": "SonarConnectionCheckerService",
"var_name": "sonarConnectionCheckerService"
},
... | {
"body": "ViolationsAnalysisResult calculateAllViolation(Project project) {\n if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) {\n return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(),\n \"sonar project is not reachable... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_87 | {
"fields": [
{
"declarator": "analyzerRunsSchedulerOnStartup",
"modifier": "private",
"original_string": "private QualityAnalyzerRunsSchedulerOnStartup analyzerRunsSchedulerOnStartup;",
"type": "QualityAnalyzerRunsSchedulerOnStartup",
"var_name": "analyzerRunsSchedulerOnStartup"
... | {
"body": "@Test\n public void scheduleAllProjects() {\n analyzerRunsSchedulerOnStartup.onApplicationEvent(null);\n verify(analyzerScheduler).scheduleAnalyzer(projectA);\n verify(analyzerScheduler).scheduleAnalyzer(projectB);\n verify(analyzerScheduler).scheduleAnalyzer(projectC);\n }",
"class_method_... | {
"fields": [
{
"declarator": "analyzerScheduler",
"modifier": "private final",
"original_string": "private final QualityAnalyzerScheduler analyzerScheduler;",
"type": "QualityAnalyzerScheduler",
"var_name": "analyzerScheduler"
},
{
"declarator": "projectRepository",
... | {
"body": "@Override\n public void onApplicationEvent(ContextRefreshedEvent event) {\n if (alreadyExecuted.compareAndSet(false, true)) {\n List<Project> projects = projectRepository.findAll();\n log.info(\"Schedule analyzer jobs for {} projects\", projects.size());\n for (Project project : projects... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_69 | {
"fields": [
{
"declarator": "defaultSonarHost = \"http://localhost\"",
"modifier": "private final",
"original_string": "private final String defaultSonarHost = \"http://localhost\";",
"type": "String",
"var_name": "defaultSonarHost"
},
{
"declarator": "profile",
... | {
"body": "@Test\n public void failedViolationAnalysisResultWhenOneMetricValueIsNotReachable() throws ResourceNotFoundException {\n Resource dummyResource = new Resource();\n ResourcesCollectorService resourcesCollectorService = mock(ResourcesCollectorService.class);\n when(resourcesCollectorService.collect... | {
"fields": [
{
"declarator": "sonarConnectionCheckerService",
"modifier": "private final",
"original_string": "private final SonarConnectionCheckerService sonarConnectionCheckerService;",
"type": "SonarConnectionCheckerService",
"var_name": "sonarConnectionCheckerService"
},
... | {
"body": "ViolationsAnalysisResult calculateAllViolation(Project project) {\n if (!sonarConnectionCheckerService.isReachable(project.getSonarConnectionSettings())) {\n return ViolationsAnalysisResult.createFailedAnalysis(Collections.<ViolationOccurence>emptyList(),\n \"sonar project is not reachable... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_86 | {
"fields": [],
"file": "quality-assessment/src/test/java/org/codeqinvest/quality/ArtefactTest.java",
"identifier": "ArtefactTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldConvertEmptyFullyQualifiedClassNameToShortClassName() {\n assertThat(new Artefact(\"\", \"\").getShortClassName()).isEqualTo(\"\");\n }",
"class_method_signature": "ArtefactTest.shouldConvertEmptyFullyQualifiedClassNameToShortClassName()",
"constructor": false,
"full_si... | {
"fields": [
{
"declarator": "id",
"modifier": "@Id\n @GeneratedValue\n private",
"original_string": "@Id\n @GeneratedValue\n private Long id;",
"type": "Long",
"var_name": "id"
},
{
"declarator": "name",
"modifier": "@Column(nullable = false)\n private",
... | {
"body": "public String getShortClassName() {\n String className = null;\n for (String packageName : Splitter.on('.').split(name)) {\n className = packageName;\n }\n return className;\n }",
"class_method_signature": "Artefact.getShortClassName()",
"constructor": false,
"full_signature": "publ... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_5 | {
"fields": [
{
"declarator": "investmentPlanService",
"modifier": "private",
"original_string": "private QualityInvestmentPlanService investmentPlanService;",
"type": "QualityInvestmentPlanService",
"var_name": "investmentPlanService"
},
{
"declarator": "profitCalculat... | {
"body": "@Test\n public void containsAllQualityViolationsSortedByProfitAndRemediationCosts() {\n QualityInvestmentPlan qualityInvestmentPlan = investmentPlanService.computeInvestmentPlan(analysis, \"\", 80);\n QualityInvestmentPlanEntry[] investments = qualityInvestmentPlan.getEntries().toArray(new QualityIn... | {
"fields": [
{
"declarator": "profitCalculator",
"modifier": "private final",
"original_string": "private final ProfitCalculator profitCalculator;",
"type": "ProfitCalculator",
"var_name": "profitCalculator"
}
],
"file": "investment-decision-making/src/main/java/org/codeqinv... | {
"body": "public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) {\n Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create();\n for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(basePackage,... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_28 | {
"fields": [
{
"declarator": "availabilityCheckerService",
"modifier": "private",
"original_string": "private SvnServerAvailabilityCheckerService availabilityCheckerService;",
"type": "SvnServerAvailabilityCheckerService",
"var_name": "availabilityCheckerService"
}
],
"file"... | {
"body": "@Test\n public void notAvailableWhenUrlOfScmSettingsIsEmpty() {\n assertThat(availabilityCheckerService.isAvailable(new ScmConnectionSettings(\"\"))).isFalse();\n }",
"class_method_signature": "SvnServerAvailabilityCheckerServiceTest.notAvailableWhenUrlOfScmSettingsIsEmpty()",
"constructor": false... | {
"fields": [],
"file": "code-changes-analyzer/src/main/java/org/codeqinvest/codechanges/scm/svn/SvnServerAvailabilityCheckerService.java",
"identifier": "SvnServerAvailabilityCheckerService",
"interfaces": "implements ScmAvailabilityCheckerService",
"methods": [
{
"class_method_signature": "SvnServ... | {
"body": "@Override\n public boolean isAvailable(ScmConnectionSettings connectionSettings) {\n if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) {\n return false;\n }\n\n try {\n SvnRepositoryFactory.create(connectionSettings).testConnection();\n log.info(... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_90 | {
"fields": [
{
"declarator": "validator",
"modifier": "private",
"original_string": "private SonarServerValidator validator;",
"type": "SonarServerValidator",
"var_name": "validator"
}
],
"file": "web-ui/src/test/java/org/codeqinvest/web/sonar/SonarServerValidatorTest.java",... | {
"body": "@Test\n public void shouldNotSupportOtherTypeThanSonarServer() {\n assertThat(validator.supports(Object.class)).isFalse();\n }",
"class_method_signature": "SonarServerValidatorTest.shouldNotSupportOtherTypeThanSonarServer()",
"constructor": false,
"full_signature": "@Test public void shouldNotSu... | {
"fields": [],
"file": "web-ui/src/main/java/org/codeqinvest/web/sonar/SonarServerValidator.java",
"identifier": "SonarServerValidator",
"interfaces": "implements Validator",
"methods": [
{
"class_method_signature": "SonarServerValidator.supports(Class<?> clazz)",
"constructor": false,
... | {
"body": "@Override\n public boolean supports(Class<?> clazz) {\n return SonarServer.class.equals(clazz);\n }",
"class_method_signature": "SonarServerValidator.supports(Class<?> clazz)",
"constructor": false,
"full_signature": "@Override public boolean supports(Class<?> clazz)",
"identifier": "supports"... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_53 | {
"fields": [
{
"declarator": "profile",
"modifier": "private",
"original_string": "private QualityProfile profile;",
"type": "QualityProfile",
"var_name": "profile"
},
{
"declarator": "firstRequirement",
"modifier": "private",
"original_string": "private Qu... | {
"body": "@Test\n public void failedAnalysisWhenProblemWithCodeChurnCalculationOccurred() throws CodeChurnCalculationException, ScmConnectionEncodingException {\n QualityAnalyzerService qualityAnalyzerService = createMockedSystemThatThrowsExceptionInCodeChangeCalculation(CodeChurnCalculationException.class);\n ... | {
"fields": [
{
"declarator": "violationsCalculatorService",
"modifier": "private final",
"original_string": "private final ViolationsCalculatorService violationsCalculatorService;",
"type": "ViolationsCalculatorService",
"var_name": "violationsCalculatorService"
},
{
"... | {
"body": "@Override\n public QualityAnalysis analyzeProject(Project project) {\n try {\n ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project);\n if (!violationsAnalysisResult.isSuccessful()) {\n log.error(\"Quality analysis for project {}... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_45 | {
"fields": [
{
"declarator": "profile",
"modifier": "private",
"original_string": "private QualityProfile profile;",
"type": "QualityProfile",
"var_name": "profile"
},
{
"declarator": "firstRequirement",
"modifier": "private",
"original_string": "private Qu... | {
"body": "@Test\n public void succeededAnalysisWithOneViolation() throws CodeChurnCalculationException, ScmConnectionEncodingException {\n Artefact artefact = new Artefact(\"A\", \"A\");\n QualityAnalyzerService qualityAnalyzerService = createMockedSystemWithArtefactsAndViolations(\n Arrays.asList(new ... | {
"fields": [
{
"declarator": "violationsCalculatorService",
"modifier": "private final",
"original_string": "private final ViolationsCalculatorService violationsCalculatorService;",
"type": "ViolationsCalculatorService",
"var_name": "violationsCalculatorService"
},
{
"... | {
"body": "@Override\n public QualityAnalysis analyzeProject(Project project) {\n try {\n ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project);\n if (!violationsAnalysisResult.isSuccessful()) {\n log.error(\"Quality analysis for project {}... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_109 | {
"fields": [
{
"declarator": "validator",
"modifier": "private",
"original_string": "private ScmConnectionSettingsValidator validator;",
"type": "ScmConnectionSettingsValidator",
"var_name": "validator"
}
],
"file": "web-ui/src/test/java/org/codeqinvest/web/project/ScmConnec... | {
"body": "@Test\n public void shouldNotSupportOtherTypeThanScmConnectionSettings() {\n assertThat(validator.supports(Object.class)).isFalse();\n }",
"class_method_signature": "ScmConnectionSettingsValidatorTest.shouldNotSupportOtherTypeThanScmConnectionSettings()",
"constructor": false,
"full_signature": ... | {
"fields": [],
"file": "web-ui/src/main/java/org/codeqinvest/web/project/ScmConnectionSettingsValidator.java",
"identifier": "ScmConnectionSettingsValidator",
"interfaces": "implements Validator",
"methods": [
{
"class_method_signature": "ScmConnectionSettingsValidator.supports(Class<?> clazz)",
... | {
"body": "@Override\n public boolean supports(Class<?> clazz) {\n return ScmConnectionSettings.class.equals(clazz);\n }",
"class_method_signature": "ScmConnectionSettingsValidator.supports(Class<?> clazz)",
"constructor": false,
"full_signature": "@Override public boolean supports(Class<?> clazz)",
"ide... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_12 | {
"fields": [
{
"declarator": "parser",
"modifier": "private",
"original_string": "private InvestmentAmountParser parser;",
"type": "InvestmentAmountParser",
"var_name": "parser"
}
],
"file": "investment-decision-making/src/test/java/org/codeqinvest/investment/InvestmentAmoun... | {
"body": "@Test\n public void emptyStringShouldBeParsedToZeroMinutes() throws InvestmentParsingException {\n assertThat(parser.parseMinutes(\"\")).isEqualTo(0);\n }",
"class_method_signature": "InvestmentAmountParserTest.emptyStringShouldBeParsedToZeroMinutes()",
"constructor": false,
"full_signature": "@... | {
"fields": [],
"file": "investment-decision-making/src/main/java/org/codeqinvest/investment/InvestmentAmountParser.java",
"identifier": "InvestmentAmountParser",
"interfaces": "",
"methods": [
{
"class_method_signature": "InvestmentAmountParser.parseMinutes(String formattedInvestmentAmount)",
... | {
"body": "public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException {\n if (formattedInvestmentAmount.isEmpty()) {\n return 0;\n }\n\n Pattern pattern = Pattern.compile(\"(\\\\d*h)?\\\\s?(\\\\d*m)?\");\n Matcher matcher = pattern.matcher(formattedInvestmentAmount);\... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_9 | {
"fields": [
{
"declarator": "investmentPlanService",
"modifier": "private",
"original_string": "private QualityInvestmentPlanService investmentPlanService;",
"type": "QualityInvestmentPlanService",
"var_name": "investmentPlanService"
},
{
"declarator": "profitCalculat... | {
"body": "@Test\n public void shouldNotConsiderViolationsWithNegativeProfit() {\n when(profitCalculator.calculateProfit(any(QualityViolation.class))).thenReturn(-0.1);\n\n QualityInvestmentPlan qualityInvestmentPlan = investmentPlanService.computeInvestmentPlan(analysis, \"\", 50);\n assertThat(qualityInve... | {
"fields": [
{
"declarator": "profitCalculator",
"modifier": "private final",
"original_string": "private final ProfitCalculator profitCalculator;",
"type": "ProfitCalculator",
"var_name": "profitCalculator"
}
],
"file": "investment-decision-making/src/main/java/org/codeqinv... | {
"body": "public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) {\n Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create();\n for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(basePackage,... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_65 | {
"fields": [
{
"declarator": "analyzerRunnable",
"modifier": "private",
"original_string": "private AnalyzerRunnable analyzerRunnable;",
"type": "AnalyzerRunnable",
"var_name": "analyzerRunnable"
},
{
"declarator": "project",
"modifier": "private",
"origina... | {
"body": "@Test\n public void markProjectAsHadAnalysis() {\n analyzerRunnable.run();\n verify(project).setHadAnalysis(true);\n }",
"class_method_signature": "AnalyzerRunnableTest.markProjectAsHadAnalysis()",
"constructor": false,
"full_signature": "@Test public void markProjectAsHadAnalysis()",
"iden... | {
"fields": [
{
"declarator": "projectId",
"modifier": "private final",
"original_string": "private final long projectId;",
"type": "long",
"var_name": "projectId"
},
{
"declarator": "projectRepository",
"modifier": "private final",
"original_string": "priva... | {
"body": "@Override\n public void run() {\n Project project = projectRepository.findOne(projectId);\n if (project != null) {\n project.setHadAnalysis(true);\n projectRepository.save(project);\n\n log.info(\"Start analyzer run for project {}\", project.getName());\n qualityAnalyzerService.a... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_32 | {
"fields": [],
"file": "code-changes-analyzer/src/test/java/org/codeqinvest/codechanges/scm/svn/SvnFileTest.java",
"identifier": "SvnFileTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void countLineCorrectlyWhenSeparatorConsistsOfManyCharacters() {\n assertThat(new SvnFile(\"111abc222abc333\", \"abc\").countLines()).isEqualTo(3);\n }",
"class_method_signature": "SvnFileTest.countLineCorrectlyWhenSeparatorConsistsOfManyCharacters()",
"constructor": false,
"full_... | {
"fields": [
{
"declarator": "content",
"modifier": "private final",
"original_string": "private final String content;",
"type": "String",
"var_name": "content"
},
{
"declarator": "lineSeparator",
"modifier": "private final",
"original_string": "private fin... | {
"body": "int countLines() {\n if (content.isEmpty()) {\n return 0;\n }\n return content.split(lineSeparator).length;\n }",
"class_method_signature": "SvnFile.countLines()",
"constructor": false,
"full_signature": " int countLines()",
"identifier": "countLines",
"invocations": [
"isEmpty... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_24 | {
"fields": [
{
"declarator": "codeChurnCalculatorFactory",
"modifier": "@Autowired\n private",
"original_string": "@Autowired\n private CodeChurnCalculatorFactory codeChurnCalculatorFactory;",
"type": "CodeChurnCalculatorFactory",
"var_name": "codeChurnCalculatorFactory"
}
]... | {
"body": "@Test(expected = UnsupportedScmSystem.class)\n public void shouldFailForNotSupportedSvmTypesWithException() {\n ScmConnectionSettings connectionSettings = mock(ScmConnectionSettings.class);\n when(connectionSettings.getType()).thenReturn(Integer.MAX_VALUE);\n codeChurnCalculatorFactory.create(con... | {
"fields": [
{
"declarator": "svnCodeChurnCalculator",
"modifier": "private final",
"original_string": "private final SvnCodeChurnCalculatorService svnCodeChurnCalculator;",
"type": "SvnCodeChurnCalculatorService",
"var_name": "svnCodeChurnCalculator"
}
],
"file": "code-chan... | {
"body": "public CodeChurnCalculator create(ScmConnectionSettings connectionSettings) {\n if (connectionSettings.getType() == SupportedScmSystem.SVN.getType()) {\n return svnCodeChurnCalculator;\n }\n throw new UnsupportedScmSystem();\n }",
"class_method_signature": "CodeChurnCalculatorFactory.creat... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_73 | {
"fields": [
{
"declarator": "analyzerScheduler",
"modifier": "private",
"original_string": "private QualityAnalyzerScheduler analyzerScheduler;",
"type": "QualityAnalyzerScheduler",
"var_name": "analyzerScheduler"
},
{
"declarator": "projectRepository",
"modifie... | {
"body": "@Test\n public void scheduleProjectForAnalysis() {\n assertThat(analyzerScheduler.scheduleAnalyzer(project)).isTrue();\n }",
"class_method_signature": "DefaultQualityAnalyzerSchedulerTest.scheduleProjectForAnalysis()",
"constructor": false,
"full_signature": "@Test public void scheduleProjectFor... | {
"fields": [
{
"declarator": "DEFAULT_POOL_SIZE = 10",
"modifier": "private static final",
"original_string": "private static final int DEFAULT_POOL_SIZE = 10;",
"type": "int",
"var_name": "DEFAULT_POOL_SIZE"
},
{
"declarator": "scheduler = new ThreadPoolTaskScheduler(... | {
"body": "public boolean scheduleAnalyzer(Project project) {\n if (alreadyScheduledProjects.contains(project)) {\n log.info(\"Project {} is already scheduled!\", project.getName());\n return false;\n }\n alreadyScheduledProjects.add(project);\n\n QualityAnalyzerService qualityAnalyzerService = ... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_105 | {
"fields": [
{
"declarator": "validator",
"modifier": "private",
"original_string": "private ProjectConnectionsValidator validator;",
"type": "ProjectConnectionsValidator",
"var_name": "validator"
},
{
"declarator": "projectValidator",
"modifier": "private",
... | {
"body": "@Test\n public void shouldSupportProjectType() {\n assertThat(validator.supports(Project.class)).isTrue();\n }",
"class_method_signature": "ProjectConnectionsValidatorTest.shouldSupportProjectType()",
"constructor": false,
"full_signature": "@Test public void shouldSupportProjectType()",
"iden... | {
"fields": [
{
"declarator": "projectValidator",
"modifier": "private final",
"original_string": "private final ProjectValidator projectValidator;",
"type": "ProjectValidator",
"var_name": "projectValidator"
},
{
"declarator": "sonarConnectionCheckerService",
"mo... | {
"body": "@Override\n public boolean supports(Class<?> clazz) {\n return Project.class.equals(clazz);\n }",
"class_method_signature": "ProjectConnectionsValidator.supports(Class<?> clazz)",
"constructor": false,
"full_signature": "@Override public boolean supports(Class<?> clazz)",
"identifier": "suppor... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_49 | {
"fields": [
{
"declarator": "profile",
"modifier": "private",
"original_string": "private QualityProfile profile;",
"type": "QualityProfile",
"var_name": "profile"
},
{
"declarator": "firstRequirement",
"modifier": "private",
"original_string": "private Qu... | {
"body": "@Test\n public void failedAnalysisWhenSecureChangeProbabilityCalculatorThrowsResourceNotFoundException()\n throws CodeChurnCalculationException, ScmConnectionEncodingException, ResourceNotFoundException {\n\n ViolationOccurence violation = new ViolationOccurence(firstRequirement, new Artefact(\"A\... | {
"fields": [
{
"declarator": "violationsCalculatorService",
"modifier": "private final",
"original_string": "private final ViolationsCalculatorService violationsCalculatorService;",
"type": "ViolationsCalculatorService",
"var_name": "violationsCalculatorService"
},
{
"... | {
"body": "@Override\n public QualityAnalysis analyzeProject(Project project) {\n try {\n ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project);\n if (!violationsAnalysisResult.isSuccessful()) {\n log.error(\"Quality analysis for project {}... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_15 | {
"fields": [
{
"declarator": "parser",
"modifier": "private",
"original_string": "private InvestmentAmountParser parser;",
"type": "InvestmentAmountParser",
"var_name": "parser"
}
],
"file": "investment-decision-making/src/test/java/org/codeqinvest/investment/InvestmentAmoun... | {
"body": "@Test\n public void shouldParseHoursAndMinutesProperly() throws InvestmentParsingException {\n assertThat(parser.parseMinutes(\"3h 70m\")).isEqualTo(250);\n }",
"class_method_signature": "InvestmentAmountParserTest.shouldParseHoursAndMinutesProperly()",
"constructor": false,
"full_signature": "@... | {
"fields": [],
"file": "investment-decision-making/src/main/java/org/codeqinvest/investment/InvestmentAmountParser.java",
"identifier": "InvestmentAmountParser",
"interfaces": "",
"methods": [
{
"class_method_signature": "InvestmentAmountParser.parseMinutes(String formattedInvestmentAmount)",
... | {
"body": "public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException {\n if (formattedInvestmentAmount.isEmpty()) {\n return 0;\n }\n\n Pattern pattern = Pattern.compile(\"(\\\\d*h)?\\\\s?(\\\\d*m)?\");\n Matcher matcher = pattern.matcher(formattedInvestmentAmount);\... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_42 | {
"fields": [
{
"declarator": "sonarConnectionCheckerService",
"modifier": "private",
"original_string": "private SonarConnectionCheckerService sonarConnectionCheckerService;",
"type": "SonarConnectionCheckerService",
"var_name": "sonarConnectionCheckerService"
}
],
"file": "... | {
"body": "@Test\n public void notReachableWhenConnectionSettingsAreNull() {\n assertThat(sonarConnectionCheckerService.isReachable(null)).isFalse();\n }",
"class_method_signature": "SonarConnectionCheckerServiceTest.notReachableWhenConnectionSettingsAreNull()",
"constructor": false,
"full_signature": "@Te... | {
"fields": [
{
"declarator": "OK = 200",
"modifier": "private static final",
"original_string": "private static final int OK = 200;",
"type": "int",
"var_name": "OK"
}
],
"file": "metrics-collector/src/main/java/org/codeqinvest/sonar/SonarConnectionCheckerService.java",
"i... | {
"body": "public boolean isReachable(SonarConnectionSettings connectionSettings) {\n if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) {\n return false;\n }\n\n HttpClient4Connector connector = new HttpClient4Connector(connectionSettings.asHostObject());\n try {\n... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_54 | {
"fields": [
{
"declarator": "profile",
"modifier": "private",
"original_string": "private QualityProfile profile;",
"type": "QualityProfile",
"var_name": "profile"
},
{
"declarator": "firstRequirement",
"modifier": "private",
"original_string": "private Qu... | {
"body": "@Test\n public void failedAnalysisWhenProblemWithScmConnectionEncodingOccurred() throws CodeChurnCalculationException, ScmConnectionEncodingException {\n QualityAnalyzerService qualityAnalyzerService = createMockedSystemThatThrowsExceptionInCodeChangeCalculation(ScmConnectionEncodingException.class);\n... | {
"fields": [
{
"declarator": "violationsCalculatorService",
"modifier": "private final",
"original_string": "private final ViolationsCalculatorService violationsCalculatorService;",
"type": "ViolationsCalculatorService",
"var_name": "violationsCalculatorService"
},
{
"... | {
"body": "@Override\n public QualityAnalysis analyzeProject(Project project) {\n try {\n ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project);\n if (!violationsAnalysisResult.isSuccessful()) {\n log.error(\"Quality analysis for project {}... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_78 | {
"fields": [
{
"declarator": "qualityProfile = new QualityProfile(\"quality-profile\")",
"modifier": "private final",
"original_string": "private final QualityProfile qualityProfile = new QualityProfile(\"quality-profile\");",
"type": "QualityProfile",
"var_name": "qualityProfile"
... | {
"body": "@Test\n public void calculateRemediationCostsProperlyForGreaterOperator() throws ResourceNotFoundException {\n QualityRequirement requirement = new QualityRequirement(qualityProfile, 20, 30, 100, \"nloc\", new QualityCriteria(\"metric\", \">\", 10.0));\n ViolationOccurence violation = new ViolationO... | {
"fields": [
{
"declarator": "metricCollectorService",
"modifier": "private final",
"original_string": "private final MetricCollectorService metricCollectorService;",
"type": "MetricCollectorService",
"var_name": "metricCollectorService"
}
],
"file": "quality-assessment/src/... | {
"body": "public int calculateRemediationCosts(SonarConnectionSettings sonarConnectionSettings, ViolationOccurence violation) throws ResourceNotFoundException {\n log.info(\"Calculating remediation costs for {} with violated criteria {}\", violation.getArtefact().getName(), violation.getRequirement().getCriteria(... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_97 | {
"fields": [
{
"declarator": "generator",
"modifier": "private",
"original_string": "private InvestmentOpportunitiesJsonGenerator generator;",
"type": "InvestmentOpportunitiesJsonGenerator",
"var_name": "generator"
},
{
"declarator": "weightedProfitCalculator",
"... | {
"body": "@Test\n public void emptyAnalysis() throws IOException {\n QualityAnalysis analysis = QualityAnalysis.success(project, Collections.<QualityViolation>emptyList());\n String expectedJson = \"{ \\\"name\\\": \\\"Dummy Project\\\", \\\"allChildren\\\": [], \\\"children\\\": []}\";\n assertThat(genera... | {
"fields": [
{
"declarator": "MAPPER = new ObjectMapper()",
"modifier": "private static final",
"original_string": "private static final ObjectMapper MAPPER = new ObjectMapper();",
"type": "ObjectMapper",
"var_name": "MAPPER"
},
{
"declarator": "PACKAGE_SPLITTER = Spli... | {
"body": "public String generate(QualityAnalysis analysis) throws JsonProcessingException {\n Set<String> alreadyAddedArtefacts = Sets.newHashSet();\n Map<String, PackageNode> nodeLookupTable = Maps.newHashMap();\n RootNode rootNode = new RootNode(analysis.getProject().getName());\n\n for (QualityViolati... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_39 | {
"fields": [
{
"declarator": "A = new ProjectInformation(\"A\", \"\")",
"modifier": "private",
"original_string": "private ProjectInformation A = new ProjectInformation(\"A\", \"\");",
"type": "ProjectInformation",
"var_name": "A"
},
{
"declarator": "B = new ProjectInf... | {
"body": "@Test\n public void compared__valid_projectInfo_to_null_is_sorted_after() {\n assertThat(nullName.compareTo(A)).isEqualTo(comesAfter);\n }",
"class_method_signature": "ProjectInformationTest.compared__valid_projectInfo_to_null_is_sorted_after()",
"constructor": false,
"full_signature": "@Test pu... | {
"fields": [
{
"declarator": "name",
"modifier": "private",
"original_string": "private String name;",
"type": "String",
"var_name": "name"
},
{
"declarator": "resourceKey",
"modifier": "private",
"original_string": "private String resourceKey;",
"typ... | {
"body": "@Override\n public int compareTo(Object o) {\n if (o != null) {\n ProjectInformation otherProjectInformation = (ProjectInformation) o;\n if (otherProjectInformation.getName() != null && this.getName() != null) {\n return this.name.compareToIgnoreCase(otherProjectInformati... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_2 | {
"fields": [
{
"declarator": "investmentPlanService",
"modifier": "private",
"original_string": "private QualityInvestmentPlanService investmentPlanService;",
"type": "QualityInvestmentPlanService",
"var_name": "investmentPlanService"
},
{
"declarator": "profitCalculat... | {
"body": "@Test\n public void whenInvestmentIsBiggerThanPossibleOverallProfitOnlyThePossibleProfitShouldBeCalculated() {\n QualityInvestmentPlan qualityInvestmentPlan = investmentPlanService.computeInvestmentPlan(analysis, \"\", 100);\n assertThat(qualityInvestmentPlan.getProfitInMinutes()).isEqualTo(300);\n ... | {
"fields": [
{
"declarator": "profitCalculator",
"modifier": "private final",
"original_string": "private final ProfitCalculator profitCalculator;",
"type": "ProfitCalculator",
"var_name": "profitCalculator"
}
],
"file": "investment-decision-making/src/main/java/org/codeqinv... | {
"body": "public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) {\n Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create();\n for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(basePackage,... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_81 | {
"fields": [],
"file": "quality-assessment/src/test/java/org/codeqinvest/quality/ArtefactTest.java",
"identifier": "ArtefactTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldConvertPackageNameToFilenameProperly() {\n assertThat(new Artefact(\"org.my.class.AbcDe\", \"\").getFilename()).isEqualTo(\"org/my/class/AbcDe.java\");\n }",
"class_method_signature": "ArtefactTest.shouldConvertPackageNameToFilenameProperly()",
"constructor": false,
"fu... | {
"fields": [
{
"declarator": "id",
"modifier": "@Id\n @GeneratedValue\n private",
"original_string": "@Id\n @GeneratedValue\n private Long id;",
"type": "Long",
"var_name": "id"
},
{
"declarator": "name",
"modifier": "@Column(nullable = false)\n private",
... | {
"body": "public String getFilename() {\n if (name.isEmpty()) {\n return \"\";\n }\n return name.replace('.', '/') + \".java\";\n }",
"class_method_signature": "Artefact.getFilename()",
"constructor": false,
"full_signature": "public String getFilename()",
"identifier": "getFilename",
"invoc... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_19 | {
"fields": [
{
"declarator": "calculator",
"modifier": "private",
"original_string": "private ProfitCalculator calculator;",
"type": "ProfitCalculator",
"var_name": "calculator"
},
{
"declarator": "artefact",
"modifier": "private",
"original_string": "priva... | {
"body": "@Test\n public void profitForViolationWhereArtefactHasManualEstimate() {\n when(requirement.isAutomaticallyFixable()).thenReturn(true);\n when(artefact.getManualEstimate()).thenReturn(80);\n when(artefact.hasManualEstimate()).thenReturn(true);\n assertThat(calculator.calculateProfit(violation)... | {
"fields": [],
"file": "investment-decision-making/src/main/java/org/codeqinvest/investment/profit/ProfitCalculator.java",
"identifier": "ProfitCalculator",
"interfaces": "",
"methods": [
{
"class_method_signature": "ProfitCalculator.calculateProfit(QualityViolation violation)",
"constructor"... | {
"body": "public double calculateProfit(QualityViolation violation) {\n double nonRemediationCosts = violation.getNonRemediationCosts() * (violation.getArtefact().hasManualEstimate()\n ? violation.getArtefact().getManualEstimate() / 100.0\n : violation.getArtefact().getChangeProbability());\n\n r... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_102 | {
"fields": [
{
"declarator": "validName = \"MyProject\"",
"modifier": "private final",
"original_string": "private final String validName = \"MyProject\";",
"type": "String",
"var_name": "validName"
},
{
"declarator": "validCronExpression = \"* * * * * *\"",
"mod... | {
"body": "@Test\n public void shouldNotSupportOtherTypeThanProject() {\n assertThat(validator.supports(Object.class)).isFalse();\n }",
"class_method_signature": "ProjectValidatorTest.shouldNotSupportOtherTypeThanProject()",
"constructor": false,
"full_signature": "@Test public void shouldNotSupportOtherTy... | {
"fields": [
{
"declarator": "projectRepository",
"modifier": "private final",
"original_string": "private final ProjectRepository projectRepository;",
"type": "ProjectRepository",
"var_name": "projectRepository"
},
{
"declarator": "profileRepository",
"modifier"... | {
"body": "@Override\n public boolean supports(Class<?> clazz) {\n return Project.class.equals(clazz);\n }",
"class_method_signature": "ProjectValidator.supports(Class<?> clazz)",
"constructor": false,
"full_signature": "@Override public boolean supports(Class<?> clazz)",
"identifier": "supports",
"inv... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_58 | {
"fields": [
{
"declarator": "codeChangeProbabilityCalculatorFactory",
"modifier": "@Autowired\n private",
"original_string": "@Autowired\n private CodeChangeProbabilityCalculatorFactory codeChangeProbabilityCalculatorFactory;",
"type": "CodeChangeProbabilityCalculatorFactory",
"v... | {
"body": "@Test\n public void createCalculatorWithCorrectNumberOfDaysForDefaultSetting() {\n assertThat(((DefaultCodeChangeProbabilityCalculator)\n codeChangeProbabilityCalculatorFactory.create(CodeChangeSettings.defaultSetting(30))).getDays())\n .isEqualTo(30);\n }",
"class_method_signature": "... | {
"fields": [
{
"declarator": "codeChurnCalculatorFactory",
"modifier": "@Getter\n private final",
"original_string": "@Getter\n private final CodeChurnCalculatorFactory codeChurnCalculatorFactory;",
"type": "CodeChurnCalculatorFactory",
"var_name": "codeChurnCalculatorFactory"
... | {
"body": "CodeChangeProbabilityCalculator create(CodeChangeSettings codeChangeSettings) {\n if (codeChangeSettings.getMethod() == SupportedCodeChangeProbabilityMethod.WEIGHTED.getId()) {\n return new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, LocalDate.now(), codeChangeSettings.getDa... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_74 | {
"fields": [
{
"declarator": "analyzerScheduler",
"modifier": "private",
"original_string": "private QualityAnalyzerScheduler analyzerScheduler;",
"type": "QualityAnalyzerScheduler",
"var_name": "analyzerScheduler"
},
{
"declarator": "projectRepository",
"modifie... | {
"body": "@Test\n public void failToScheduleProjectTwice() {\n analyzerScheduler.scheduleAnalyzer(project);\n assertThat(analyzerScheduler.scheduleAnalyzer(project)).isFalse();\n }",
"class_method_signature": "DefaultQualityAnalyzerSchedulerTest.failToScheduleProjectTwice()",
"constructor": false,
"ful... | {
"fields": [
{
"declarator": "DEFAULT_POOL_SIZE = 10",
"modifier": "private static final",
"original_string": "private static final int DEFAULT_POOL_SIZE = 10;",
"type": "int",
"var_name": "DEFAULT_POOL_SIZE"
},
{
"declarator": "scheduler = new ThreadPoolTaskScheduler(... | {
"body": "public boolean scheduleAnalyzer(Project project) {\n if (alreadyScheduledProjects.contains(project)) {\n log.info(\"Project {} is already scheduled!\", project.getName());\n return false;\n }\n alreadyScheduledProjects.add(project);\n\n QualityAnalyzerService qualityAnalyzerService = ... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_23 | {
"fields": [],
"file": "code-changes-analyzer/src/test/java/org/codeqinvest/codechanges/CommitBasedCodeChangeProbabilityCalculatorTest.java",
"identifier": "CommitBasedCodeChangeProbabilityCalculatorTest",
"interfaces": "",
"superclass": "extends AbstractCodeChangeProbabilityCalculatorTest"
} | {
"body": "@Test\n public void maxPossibleProbabilityShouldBeOne() throws CodeChurnCalculationException, ScmConnectionEncodingException {\n fakeCodeChurnCalculator.addCodeChurnWithoutDay(\"A\", new CodeChurn(Arrays.asList(10.0)));\n CodeChangeProbabilityCalculator codeChangeProbabilityCalculator = new CommitBa... | {
"fields": [
{
"declarator": "codeChurnCalculatorFactory",
"modifier": "private final",
"original_string": "private final CodeChurnCalculatorFactory codeChurnCalculatorFactory;",
"type": "CodeChurnCalculatorFactory",
"var_name": "codeChurnCalculatorFactory"
},
{
"decla... | {
"body": "@Override\n public double calculateCodeChangeProbability(ScmConnectionSettings connectionSettings, String file)\n throws CodeChurnCalculationException, ScmConnectionEncodingException {\n\n log.info(\"Calculate code change probability for file {}\", file);\n\n final CodeChurnCalculator codeChurn... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_35 | {
"fields": [
{
"declarator": "A = new ProjectInformation(\"A\", \"\")",
"modifier": "private",
"original_string": "private ProjectInformation A = new ProjectInformation(\"A\", \"\");",
"type": "ProjectInformation",
"var_name": "A"
},
{
"declarator": "B = new ProjectInf... | {
"body": "@Test\n public void B_is_sorted_after_A() {\n assertThat(B.compareTo(A)).isEqualTo(comesAfter);\n }",
"class_method_signature": "ProjectInformationTest.B_is_sorted_after_A()",
"constructor": false,
"full_signature": "@Test public void B_is_sorted_after_A()",
"identifier": "B_is_sorted_after_A"... | {
"fields": [
{
"declarator": "name",
"modifier": "private",
"original_string": "private String name;",
"type": "String",
"var_name": "name"
},
{
"declarator": "resourceKey",
"modifier": "private",
"original_string": "private String resourceKey;",
"typ... | {
"body": "@Override\n public int compareTo(Object o) {\n if (o != null) {\n ProjectInformation otherProjectInformation = (ProjectInformation) o;\n if (otherProjectInformation.getName() != null && this.getName() != null) {\n return this.name.compareToIgnoreCase(otherProjectInformati... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_62 | {
"fields": [
{
"declarator": "secureChangeProbabilityCalculator",
"modifier": "private",
"original_string": "private SecureChangeProbabilityCalculator secureChangeProbabilityCalculator;",
"type": "SecureChangeProbabilityCalculator",
"var_name": "secureChangeProbabilityCalculator"
... | {
"body": "@Test\n public void profileWithOneChangeRiskAssessmentFunction() throws ResourceNotFoundException {\n metricCollectorService.addMetricValue(\"A\", \"metric\", 9.0);\n\n profile.addChangeRiskAssessmentFunction(new ChangeRiskAssessmentFunction(profile, \"metric\", Sets.newHashSet(new RiskCharge(0.2, \... | {
"fields": [
{
"declarator": "metricCollectorService",
"modifier": "private final",
"original_string": "private final MetricCollectorService metricCollectorService;",
"type": "MetricCollectorService",
"var_name": "metricCollectorService"
}
],
"file": "quality-assessment/src/... | {
"body": "public double calculateSecureChangeProbability(QualityProfile qualityProfile, SonarConnectionSettings sonarConnectionSettings, Artefact artefact) throws ResourceNotFoundException {\n log.info(\"Calculate secure change probability for artefact {}\", artefact.getName());\n double secureChangeProbabilit... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_63 | {
"fields": [
{
"declarator": "secureChangeProbabilityCalculator",
"modifier": "private",
"original_string": "private SecureChangeProbabilityCalculator secureChangeProbabilityCalculator;",
"type": "SecureChangeProbabilityCalculator",
"var_name": "secureChangeProbabilityCalculator"
... | {
"body": "@Test\n public void profileWithManyChangeRiskAssessmentFunctions() throws ResourceNotFoundException {\n metricCollectorService.addMetricValue(\"A\", \"metric1\", 9.0);\n metricCollectorService.addMetricValue(\"A\", \"metric2\", -1.0);\n metricCollectorService.addMetricValue(\"A\", \"metric3\", 0.... | {
"fields": [
{
"declarator": "metricCollectorService",
"modifier": "private final",
"original_string": "private final MetricCollectorService metricCollectorService;",
"type": "MetricCollectorService",
"var_name": "metricCollectorService"
}
],
"file": "quality-assessment/src/... | {
"body": "public double calculateSecureChangeProbability(QualityProfile qualityProfile, SonarConnectionSettings sonarConnectionSettings, Artefact artefact) throws ResourceNotFoundException {\n log.info(\"Calculate secure change probability for artefact {}\", artefact.getName());\n double secureChangeProbabilit... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_34 | {
"fields": [
{
"declarator": "A = new ProjectInformation(\"A\", \"\")",
"modifier": "private",
"original_string": "private ProjectInformation A = new ProjectInformation(\"A\", \"\");",
"type": "ProjectInformation",
"var_name": "A"
},
{
"declarator": "B = new ProjectInf... | {
"body": "@Test\n public void a_is_sorted_before_B() {\n assertThat(a.compareTo(B)).isEqualTo(comesBefore);\n }",
"class_method_signature": "ProjectInformationTest.a_is_sorted_before_B()",
"constructor": false,
"full_signature": "@Test public void a_is_sorted_before_B()",
"identifier": "a_is_sorted_befo... | {
"fields": [
{
"declarator": "name",
"modifier": "private",
"original_string": "private String name;",
"type": "String",
"var_name": "name"
},
{
"declarator": "resourceKey",
"modifier": "private",
"original_string": "private String resourceKey;",
"typ... | {
"body": "@Override\n public int compareTo(Object o) {\n if (o != null) {\n ProjectInformation otherProjectInformation = (ProjectInformation) o;\n if (otherProjectInformation.getName() != null && this.getName() != null) {\n return this.name.compareToIgnoreCase(otherProjectInformati... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_22 | {
"fields": [],
"file": "code-changes-analyzer/src/test/java/org/codeqinvest/codechanges/CommitBasedCodeChangeProbabilityCalculatorTest.java",
"identifier": "CommitBasedCodeChangeProbabilityCalculatorTest",
"interfaces": "",
"superclass": "extends AbstractCodeChangeProbabilityCalculatorTest"
} | {
"body": "@Test\n public void codeChurnForManyLastCommits() throws CodeChurnCalculationException, ScmConnectionEncodingException {\n fakeCodeChurnCalculator.addCodeChurnWithoutDay(\"A\", new CodeChurn(Arrays.asList(0.8)));\n fakeCodeChurnCalculator.addCodeChurnWithoutDay(\"A\", new CodeChurn(Arrays.asList(1.0... | {
"fields": [
{
"declarator": "codeChurnCalculatorFactory",
"modifier": "private final",
"original_string": "private final CodeChurnCalculatorFactory codeChurnCalculatorFactory;",
"type": "CodeChurnCalculatorFactory",
"var_name": "codeChurnCalculatorFactory"
},
{
"decla... | {
"body": "@Override\n public double calculateCodeChangeProbability(ScmConnectionSettings connectionSettings, String file)\n throws CodeChurnCalculationException, ScmConnectionEncodingException {\n\n log.info(\"Calculate code change probability for file {}\", file);\n\n final CodeChurnCalculator codeChurn... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_75 | {
"fields": [
{
"declarator": "analyzerScheduler",
"modifier": "private",
"original_string": "private QualityAnalyzerScheduler analyzerScheduler;",
"type": "QualityAnalyzerScheduler",
"var_name": "analyzerScheduler"
},
{
"declarator": "projectRepository",
"modifie... | {
"body": "@Test\n public void executedProjectShouldBeMarkedAsHadAnalysis() {\n analyzerScheduler.executeAnalyzer(project);\n assertThat(project.hadAnalysis()).isTrue();\n }",
"class_method_signature": "DefaultQualityAnalyzerSchedulerTest.executedProjectShouldBeMarkedAsHadAnalysis()",
"constructor": false... | {
"fields": [
{
"declarator": "DEFAULT_POOL_SIZE = 10",
"modifier": "private static final",
"original_string": "private static final int DEFAULT_POOL_SIZE = 10;",
"type": "int",
"var_name": "DEFAULT_POOL_SIZE"
},
{
"declarator": "scheduler = new ThreadPoolTaskScheduler(... | {
"body": "public void executeAnalyzer(Project project) {\n project.setHadAnalysis(true);\n projectRepository.save(project);\n\n QualityAnalyzerService qualityAnalyzerService = createDefaultQualityAnalyzer();\n scheduler.execute(new AnalyzerRunnable(project, projectRepository, qualityAnalyzerService));\n ... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_59 | {
"fields": [
{
"declarator": "codeChangeProbabilityCalculatorFactory",
"modifier": "@Autowired\n private",
"original_string": "@Autowired\n private CodeChangeProbabilityCalculatorFactory codeChangeProbabilityCalculatorFactory;",
"type": "CodeChangeProbabilityCalculatorFactory",
"v... | {
"body": "@Test\n public void createCalculatorForWeightedSetting() {\n assertThat(codeChangeProbabilityCalculatorFactory.create(CodeChangeSettings.weightedSetting(0)))\n .isInstanceOf(WeightedCodeChangeProbabilityCalculator.class);\n }",
"class_method_signature": "CodeChangeProbabilityCalculatorFactory... | {
"fields": [
{
"declarator": "codeChurnCalculatorFactory",
"modifier": "@Getter\n private final",
"original_string": "@Getter\n private final CodeChurnCalculatorFactory codeChurnCalculatorFactory;",
"type": "CodeChurnCalculatorFactory",
"var_name": "codeChurnCalculatorFactory"
... | {
"body": "CodeChangeProbabilityCalculator create(CodeChangeSettings codeChangeSettings) {\n if (codeChangeSettings.getMethod() == SupportedCodeChangeProbabilityMethod.WEIGHTED.getId()) {\n return new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, LocalDate.now(), codeChangeSettings.getDa... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_103 | {
"fields": [
{
"declarator": "validator",
"modifier": "private",
"original_string": "private CodeChangeSettingsValidator validator;",
"type": "CodeChangeSettingsValidator",
"var_name": "validator"
}
],
"file": "web-ui/src/test/java/org/codeqinvest/web/project/CodeChangeSetti... | {
"body": "@Test\n public void shouldSupportCodeChangeSettingsType() {\n assertThat(validator.supports(CodeChangeSettings.class)).isTrue();\n }",
"class_method_signature": "CodeChangeSettingsValidatorTest.shouldSupportCodeChangeSettingsType()",
"constructor": false,
"full_signature": "@Test public void sho... | {
"fields": [],
"file": "web-ui/src/main/java/org/codeqinvest/web/project/CodeChangeSettingsValidator.java",
"identifier": "CodeChangeSettingsValidator",
"interfaces": "implements Validator",
"methods": [
{
"class_method_signature": "CodeChangeSettingsValidator.supports(Class<?> clazz)",
"cons... | {
"body": "@Override\n public boolean supports(Class<?> clazz) {\n return CodeChangeSettings.class.equals(clazz);\n }",
"class_method_signature": "CodeChangeSettingsValidator.supports(Class<?> clazz)",
"constructor": false,
"full_signature": "@Override public boolean supports(Class<?> clazz)",
"identifie... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_18 | {
"fields": [
{
"declarator": "calculator",
"modifier": "private",
"original_string": "private ProfitCalculator calculator;",
"type": "ProfitCalculator",
"var_name": "calculator"
},
{
"declarator": "artefact",
"modifier": "private",
"original_string": "priva... | {
"body": "@Test\n public void profitForNotAutomaticFixableViolation() {\n when(requirement.isAutomaticallyFixable()).thenReturn(false);\n when(artefact.getSecureChangeProbability()).thenReturn(1.1);\n assertThat(calculator.calculateProfit(violation)).isEqualTo(1.0);\n }",
"class_method_signature": "Prof... | {
"fields": [],
"file": "investment-decision-making/src/main/java/org/codeqinvest/investment/profit/ProfitCalculator.java",
"identifier": "ProfitCalculator",
"interfaces": "",
"methods": [
{
"class_method_signature": "ProfitCalculator.calculateProfit(QualityViolation violation)",
"constructor"... | {
"body": "public double calculateProfit(QualityViolation violation) {\n double nonRemediationCosts = violation.getNonRemediationCosts() * (violation.getArtefact().hasManualEstimate()\n ? violation.getArtefact().getManualEstimate() / 100.0\n : violation.getArtefact().getChangeProbability());\n\n r... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_80 | {
"fields": [
{
"declarator": "qualityProfile = new QualityProfile(\"quality-profile\")",
"modifier": "private final",
"original_string": "private final QualityProfile qualityProfile = new QualityProfile(\"quality-profile\");",
"type": "QualityProfile",
"var_name": "qualityProfile"
... | {
"body": "@Test\n public void calculateNonRemediationCostsProperlyForGreaterEqualsOperator() throws ResourceNotFoundException {\n QualityRequirement requirement = new QualityRequirement(qualityProfile, 20, 30, 100, \"nloc\", new QualityCriteria(\"metric\", \">=\", 5.0));\n ViolationOccurence violation = new V... | {
"fields": [
{
"declarator": "metricCollectorService",
"modifier": "private final",
"original_string": "private final MetricCollectorService metricCollectorService;",
"type": "MetricCollectorService",
"var_name": "metricCollectorService"
}
],
"file": "quality-assessment/src/... | {
"body": "public int calculateNonRemediationCosts(SonarConnectionSettings sonarConnectionSettings, ViolationOccurence violation) throws ResourceNotFoundException {\n log.info(\"Calculating non-remediation costs for {} with violated criteria {}\", violation.getArtefact().getName(), violation.getRequirement().getCr... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_3 | {
"fields": [
{
"declarator": "investmentPlanService",
"modifier": "private",
"original_string": "private QualityInvestmentPlanService investmentPlanService;",
"type": "QualityInvestmentPlanService",
"var_name": "investmentPlanService"
},
{
"declarator": "profitCalculat... | {
"body": "@Test\n public void whenInvestmentIsSmallerThanPossibleOverallProfitOnlyTheInvestedAmountShouldBeCalculated() {\n QualityInvestmentPlan qualityInvestmentPlan = investmentPlanService.computeInvestmentPlan(analysis, \"\", 35);\n assertThat(qualityInvestmentPlan.getProfitInMinutes()).isEqualTo(220);\n ... | {
"fields": [
{
"declarator": "profitCalculator",
"modifier": "private final",
"original_string": "private final ProfitCalculator profitCalculator;",
"type": "ProfitCalculator",
"var_name": "profitCalculator"
}
],
"file": "investment-decision-making/src/main/java/org/codeqinv... | {
"body": "public QualityInvestmentPlan computeInvestmentPlan(QualityAnalysis analysis, String basePackage, int investmentInMinutes) {\n Multimap<Double, QualityViolation> violationsByProfit = ArrayListMultimap.create();\n for (QualityViolation violation : filterViolationsByArtefactNameStartingWith(basePackage,... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_38 | {
"fields": [
{
"declarator": "A = new ProjectInformation(\"A\", \"\")",
"modifier": "private",
"original_string": "private ProjectInformation A = new ProjectInformation(\"A\", \"\");",
"type": "ProjectInformation",
"var_name": "A"
},
{
"declarator": "B = new ProjectInf... | {
"body": "@Test\n public void compared_to_null_name_is_sorted_after() {\n assertThat(B.compareTo(nullName)).isEqualTo(comesAfter);\n }",
"class_method_signature": "ProjectInformationTest.compared_to_null_name_is_sorted_after()",
"constructor": false,
"full_signature": "@Test public void compared_to_null_n... | {
"fields": [
{
"declarator": "name",
"modifier": "private",
"original_string": "private String name;",
"type": "String",
"var_name": "name"
},
{
"declarator": "resourceKey",
"modifier": "private",
"original_string": "private String resourceKey;",
"typ... | {
"body": "@Override\n public int compareTo(Object o) {\n if (o != null) {\n ProjectInformation otherProjectInformation = (ProjectInformation) o;\n if (otherProjectInformation.getName() != null && this.getName() != null) {\n return this.name.compareToIgnoreCase(otherProjectInformati... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_79 | {
"fields": [
{
"declarator": "qualityProfile = new QualityProfile(\"quality-profile\")",
"modifier": "private final",
"original_string": "private final QualityProfile qualityProfile = new QualityProfile(\"quality-profile\");",
"type": "QualityProfile",
"var_name": "qualityProfile"
... | {
"body": "@Test\n public void calculateRemediationCostsProperlyForLessOperator() throws ResourceNotFoundException {\n QualityRequirement requirement = new QualityRequirement(qualityProfile, 20, 30, 100, \"nloc\", new QualityCriteria(\"metric\", \"<\", 1.0));\n ViolationOccurence violation = new ViolationOccur... | {
"fields": [
{
"declarator": "metricCollectorService",
"modifier": "private final",
"original_string": "private final MetricCollectorService metricCollectorService;",
"type": "MetricCollectorService",
"var_name": "metricCollectorService"
}
],
"file": "quality-assessment/src/... | {
"body": "public int calculateRemediationCosts(SonarConnectionSettings sonarConnectionSettings, ViolationOccurence violation) throws ResourceNotFoundException {\n log.info(\"Calculating remediation costs for {} with violated criteria {}\", violation.getArtefact().getName(), violation.getRequirement().getCriteria(... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_96 | {
"fields": [
{
"declarator": "validator",
"modifier": "private",
"original_string": "private SonarConnectionSettingsValidator validator;",
"type": "SonarConnectionSettingsValidator",
"var_name": "validator"
}
],
"file": "web-ui/src/test/java/org/codeqinvest/web/project/Sonar... | {
"body": "@Test\n public void shouldNotSupportOtherTypeThanSonarConnectionSettings() {\n assertThat(validator.supports(Object.class)).isFalse();\n }",
"class_method_signature": "SonarConnectionSettingsValidatorTest.shouldNotSupportOtherTypeThanSonarConnectionSettings()",
"constructor": false,
"full_signat... | {
"fields": [],
"file": "web-ui/src/main/java/org/codeqinvest/web/project/SonarConnectionSettingsValidator.java",
"identifier": "SonarConnectionSettingsValidator",
"interfaces": "implements Validator",
"methods": [
{
"class_method_signature": "SonarConnectionSettingsValidator.supports(Class<?> clazz... | {
"body": "@Override\n public boolean supports(Class<?> clazz) {\n return SonarConnectionSettings.class.equals(clazz);\n }",
"class_method_signature": "SonarConnectionSettingsValidator.supports(Class<?> clazz)",
"constructor": false,
"full_signature": "@Override public boolean supports(Class<?> clazz)",
... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_55 | {
"fields": [
{
"declarator": "profile",
"modifier": "private",
"original_string": "private QualityProfile profile;",
"type": "QualityProfile",
"var_name": "profile"
},
{
"declarator": "firstRequirement",
"modifier": "private",
"original_string": "private Qu... | {
"body": "@Test\n public void failedAnalysisWhenCostCalculatorThrowsResourceNotFoundExceptionOnRemediationCosts() throws CodeChurnCalculationException, ScmConnectionEncodingException, ResourceNotFoundException {\n ViolationsCalculatorService violationsCalculatorService = mock(ViolationsCalculatorService.class);\... | {
"fields": [
{
"declarator": "violationsCalculatorService",
"modifier": "private final",
"original_string": "private final ViolationsCalculatorService violationsCalculatorService;",
"type": "ViolationsCalculatorService",
"var_name": "violationsCalculatorService"
},
{
"... | {
"body": "@Override\n public QualityAnalysis analyzeProject(Project project) {\n try {\n ViolationsAnalysisResult violationsAnalysisResult = violationsCalculatorService.calculateAllViolation(project);\n if (!violationsAnalysisResult.isSuccessful()) {\n log.error(\"Quality analysis for project {}... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_43 | {
"fields": [
{
"declarator": "sonarConnectionCheckerService",
"modifier": "private",
"original_string": "private SonarConnectionCheckerService sonarConnectionCheckerService;",
"type": "SonarConnectionCheckerService",
"var_name": "sonarConnectionCheckerService"
}
],
"file": "... | {
"body": "@Test\n public void notReachableWhenUrlOfConnectionSettingsIsNull() {\n assertThat(sonarConnectionCheckerService.isReachable(new SonarConnectionSettings(null))).isFalse();\n }",
"class_method_signature": "SonarConnectionCheckerServiceTest.notReachableWhenUrlOfConnectionSettingsIsNull()",
"construc... | {
"fields": [
{
"declarator": "OK = 200",
"modifier": "private static final",
"original_string": "private static final int OK = 200;",
"type": "int",
"var_name": "OK"
}
],
"file": "metrics-collector/src/main/java/org/codeqinvest/sonar/SonarConnectionCheckerService.java",
"i... | {
"body": "public boolean isReachable(SonarConnectionSettings connectionSettings) {\n if (connectionSettings == null || Strings.isNullOrEmpty(connectionSettings.getUrl())) {\n return false;\n }\n\n HttpClient4Connector connector = new HttpClient4Connector(connectionSettings.asHostObject());\n try {\n... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
9755019_14 | {
"fields": [
{
"declarator": "parser",
"modifier": "private",
"original_string": "private InvestmentAmountParser parser;",
"type": "InvestmentAmountParser",
"var_name": "parser"
}
],
"file": "investment-decision-making/src/test/java/org/codeqinvest/investment/InvestmentAmoun... | {
"body": "@Test\n public void shouldParseMinutesProperly() throws InvestmentParsingException {\n assertThat(parser.parseMinutes(\"21m\")).isEqualTo(21);\n }",
"class_method_signature": "InvestmentAmountParserTest.shouldParseMinutesProperly()",
"constructor": false,
"full_signature": "@Test public void sho... | {
"fields": [],
"file": "investment-decision-making/src/main/java/org/codeqinvest/investment/InvestmentAmountParser.java",
"identifier": "InvestmentAmountParser",
"interfaces": "",
"methods": [
{
"class_method_signature": "InvestmentAmountParser.parseMinutes(String formattedInvestmentAmount)",
... | {
"body": "public int parseMinutes(String formattedInvestmentAmount) throws InvestmentParsingException {\n if (formattedInvestmentAmount.isEmpty()) {\n return 0;\n }\n\n Pattern pattern = Pattern.compile(\"(\\\\d*h)?\\\\s?(\\\\d*m)?\");\n Matcher matcher = pattern.matcher(formattedInvestmentAmount);\... | {
"created": null,
"fork": null,
"fork_count": 2,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9755019,
"size": 1829,
"stargazer_count": 25,
"stars": null,
"updates": null,
"url": "https://github.com/CodeQInvest/codeq-invest"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.