DeflatedPickle/Quiver

View on GitHub

Showing 96 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) {

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        init {
            EventProgramFinishSetup.addListener {
                val registry = RegistryUtil.get("viewer") as Registry<String, MutableList<Viewer<Any>>>?
    
                if (registry != null) {
    markdownviewer/src/main/kotlin/com/deflatedpickle/markdownviewer/MarkdownViewerPlugin.kt on lines 41..55

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 311.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        init {
            EventProgramFinishSetup.addListener {
                val registry = RegistryUtil.get("viewer") as Registry<String, MutableList<Viewer<Any>>>?
    
                if (registry != null) {
    tableviewer/src/main/kotlin/com/deflatedpickle/tableviewer/TableViewerPlugin.kt on lines 31..45

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 311.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              val locationEntry = ButtonField(
                  "Location",
                  "The location to export to",
                  OSUtil.getOS().toPatternFilter(),
                  "Open"
          core/src/main/kotlin/com/deflatedpickle/quiver/frontend/dialog/NewDialog.kt on lines 80..97

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 212.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              val locationEntry: ButtonField = ButtonField(
                  "Location",
                  "The location of the pack",
                  OSUtil.getOS().toPatternFilter(),
                  "Open"
          packexport/src/main/kotlin/com/deflatedpickle/quiver/packexport/ExportPackDialog.kt on lines 30..47

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 212.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                          for (i in this.extensionSet) {
                              if (registry.get(i) == null) {
                                  @Suppress("UNCHECKED_CAST")
                                  registry.register(i, mutableListOf(ImageViewer as Viewer<Any>))
                              } else {
          spritesheetviewer/src/main/kotlin/com/deflatedpickle/spritesheetviewer/SpriteSheetViewerPlugin.kt on lines 141..149

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 207.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                          for (i in extensionSet) {
                              if (registry.get(i) == null) {
                                  @Suppress("UNCHECKED_CAST")
                                  registry.register(i, mutableListOf(SpriteSheetViewer as Viewer<Any>))
                              } else {
          imageviewer/src/main/kotlin/com/deflatedpickle/imageviewer/ImageViewerPlugin.kt on lines 39..47

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 207.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          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

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

            @Suppress("unused")
            @Plugin(
                value = "$[name]",
                author = "$[author]",
                version = "$[version]",
            packsquashstep/src/main/kotlin/com/deflatedpickle/quiver/packsquashstep/PackSquashStepPlugin.kt on lines 12..26
            zipstep/src/main/kotlin/com/deflatedpickle/quiver/zipstep/ZipStepPlugin.kt on lines 12..26

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 165.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

            @Suppress("unused")
            @Plugin(
                value = "$[name]",
                author = "$[author]",
                version = "$[version]",
            textviewer/src/main/kotlin/com/deflatedpickle/quiver/textviewer/TextViewerPlugin.kt on lines 29..43
            zipstep/src/main/kotlin/com/deflatedpickle/quiver/zipstep/ZipStepPlugin.kt on lines 12..26

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 165.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

            @Suppress("unused")
            @Plugin(
                value = "$[name]",
                author = "$[author]",
                version = "$[version]",
            packsquashstep/src/main/kotlin/com/deflatedpickle/quiver/packsquashstep/PackSquashStepPlugin.kt on lines 12..26
            textviewer/src/main/kotlin/com/deflatedpickle/quiver/textviewer/TextViewerPlugin.kt on lines 29..43

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 165.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Severity
            Category
            Status
            Source
            Language