realitix/vulk

View on GitHub

Showing 152 of 152 total issues

Function __init__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, context, stages, vertex_input, input_assembly,
                 viewport_state, rasterization, multisample, depth, blend,
                 dynamic, layout, renderpass):
        """
        Args:
Severity: Minor
Found in vulk/vulkanobject.py - 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

        if channel == -1:
            msg = "Cannot play the sound: %s" % mixer.Mix_GetError()
            logger.error(msg)
            raise SoundError(msg)
Severity: Major
Found in vulk/audio.py and 1 other location - About 1 hr to fix
vulk/audio.py on lines 140..143

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

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

        if result == -1:
            msg = "Cannot play the music: %s" % mixer.Mix_GetError()
            logger.error(msg)
            raise SoundError(msg)
Severity: Major
Found in vulk/audio.py and 1 other location - About 1 hr to fix
vulk/audio.py on lines 88..91

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

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

Function __init__ has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def __init__(self, window, debug=False, extra_layers=None):
        """Create context

        Args:
            window (VulkWindow): SDL2 window
Severity: Minor
Found in vulk/context.py - About 1 hr to fix

    Function update_layout has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def update_layout(self, cmd, old_layout, new_layout, src_stage,
    Severity: Major
    Found in vulk/vulkanobject.py - About 1 hr to fix

      Function set_sampler has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def set_sampler(self, context, mag_filter=vc.Filter.NEAREST,
      Severity: Major
      Found in vulk/graphic/texture.py - About 1 hr to fix

        Function __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, context, image, view_type, image_format,
        Severity: Major
        Found in vulk/vulkanobject.py - About 1 hr to fix

          Function __init__ has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def __init__(self, context, stages, vertex_input, input_assembly,
                           viewport_state, rasterization, multisample, depth, blend,
                           dynamic, layout, renderpass):
                  """
                  Args:
          Severity: Minor
          Found in vulk/vulkanobject.py - About 1 hr to fix

            Function __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(self, key_down=None, key_up=None, mouse_down=None,
            Severity: Major
            Found in vulk/event.py - About 1 hr to fix

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

                      try:
                          data = vma.vmaMapMemory(context.vma_allocator, self.allocation)
                          yield data
                      finally:
                          vma.vmaUnmapMemory(context.vma_allocator, self.allocation)
              Severity: Major
              Found in vulk/vulkanobject.py and 1 other location - About 1 hr to fix
              vulk/vulkanobject.py on lines 1835..1839

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

              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

                      try:
                          data = vma.vmaMapMemory(context.vma_allocator, self.allocation)
                          yield data
                      finally:
                          vk.vmaUnmapMemory(context.vma_allocator, self.allocation)
              Severity: Major
              Found in vulk/vulkanobject.py and 1 other location - About 1 hr to fix
              vulk/vulkanobject.py on lines 728..732

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

              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

                      if not values:
                          super().__init__([1, 0, 0,
                                            0, 1, 0,
                                            0, 0, 1])
                      elif np.shape(values) == (9,):
              Severity: Minor
              Found in vulk/math/matrix.py and 1 other location - About 55 mins to fix
              vulk/math/matrix.py on lines 83..91

              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

              Function _create_physical_device has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _create_physical_device(self):
                      '''Create Vulkan physical device
              
                      The best physical device is selected through criteria.
                      '''
              Severity: Minor
              Found in vulk/context.py - 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

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

              class ColorComponent(IntFlag):
                  NONE = 0
                  R = vk.VK_COLOR_COMPONENT_R_BIT
                  G = vk.VK_COLOR_COMPONENT_G_BIT
                  B = vk.VK_COLOR_COMPONENT_B_BIT
              Severity: Minor
              Found in vulk/vulkanconstant.py and 1 other location - About 55 mins to fix
              vulk/vulkanconstant.py on lines 474..479

              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

                      if not values:
                          super().__init__([1, 0, 0, 0,
                                            0, 1, 0, 0,
                                            0, 0, 1, 0,
                                            0, 0, 0, 1])
              Severity: Minor
              Found in vulk/math/matrix.py and 1 other location - About 55 mins to fix
              vulk/math/matrix.py on lines 64..71

              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 ImageAspect(IntFlag):
                  NONE = 0
                  COLOR = vk.VK_IMAGE_ASPECT_COLOR_BIT
                  DEPTH = vk.VK_IMAGE_ASPECT_DEPTH_BIT
                  STENCIL = vk.VK_IMAGE_ASPECT_STENCIL_BIT
              Severity: Minor
              Found in vulk/vulkanconstant.py and 1 other location - About 55 mins to fix
              vulk/vulkanconstant.py on lines 123..128

              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

              Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(self, context, flags, size, usage, sharing_mode,
              Severity: Major
              Found in vulk/vulkanobject.py - About 50 mins to fix

                Function to_orthographic has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def to_orthographic(self, left, right, bottom, top, near, far):
                Severity: Minor
                Found in vulk/math/matrix.py - About 45 mins to fix

                  Function open has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def open(self, configuration):
                          '''Open the SDL2 Window
                  
                          *Parameters:*
                  
                  
                  Severity: Minor
                  Found in vulk/context.py - 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

                  Function pipeline_barrier has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def pipeline_barrier(self, src_stage, dst_stage, dependency, memories,
                  Severity: Minor
                  Found in vulk/vulkanobject.py - About 45 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language