Skip to content

Commit

Permalink
Fix detekt
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanTimchenkoLightspeed committed Jan 13, 2025
1 parent 1c1f2e5 commit dd5d4d8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,13 @@ nexusPublishing {
// <major>.<minor>.<patch>-dev+<branchname>-SNAPSHOT
fun Project.sanitizeVersion(): String {
val version = version.toString()
val maxLength = 8

Check warning

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning

This expression contains a magic number. Consider defining it to a well named constant.
return if (project.isSnapshotVersion()) {
val githubHeadSha = settingsProvider.githubHeadSHA
if (githubHeadSha != null) {
// github pull request
version
.replace(Regex("-dev\\.\\d+\\+[a-f0-9]+$"), "-dev+${githubHeadSha.take(8)}-SNAPSHOT")
.replace(Regex("-dev\\.\\d+\\+[a-f0-9]+$"), "-dev+${githubHeadSha.take(maxLength)}-SNAPSHOT")
} else {
// local branch
version
Expand Down

0 comments on commit dd5d4d8

Please sign in to comment.