DeflatedPickle/Quiver

View on GitHub

Showing 35 of 96 total issues

Method createEmptyPack has a Cognitive Complexity of 671 (exceeds 20 allowed). Consider refactoring.
Open

    // This structure is mostly the same through different pack versions
    // I'm not sure of a good, maintainable way to describe these mild differences, though I did write a DSL for it
    // https://minecraft.gamepedia.com/Resource_Pack#Folder_structure
    // (02/05/2021) This testing of each file is quite verbose. Perhaps some kind of "checker" could be added to the FileBuilder?
    fun createEmptyPack(

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 newPack has a Cognitive Complexity of 141 (exceeds 20 allowed). Consider refactoring.
Open

    fun newPack() {
        val dialog = NewDialog()
        dialog.isVisible = true

        if (dialog.result == TaskDialog.StandardCommand.OK) {

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 newPack has 120 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    fun newPack() {
        val dialog = NewDialog()
        dialog.isVisible = true

        if (dialog.result == TaskDialog.StandardCommand.OK) {

    Method main has 117 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    @InternalSerializationApi
    fun main(args: Array<String>) {
        // We'll count the startup time
        val startTime = System.nanoTime()
    
    
    Severity: Major
    Found in launcher/src/main/kotlin/com/deflatedpickle/quiver/launcher/main.kt - About 4 hrs to fix

      Method main has a Cognitive Complexity of 42 (exceeds 20 allowed). Consider refactoring.
      Open

      @InternalSerializationApi
      fun main(args: Array<String>) {
          // We'll count the startup time
          val startTime = System.nanoTime()
      
      
      Severity: Minor
      Found in launcher/src/main/kotlin/com/deflatedpickle/quiver/launcher/main.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 exportPack has 90 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private fun exportPack(
              destination: String,
              vararg toggledSteps: ExportStep
          ) {
              this.logger.info("Attempting to export the pack")

        File NewDialog.kt has 314 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* Copyright (c) 2020-2021 DeflatedPickle under the MIT license */
        
        @file:Suppress("MemberVisibilityCanBePrivate")
        
        package com.deflatedpickle.quiver.frontend.dialog

          Method exportPack has a Cognitive Complexity of 39 (exceeds 20 allowed). Consider refactoring.
          Open

              private fun exportPack(
                  destination: String,
                  vararg toggledSteps: ExportStep
              ) {
                  this.logger.info("Attempting to export the pack")

          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 newAnimationThread has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring.
          Open

              private fun newAnimationThread() = Thread {
                  while (shouldAnimate) {
                      if (SpriteSheetViewer.index >= SpriteSheetViewer.maxIndex) {
                          if (loopButton.isSelected) {
                              SpriteSheetViewer.index = 0

          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 processFile has a Cognitive Complexity of 35 (exceeds 20 allowed). Consider refactoring.
          Open

              override fun processFile(
                  file: File,
                  progressMonitor: ProgressMonitor
              ) {
                  var progress = 0

          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 processFile has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              override fun processFile(
                  file: File,
                  progressMonitor: ProgressMonitor
              ) {
                  var progress = 0

            Method processFile has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                override fun processFile(
                    file: File,
                    progressMonitor: ProgressMonitor
                ) {
                    progressMonitor.maximum = 100

              Method search has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private fun search(
                      string: String,
                      caseInsensitive: Boolean = true,
                      comments: Boolean = false,
                      start: Int = -1,

                Method addNBT has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private fun addNBT(tag: Tag<*>, parent: DefaultMutableTreeNode, name: String = "") {
                        val keyNode = DefaultMutableTreeNode(
                            (if (name != "") "$name " else "") +
                                (if (name != "") "(" else "") +
                                "${tag::class.simpleName}" +

                  Method handleJSON has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private fun handleJSON(file: File) {
                          val jsonObject = this.json
                              .load(file)
                              .getObject("textures")
                  
                  

                    Method setVisible has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        override fun setVisible(b: Boolean) {
                            // Disable everything before we validate
                            this.disableAll()
                    
                            if (Quiver.packDirectory != null && Quiver.selectedDir != null) {

                      Method addDropTarget has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private fun addDropTarget() {
                              this.dropTarget = object : DropTarget() {
                                  @Suppress("UNCHECKED_CAST")
                                  override fun dragEnter(dtde: DropTargetDragEvent) {
                                      val file = Quiver.selectedFile

                        Method openPack has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            fun openPack() {
                                val directoryChooser = JFileChooser(
                                    DotMinecraft.dotMinecraft.resolve("resourcepacks").absolutePath
                                ).apply {
                                    fileSelectionMode = JFileChooser.DIRECTORIES_ONLY

                          Method addSelectionListener has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
                          Open

                              private fun addSelectionListener() {
                                  this.selectionModel.addListSelectionListener {
                                      if (!it.valueIsAdjusting) {
                                          if (this.selectedRow >= 0) {
                                              val value = this.getValueAt(

                          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 addNBT has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
                          Open

                              private fun addNBT(tag: Tag<*>, parent: DefaultMutableTreeNode, name: String = "") {
                                  val keyNode = DefaultMutableTreeNode(
                                      (if (name != "") "$name " else "") +
                                          (if (name != "") "(" else "") +
                                          "${tag::class.simpleName}" +

                          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