dicomsort/dicomsort

View on GitHub

Showing 23 of 23 total issues

File icons.py has 411 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# ----------------------------------------------------------------------
# This file was generated by img2py.py
#
from wx.lib.embeddedimage import PyEmbeddedImage

Severity: Minor
Found in dicomsort/gui/icons.py - About 5 hrs to fix

    File widgets.py has 320 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import os
    import re
    import wx
    
    import wx.grid
    Severity: Minor
    Found in dicomsort/gui/widgets.py - About 3 hrs to fix

      File dicomsorter.py has 275 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import itertools
      import os
      import pydicom
      import shutil
      
      
      Severity: Minor
      Found in dicomsort/dicomsorter.py - About 2 hrs to fix

        Function sort has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            def sort(self, root, directory_fields, filename_string, test=False,
                     rootdir=None, keep_original=True):
        
                # If we want to sort in place
                if directory_fields is None:
        Severity: Minor
        Found in dicomsort/dicomsorter.py - 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 set_anonymization_rules has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def set_anonymization_rules(self, anonymization_lookup):
                # Appends the rules to the overrides so that we can alter them
                if isinstance(anonymization_lookup, dict):
                    self.anonymization_lookup = anonymization_lookup
                else:
        Severity: Minor
        Found in dicomsort/dicomsorter.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

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

            def __init__(self, queue, output_directory, directory_format,
        Severity: Major
        Found in dicomsort/dicomsorter.py - About 1 hr to fix

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

              def RevertState(self, *evnt):
                  super(MiscPanel, self).RevertState()
                  savedConfig = configobj.ConfigObj(self.config.filename)
                  self.UpdateFromConfig(savedConfig)
          Severity: Major
          Found in dicomsort/gui/preferences.py and 1 other location - About 1 hr to fix
          dicomsort/gui/preferences.py on lines 161..164

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

          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 RevertState(self, *evnt):
                  super(FileNamePanel, self).RevertState()
                  savedConfig = configobj.ConfigObj(self.config.filename)
                  self.UpdateFromConfig(savedConfig)
          Severity: Major
          Found in dicomsort/gui/preferences.py and 1 other location - About 1 hr to fix
          dicomsort/gui/preferences.py on lines 57..60

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

          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

                  vboxSelect.Add(self.selected, 1,
                                 wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 10)
          Severity: Major
          Found in dicomsort/gui/widgets.py and 1 other location - About 1 hr to fix
          dicomsort/gui/widgets.py on lines 376..377

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

          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

                  vboxOptions.Add(self.options, 1,
                                  wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 10)
          Severity: Major
          Found in dicomsort/gui/widgets.py and 1 other location - About 1 hr to fix
          dicomsort/gui/widgets.py on lines 384..385

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

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

              def available_fields(self):
                  for path in self.pathname:
                      for root, dirs, files in os.walk(path):
                          for filename in files:
                              dcm = utils.isdicom(os.path.join(root, filename))
          Severity: Minor
          Found in dicomsort/dicomsorter.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

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

              def sort(self, root, directory_fields, filename_string, test=False,
          Severity: Minor
          Found in dicomsort/dicomsorter.py - About 45 mins to fix

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

                def __init__(self, parent, id=-1, size=(250, 300), choices=None,
            Severity: Minor
            Found in dicomsort/gui/widgets.py - About 35 mins to fix

              Function _image_type has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _image_type(self):
                      """
                      Determines the human-readable type of the image
                      """
              
              
              Severity: Minor
              Found in dicomsort/dicomsorter.py - About 35 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 Sort has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def Sort(self, evnt):
                      if self.dicom_sorter.is_sorting():
                          return
              
                      self.anonymize = evnt.anon
              Severity: Minor
              Found in dicomsort/gui/core.py - About 35 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 sort has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def sort(self, output_directory, test=False, listener=None):
                      # This should be moved to a worker thread
                      for path in self.pathname:
                          for root, _, files in os.walk(path):
                              for filename in files:
              Severity: Minor
              Found in dicomsort/dicomsorter.py - About 35 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 _MenuGenerator has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _MenuGenerator(self, parent, name, arguments):
                      menu = wx.Menu()
              
                      for item in arguments:
                          if item == '----':
              Severity: Minor
              Found in dicomsort/gui/core.py - About 35 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 __init__(self, parent, config):
                      super(MiscPanel, self).__init__(parent, 'Miscpanel',
                                                      'Miscellaneous', config)
                      self.create()
              Severity: Minor
              Found in dicomsort/gui/preferences.py and 1 other location - About 30 mins to fix
              dicomsort/gui/preferences.py on lines 275..279

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

              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

                      vbox.Add(self.anonList, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 10)
              Severity: Minor
              Found in dicomsort/gui/preferences.py and 1 other location - About 30 mins to fix
              dicomsort/gui/dialogs.py on lines 97..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 32.

              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 __init__(self, parent, config):
                      super(AnonymousPanel, self).__init__(parent, 'Anonymization',
                                                           'Anonymizing Fields', config)
              
                      self.create()
              Severity: Minor
              Found in dicomsort/gui/preferences.py and 1 other location - About 30 mins to fix
              dicomsort/gui/preferences.py on lines 45..48

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

              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