Skip to content

Commit 828665e

Browse files
renaming "method" into "type", for config consistency purpose (#67)
1 parent 68d51ed commit 828665e

5 files changed

Lines changed: 8 additions & 8 deletions

File tree

github-crawler-autoconfigure/src/test/java/com/societegenerale/githubcrawler/GitHubCrawlerIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public void shouldLoadIndicatorsConfig() {
129129
IndicatorDefinition pomXmlIndicatorDefinition1 = crawler.getGitHubCrawlerProperties().getIndicatorsToFetchByFile().get(pomXmlFile).get(0);
130130
assertThat(pomXmlIndicatorDefinition1).isNotNull();
131131
assertThat(pomXmlIndicatorDefinition1.getName()).isEqualTo("spring_boot_starter_parent_version");
132-
assertThat(pomXmlIndicatorDefinition1.getMethod()).isEqualTo("findDependencyVersionInXml");
132+
assertThat(pomXmlIndicatorDefinition1.getType()).isEqualTo("findDependencyVersionInXml");
133133

134134
Map params = pomXmlIndicatorDefinition1.getParams();
135135
assertThat(params).hasSize(1);

github-crawler-autoconfigure/src/test/resources/application-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ github-crawler:
1111
indicatorsToFetchByFile:
1212
"[pom.xml]":
1313
- name: spring_boot_starter_parent_version
14-
method: findDependencyVersionInXml
14+
type: findDependencyVersionInXml
1515
params:
1616
artifactId: spring-boot-starter-parent
1717
Jenkinsfile:
1818
- name: build_helper_package
19-
method: findFirstValueWithRegexpCapture
19+
type: findFirstValueWithRegexpCapture
2020
params:
2121
pattern: "(?s).*com\\.a\\.given\\.package\\BuildHelpers.*"
2222
Dockerfile:
2323
- name: docker_image_used
24-
method: findFirstValueWithRegexpCapture
24+
type: findFirstValueWithRegexpCapture
2525
params:
2626
pattern: "FROM\\s.*\\/(.*)\\s?.*"
2727

github-crawler-core/src/main/kotlin/com/societegenerale/githubcrawler/IndicatorDefinition.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package com.societegenerale.githubcrawler
22

33
//TODO check regularly on https://github.com/spring-projects/spring-boot/issues/8762 if it's solved.
44
// config properties can't binded as immutable values, so we need to have a workaround, declaring all attributes as mutable
5-
// in previous version, name and method were lateinit, but in that case, it wasn't possible (or I didn't find) a way to set the values in unit tests.
5+
// in previous version, name and type were lateinit, but in that case, it wasn't possible (or I didn't find) a way to set the values in unit tests.
66
// we should roll this back to immutable variables whenever Spring Boot will allow us to do it
77
class IndicatorDefinition(var name: String="N/A",
8-
var method: String = "N/A",
8+
var type: String = "N/A",
99
var params: Map<String,String> = HashMap())

github-crawler-core/src/main/kotlin/com/societegenerale/githubcrawler/RepositoryEnricher.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class RepositoryEnricher(val remoteGitHub: RemoteGitHub){
116116
private fun parseIndicatorsFromFileContent(fileContent: String, pathToFileToGetIndicatorsFrom:String, indicatorsToFetch: List<IndicatorDefinition>): Map<String, String> {
117117

118118
return indicatorsToFetch.asSequence()
119-
.map { GitHubCrawler.availableFileContentParsers.get(it.method)!!.parseFileContentForIndicator(fileContent, pathToFileToGetIndicatorsFrom, it) }
119+
.map { GitHubCrawler.availableFileContentParsers.get(it.type)!!.parseFileContentForIndicator(fileContent, pathToFileToGetIndicatorsFrom, it) }
120120
.reduce { acc, item -> acc + item }
121121

122122
}

github-crawler-core/src/main/resources/application.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ github-crawler:
1616
indicatorsToFetchByFile:
1717
"[pom.xml]":
1818
- name: spring_boot_starter_parent_version
19-
method: findDependencyVersionInXml
19+
type: findDependencyVersionInXml
2020
params:
2121
artifactId: spring-boot-starter-parent
2222

0 commit comments

Comments
 (0)