Skip to content

Commit

Permalink
detektAll
Browse files Browse the repository at this point in the history
  • Loading branch information
nulls committed Jun 6, 2023
1 parent 69edf3d commit c84cc83
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import org.cqfn.diktat.ktlint.DiktatProcessorFactoryImpl
import org.cqfn.diktat.ktlint.DiktatReporterFactoryImpl
import org.cqfn.diktat.ruleset.rules.DiktatRuleSetFactoryImpl

import org.apache.maven.execution.MavenSession
import org.apache.maven.plugin.AbstractMojo
import org.apache.maven.plugin.Mojo
import org.apache.maven.plugin.MojoExecutionException
Expand All @@ -25,12 +24,6 @@ import kotlin.io.path.Path
* Base [Mojo] for checking and fixing code using diktat
*/
abstract class DiktatBaseMojo : AbstractMojo() {
/**
* Flag that indicates whether to turn debug logging on
*/
@Parameter(property = "diktat.debug")
var debug = false

/**
* Property that will be used if you need to publish the report to GitHub
*/
Expand Down Expand Up @@ -82,9 +75,6 @@ abstract class DiktatBaseMojo : AbstractMojo() {
@Parameter(property = "diktat.excludes", defaultValue = "")
lateinit var excludes: List<String>

@Parameter(defaultValue = "\${session}", readonly = true)
private lateinit var mavenSession: MavenSession

/**
* @param runner instance of [DiktatRunner] used in analysis
* @param args arguments for [DiktatRunner]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -774,19 +774,8 @@ class LineLength(configRules: List<RulesConfig>) : DiktatRule(
}
}

/**
* val text = "first part" +
* "second part" +
* "third part"
* STRING_PART_OFFSET equal to the left offset of first string part("first part") =
* white space + close quote (open quote removed by trim) + white space + plus sign
*/
companion object {
private const val MAX_LENGTH = 120L
const val NAME_ID = "line-length"
private const val STRING_PART_OFFSET = 4
private val propertyList = listOf(INTEGER_CONSTANT, LITERAL_STRING_TEMPLATE_ENTRY, FLOAT_CONSTANT,
CHARACTER_CONSTANT, REFERENCE_EXPRESSION, BOOLEAN_CONSTANT, LONG_STRING_TEMPLATE_ENTRY,
SHORT_STRING_TEMPLATE_ENTRY, NULL)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import org.jetbrains.kotlin.psi.KtProperty
* Not recommended: val myVariable: Map<Int, String> = emptyMap<Int, String>() or val myVariable = emptyMap<Int, String>()
* Recommended: val myVariable: Map<Int, String> = emptyMap()
*/
@Suppress("ForbiddenComment")
// FIXME: we now don't have access to return types, so we can perform this check only if explicit type is present, but should be able also if it's not.
class VariableGenericTypeDeclarationRule(configRules: List<RulesConfig>) : DiktatRule(
NAME_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,14 +315,15 @@ fun <T> retry(

var lastError: Throwable? = null

for (i in 1..attempts) {
repeat(attempts) {
try {
return block()
} catch (error: Throwable) {
lastError = error
}

if (delayMillis > 0L) {
@Suppress("SleepInsteadOfDelay")
Thread.sleep(delayMillis)
}
}
Expand Down

0 comments on commit c84cc83

Please sign in to comment.