DeflatedPickle/FAOSDance

View on GitHub

Showing 47 of 178 total issues

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

      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

        Method loadAndUseConfig has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            fun loadAndUseConfig(): Boolean {
                fun recursiveCast(value: Any): Any {
                    val newV: Any
        
                    if (value is HashMap<*, *>) {
        Severity: Minor
        Found in src/main/kotlin/com/deflatedpickle/faosdance/util/ConfigFile.kt - About 1 hr to fix

          Method pre_draw_sprite has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def pre_draw_sprite(graphics)
              if @counter == 0
                @counter = @amount
          
                @x = @speed_max_x
          Severity: Minor
          Found in src/main/resources/scripts/shake_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 a Cognitive Complexity of 9 (exceeds 5 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 55 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 settings has a Cognitive Complexity of 9 (exceeds 5 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 55 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 addLabelRangeSliderSpinnerDouble has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  parent: Container,
                  gridBagLayout: GridBagLayout,
                  name: String,
                  highValue: Number,
                  lowValue: Number,
          Severity: Major
          Found in src/main/kotlin/com/deflatedpickle/faosdance/util/GlobalValues.kt - About 50 mins to fix

            Method addComponentRangeSliderSpinner has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    parent: Container,
                    gridBagLayout: GridBagLayout,
                    component: JComponent,
                    highValue: Number,
                    lowValue: Number,
            Severity: Major
            Found in src/main/kotlin/com/deflatedpickle/faosdance/util/GlobalValues.kt - About 50 mins to fix

              Method addLabelRangeSliderSpinnerInteger has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      parent: Container,
                      gridBagLayout: GridBagLayout,
                      name: String,
                      highValue: Number,
                      lowValue: Number,
              Severity: Major
              Found in src/main/kotlin/com/deflatedpickle/faosdance/util/GlobalValues.kt - About 50 mins to fix

                Method addComponentSliderSpinner has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        parent: Container,
                        gridBagLayout: GridBagLayout,
                        component: JComponent,
                        defaultValue: Number,
                        maxNumber: Number,
                Severity: Minor
                Found in src/main/kotlin/com/deflatedpickle/faosdance/util/GlobalValues.kt - About 45 mins to fix

                  Method createOptionRangeDouble has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public static Triple<JButton, RangeSlider, Pair<JSpinner, JSpinner>> createOptionRangeDouble(Container parent, String name, Double highNumber, Double lowNumber, Double maxNumber, Double minNumber) {
                  Severity: Minor
                  Found in src/main/java/com/deflatedpickle/faosdance/FAOSDanceSettings.java - About 45 mins to fix

                    Method pre_draw has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def pre_draw(graphics)
                        if @wait > 0.0
                          @wait -= 1
                          @progress_bar.setValue @wait
                        else
                    Severity: Minor
                    Found in src/main/resources/scripts/auto_action_extension.rb - About 45 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

                    Avoid deeply nested control flow statements.
                    Open

                                                for (ch in c.panel.components) {
                                                    ch.isEnabled = false
                                                }

                      Method addLabelSliderSpinnerInteger has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              parent: Container,
                              gridBagLayout: GridBagLayout,
                              name: String,
                              defaultValue: Int,
                              maxNumber: Int,
                      Severity: Minor
                      Found in src/main/kotlin/com/deflatedpickle/faosdance/util/GlobalValues.kt - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                    if (!fileList.contains(name)) {
                                                        File(i, name).apply {
                                                            this.createNewFile()
                                                            Files.write(this.toPath(), text)
                                                        }
                        Severity: Major
                        Found in src/main/kotlin/com/deflatedpickle/faosdance/util/GlobalValues.kt - About 45 mins to fix

                          Method paintBorder has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                  c: Component,
                                  g: Graphics,
                                  x: Int, y: Int,
                                  width: Int, height: Int
                            Severity
                            Category
                            Status
                            Source
                            Language