DeflatedPickle/FAOSDance

View on GitHub

Showing 178 of 178 total issues

Method settings has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def settings(panel)
    shake_amount_widgets = FAOSDanceSettings.createOptionInteger(panel, "Shake Amount:", @amount, 42, 1)

    grid_settings = GridBagConstraints.new GridBagConstraints::RELATIVE, GridBagConstraints::RELATIVE,
                                           2, 1,
Severity: Minor
Found in src/main/resources/scripts/shake_extension.rb - About 1 hr to fix

    Method loadSpriteSheet has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            fun loadSpriteSheet(file: File) {
                var path = ""
                var image: InputStream? = null
                var text: InputStream? = null
    
    

      Method settings has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def settings(panel)
          box_blur_border = FAOSDanceSettings.createBorderPanel panel, "Box Blur", true
          box_blur_border.titleComponent.addActionListener {|it|
            @box_blur_enabled = it.source.to_java(javax::swing::JCheckBox).isSelected
            if @enabled
      Severity: Minor
      Found in src/main/resources/scripts/filter_extension.rb - About 1 hr to fix

        Method addComponentRangeSliderSpinner has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
        Open

            inline fun <reified T : Number> addComponentRangeSliderSpinner(
                parent: Container,
                gridBagLayout: GridBagLayout,
                component: JComponent,
                highValue: Number,
        Severity: Minor
        Found in src/main/kotlin/com/deflatedpickle/faosdance/util/GlobalValues.kt - About 1 hr 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 settings has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def settings(panel)
            grid_settings = GridBagConstraints.new GridBagConstraints::RELATIVE, GridBagConstraints::RELATIVE,
                                                   1, 1,
                                                   0.0, 0.0,
                                                   GridBagConstraints::EAST, GridBagConstraints::NONE,
        Severity: Minor
        Found in src/main/resources/scripts/auto_action_extension.rb - About 1 hr to fix

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

                              if (this.isSelected) {
                                  RubyThread.rubyContainer.callMethod(i, "enable")
                                  GlobalValues.optionsMap.getMap("extensions")!!.getOption<MutableList<String>>("enabled")!!.add(
                                      name
                                  )
          src/main/kotlin/com/deflatedpickle/faosdance/gui/settings/ExtensionSettings.kt on lines 134..139

          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 123.

          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

                  this.add(JLabel("${Lang.bundle.getString("settings.sprite.action")}:").also {
                      gridBagLayout.setConstraints(it, GridBagConstraints().apply {
                          anchor = GridBagConstraints.EAST
                      })
                  })
          src/main/kotlin/com/deflatedpickle/faosdance/gui/settings/general/SpriteCategory.kt on lines 157..161

          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 123.

          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

                              } else {
                                  RubyThread.rubyContainer.callMethod(i, "disable")
                                  GlobalValues.optionsMap.getMap("extensions")!!.getOption<MutableList<String>>("enabled")!!.remove(
                                      name
                                  )
          src/main/kotlin/com/deflatedpickle/faosdance/gui/settings/ExtensionSettings.kt on lines 129..134

          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 123.

          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

                  this.panel.add(JLabel("${Lang.bundle.getString("settings.sprite.scalingType")}:").also {
                      gridBagLayout.setConstraints(it, GridBagConstraints().apply {
                          anchor = GridBagConstraints.EAST
                      })
                  })
          src/main/kotlin/com/deflatedpickle/faosdance/gui/settings/general/AnimationCategory.kt on lines 26..30

          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 123.

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

              public Insets getBorderInsets(Component c, Insets insets) {
                  Insets borderInsets;
                  if (border != null) {
                      borderInsets = border.getBorderInsets(c);
                  } else {

            Method createEnviromentFiles has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                fun createEnviromentFiles() {
                    homePath?.mkdir()
            
                    // It's a loop in case I decide to add more user folders, or move the lang folder out of the program
                    for (i in listOf(
            Severity: Minor
            Found in src/main/kotlin/com/deflatedpickle/faosdance/util/GlobalValues.kt - About 1 hr to fix

              Method settings has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def settings(panel)
                  box_blur_border = FAOSDanceSettings.createBorderPanel panel, "Box Blur", true
                  box_blur_border.titleComponent.addActionListener {|it|
                    @box_blur_enabled = it.source.to_java(javax::swing::JCheckBox).isSelected
                    if @enabled
              Severity: Minor
              Found in src/main/resources/scripts/filter_extension.rb - About 1 hr 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 resize has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  fun resize(direction: Direction? = null) {
                      if (sheet != null) {
                          val width = ((((sheet!!.spriteWidth
                                  * optionsMap.getMap("sprite")!!.getMap("size")!!.getOption<Double>("width")!!)
                                  * 2)
              Severity: Minor
              Found in src/main/kotlin/com/deflatedpickle/faosdance/util/GlobalValues.kt - About 1 hr to fix

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

                                GlobalValues.optionsMap.getMap("sprite")!!.getMap("size")!!.setOption("width", width + (it.preciseWheelRotation * -1) / 100)
                src/main/kotlin/com/deflatedpickle/faosdance/gui/ApplicationWindow.kt on lines 54..54

                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 108.

                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

                                GlobalValues.optionsMap.getMap("sprite")!!.getMap("size")!!.setOption("height", height + (it.preciseWheelRotation * -1) / 100)
                src/main/kotlin/com/deflatedpickle/faosdance/gui/ApplicationWindow.kt on lines 51..51

                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 108.

                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 scriptsFolder = if (ClassLoader.getSystemResource("icon.png").protocol == "jar") {
                        File(homePath, "scripts")
                    } else {
                        File(ClassLoader.getSystemResource("scripts").path)
                    }
                src/main/kotlin/com/deflatedpickle/faosdance/util/GlobalValues.kt on lines 42..46

                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 106.

                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 configFolder = if (ClassLoader.getSystemResource("icon.png").protocol == "jar") {
                        File(homePath, "config")
                    } else {
                        File(ClassLoader.getSystemResource("config").path)
                    }
                src/main/kotlin/com/deflatedpickle/faosdance/util/GlobalValues.kt on lines 37..41

                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 106.

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

                        fun loadSpriteSheet(file: File) {
                            var path = ""
                            var image: InputStream? = null
                            var text: InputStream? = null
                
                

                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 settings has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                  def settings(panel)
                    @red_widgets = FAOSDanceSettings.createOptionInteger panel, "Red:", @default, 255, 0.0
                    @red_widgets.third.addChangeListener {|it|
                      @red = it.source.to_java(javax::swing::JSpinner).model.value.to_java(java::lang::Float).intValue
                      GlobalValues.setOption "colour_overlay-red", @red
                Severity: Minor
                Found in src/main/resources/scripts/colour_overlay_extension.rb - About 1 hr 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 settings has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def settings(panel)
                    opacity_multiplier_widgets = FAOSDanceSettings.createOptionDouble(panel, "Opacity Multiplier:", @opacity_multiplier, 1, 0.1)
                    opacity_multiplier_widgets.third.addChangeListener {|it|
                      @opacity_multiplier = it.source.to_java(javax::swing::JSpinner).model.value.to_java(java::lang::Float).floatValue
                      if @enabled
                Severity: Minor
                Found in src/main/resources/scripts/blend_extension.rb - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language