Skip to content

chores: refactor ecoCode rules ECXXX to creedengo GCIXXX #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private const val IMPORT_STR_BLE = "android.bluetooth.le"
private const val ERROR_MESSAGE = "You are using Bluetooth. Did you take a look at the Bluetooth Low Energy API?"
private const val GOOD_PRACTICE_MESSAGE = "Using android.bluetooth.le.* is a good practice."

@Rule(key = "EC518")
@Rule(key = "GCI518")
class BluetoothBleCheck : AbstractCheck() {

override fun visitImportList(importList: KtImportList, data: KotlinFileContext?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ private const val GOOD_IMPORT = "com.google.android.gms.location"
private const val ERROR_MESSAGE =
"Use com.google.android.gms.location instead of android.location to maximize battery life."

@Rule(key = "EC517")
@Rule(key = "GCI517")
class FusedLocationCheck : AbstractCheck() {

override fun visitImportList(importList: KtImportList, data: KotlinFileContext?) {
Expand All @@ -45,4 +45,4 @@ class FusedLocationCheck : AbstractCheck() {
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ecoCode (Android)",
"ruleKeys": [
"EC518",
"EC517"
"GCI518",
"GCI517"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
"eco-design"
],
"defaultSeverity": "Major",
"sqKey": "EC517"
}
"sqKey": "GCI517"
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
"eco-design"
],
"defaultSeverity": "Major",
"sqKey": "EC518"
}
"sqKey": "GCI518"
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ internal class KotlinProfileDefinitionTest {
assertThat(profile.rules().size).isGreaterThan(MIN_RULE_COUNT)
assertThat(profile.rules())
.extracting<String> { obj: BuiltInQualityProfilesDefinition.BuiltInActiveRule -> obj.ruleKey() }
.contains("EC518", "EC517")
.contains("GCI518", "GCI517")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ internal class KotlinRulesDefinitionTest {
val repository = repositoryForVersion(Version.create(8, 9))
Assertions.assertThat(repository!!.name()).isEqualTo("SonarQube")
Assertions.assertThat(repository.language()).isEqualTo("kotlin")
val rule = repository.rule("EC518")!!
val rule = repository.rule("GCI518")!!
Assertions.assertThat(rule.name())
.isEqualTo("Optimized API: Bluetooth Low-Energy")
Assertions.assertThat(rule.type()).isEqualTo(RuleType.CODE_SMELL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ internal class KotlinSensorTest : AbstractSensorTest() {
""".trimIndent()
)
context.fileSystem().add(inputFile)
val checkFactory = checkFactory("EC518")
val checkFactory = checkFactory("GCI518")
sensor(checkFactory).execute(context)
val issues = context.allIssues()
assertThat(issues).hasSize(1)
val issue = issues.iterator().next()
assertThat(issue.ruleKey().rule()).isEqualTo("EC518")
assertThat(issue.ruleKey().rule()).isEqualTo("GCI518")
val location = issue.primaryLocation()
assertThat(location.inputComponent()).isEqualTo(inputFile)
assertThat(location.message())
Expand Down