holywyvern/carbuncle

View on GitHub

Showing 26 of 28 total issues

Class Action has 27 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Action
      attr_reader :controller

      def initialize(controller)
        @controller = controller
Severity: Minor
Found in gems/carbuncle-input/mrblib/input.rb - About 3 hrs to fix

    Method join has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

          def join(*names)
            return '' if names.empty?
    
            names.filter!(&:present?)
            names.map! do |name|
    Severity: Minor
    Found in gems/carbuncle-core/mrblib/file.rb - About 2 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

    Function Playground has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function Playground() {
      const [value, setValue] = React.useState(exampleGame);
      const [url, setURL] = React.useState(defaultURL);
      const router = useRouter();
      const onHeaderClick = () => {
    Severity: Major
    Found in website/src/pages/playground/index.js - About 2 hrs to fix

      Class Window has 21 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class Window < ::Carbuncle::GUI::Container
            attr_reader :title, :rect, :scroll
            attr_writer :id
            attr_accessor :border, :movable, :scalable, :closable, :minimizable,
                          :disable_scrollbar, :show_title, :auto_scrollbar,
      Severity: Minor
      Found in gems/carbuncle-gui/mrblib/window.rb - About 2 hrs to fix

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

              def join(*names)
                return '' if names.empty?
        
                names.filter!(&:present?)
                names.map! do |name|
        Severity: Minor
        Found in gems/carbuncle-core/mrblib/file.rb - About 1 hr to fix

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

                      <Link to={`${process.env.basePath}/docs`} popup={t("API Docs")}>
                        <FontAwesomeIcon icon={faBook} />
                      </Link>
          Severity: Major
          Found in website/src/components/header/index.js and 1 other location - About 1 hr to fix
          website/src/components/header/index.js on lines 40..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 62.

          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

                      <Link
                        to={`${process.env.basePath}/playground`}
                        popup={t("Playground")}
                      >
                        <FontAwesomeIcon icon={faPlayCircle} />
          Severity: Major
          Found in website/src/components/header/index.js and 1 other location - About 1 hr to fix
          website/src/components/header/index.js on lines 37..39

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

          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

                  <Platform
                    loading={loading}
                    icon={faLinux}
                    title="Linux Builds"
                    download={`https://github.com/holywyvern/carbuncle/releases/download/${tag}/mruby-carbuncle`}
          Severity: Major
          Found in website/src/components/download-section/index.js and 2 other locations - About 1 hr to fix
          website/src/components/download-section/index.js on lines 50..56
          website/src/components/download-section/index.js on lines 57..63

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

          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

                  <Platform
                    loading={loading}
                    icon={faWindows}
                    title="Windows Builds"
                    download={`https://github.com/holywyvern/carbuncle/releases/download/${tag}/mruby-carbuncle.exe`}
          Severity: Major
          Found in website/src/components/download-section/index.js and 2 other locations - About 1 hr to fix
          website/src/components/download-section/index.js on lines 57..63
          website/src/components/download-section/index.js on lines 64..70

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

          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

                  <Platform
                    loading={loading}
                    icon={faApple}
                    title="OS X Builds"
                    download={`https://github.com/holywyvern/carbuncle/releases/download/${tag}/mruby-carbuncle.app.zip`}
          Severity: Major
          Found in website/src/components/download-section/index.js and 2 other locations - About 1 hr to fix
          website/src/components/download-section/index.js on lines 50..56
          website/src/components/download-section/index.js on lines 64..70

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

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

              def readlines(arg1 = nil, arg2 = nil)
                limit, sep = -1, "\n"
                if arg2
                  limit = arg2
                  sep = arg1 || sep
          Severity: Minor
          Found in gems/carbuncle-core/mrblib/file.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

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

            class Rect
              include Vectorizable
              extend Vectorizable::ClassMethods
          
              vectorize_properties %w[x y w h]
          Severity: Minor
          Found in gems/carbuncle-math/mrblib/rect.rb and 1 other location - About 40 mins to fix
          gems/carbuncle-math/mrblib/vector4.rb on lines 5..131

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

          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

            class Vector4
              include Vectorizable
              extend Vectorizable::ClassMethods
          
              vectorize_properties %w[x y z w]
          Severity: Minor
          Found in gems/carbuncle-math/mrblib/vector4.rb and 1 other location - About 40 mins to fix
          gems/carbuncle-math/mrblib/rect.rb on lines 4..19

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

          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

                def right_axis(binding)
                  gamepads(binding[:index]).map(&:right_axis).map do |point|
                    case binding[:direction]
                    when :up
                      [point.x]
          Severity: Minor
          Found in gems/carbuncle-input/mrblib/input.rb and 1 other location - About 35 mins to fix
          gems/carbuncle-input/mrblib/input.rb on lines 194..202

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

          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

                def left_axis(binding)
                  gamepads(binding[:index]).map(&:left_axis).map do |point|
                    case binding[:direction]
                    when :up
                      [point.x]
          Severity: Minor
          Found in gems/carbuncle-input/mrblib/input.rb and 1 other location - About 35 mins to fix
          gems/carbuncle-input/mrblib/input.rb on lines 207..215

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

          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

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

                def options
                  {
                    id: id,
                    border: border, movable: movable, scalable: scalable,
                    closable: closable, minimizable: minimizable,
          Severity: Minor
          Found in gems/carbuncle-gui/mrblib/window.rb and 1 other location - About 25 mins to fix
          gems/carbuncle-gui/mrblib/group.rb on lines 34..44

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

          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

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

                def options
                  {
                    id: id,
                    border: border, movable: movable, scalable: scalable,
                    closable: closable, minimizable: minimizable,
          Severity: Minor
          Found in gems/carbuncle-gui/mrblib/group.rb and 1 other location - About 25 mins to fix
          gems/carbuncle-gui/mrblib/window.rb on lines 52..62

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

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

              def assign_uniform(name, value)
                symbol = name.to_sym
                klass = @uniform_types[symbol]
                unless @uniform_types.key?(symbol)
                  raise ArgumentError, "Uniform '#{name}' does not exists on shader."
          Severity: Minor
          Found in gems/carbuncle-graphics/mrblib/shader.rb - 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

          Method update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def update(dt)
                  return unless running?
          
                  current_animation = @animations[current]
                  @time += dt
          Severity: Minor
          Found in gems/carbuncle-graphics/mrblib/animated_sprite.rb - 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

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

              def columns
                @columns ||= [
                  Carbuncle::Matrix::Column.new(self, 0),
                  Carbuncle::Matrix::Column.new(self, 1),
                  Carbuncle::Matrix::Column.new(self, 2),
          Severity: Minor
          Found in gems/carbuncle-math/mrblib/matrix.rb and 1 other location - About 25 mins to fix
          gems/carbuncle-math/mrblib/matrix.rb on lines 80..87

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

          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