andrewinci/Insulator

View on GitHub

Showing 9 of 88 total issues

Method validationArea has a Cognitive Complexity of 61 (exceeds 20 allowed). Consider refactoring.
Open

    private fun EventTarget.validationArea() =
        vbox {
            fieldName("Validation")
            if (viewModel.cluster.isSchemaRegistryConfigured()) {
                hbox(alignment = Pos.CENTER_LEFT) {
Severity: Minor
Found in app/src/main/kotlin/insulator/views/main/topic/ProducerView.kt - About 7 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method recordsTable has a Cognitive Complexity of 49 (exceeds 20 allowed). Consider refactoring.
Open

    private fun EventTarget.recordsTable() =
        tableview<RecordViewModel> {
            val partitionColumn = column("P", RecordViewModel::partitionProperty) { prefWidthProperty().set(30.0); isReorderable = false }
            val offsetColumn = column("O", RecordViewModel::offsetProperty) { prefWidthProperty().set(30.0); isReorderable = false }
            val timeColumn = column("Time", RecordViewModel::formattedTimeStampProperty) { prefWidthProperty().set(150.0); isReorderable = false }
Severity: Minor
Found in app/src/main/kotlin/insulator/views/main/topic/TopicView.kt - About 5 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method sidebar has a Cognitive Complexity of 41 (exceeds 20 allowed). Consider refactoring.
Open

    private fun sidebar() =
        borderpane {
            top = vbox {
                h1(cluster.name)
                hbox {
Severity: Minor
Found in app/src/main/kotlin/insulator/views/main/MainView.kt - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method parseNumber has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
Open

internal fun parseNumber(
    field: Any?,
    schema: Schema,
    humanReadableLogicalType: Boolean
): Either<AvroToJsonParsingException, Any?> {

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method parseNumber has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

internal fun parseNumber(
    field: Any?,
    schema: Schema,
    humanReadableLogicalType: Boolean
): Either<AvroToJsonParsingException, Any?> {

    Method parse has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
    Open

        override fun parse(fieldValue: Any?, schema: Schema) = either.eager<JsonFieldParsingException, GenericRecord> {
            val jsonMap = !(
                if (schema.type != Schema.Type.RECORD || fieldValue !is Map<*, *>)
                    JsonInvalidFieldException(schema, fieldValue).left()
                else fieldValue.right()

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method refresh has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring.
    Open

        suspend fun refresh() = either<Throwable, Unit> {
            canRefresh.set(false)
            val consumerGroup = !adminApi.describeConsumerGroup(consumerGroupId.id)
            val sorted = consumerGroup.members
                .map { it.clientId to it.topicPartitions }

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method kafkaConfig has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
    Open

    fun kafkaConfig(cluster: Cluster) = Properties().apply {
        put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, cluster.endpoint)
        put(AdminClientConfig.REQUEST_TIMEOUT_MS_CONFIG, 30000)
        put(AdminClientConfig.DEFAULT_API_TIMEOUT_MS_CONFIG, 30000)
        put("confluent.reporters.telemetry.auto.enable", false) // disable confluent reporter
    Severity: Minor
    Found in lib/kafka/src/main/kotlin/insulator/kafka/factories/KafkaConfig.kt - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method readOnlyButton has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
    Open

    fun EventTarget.readOnlyButton(isReadOnlyProperty: BooleanProperty): Button {
        val getIcon = { if (isReadOnlyProperty.value) ICON_LOCK_SVG else ICON_UNLOCK_SVG }
        val color = { if (!isReadOnlyProperty.value) Color.RED else theme.mainColor }
        val text = { if (isReadOnlyProperty.value) "ReadOnly mode" else "Read/Write mode" }
        val button = button {
    Severity: Minor
    Found in app/src/main/kotlin/insulator/ui/component/Button.kt - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Severity
    Category
    Status
    Source
    Language