MTG/dunya-desktop

View on GitHub

Showing 219 of 219 total issues

Function _parse_dict has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def _parse_dict(self):
        """
        Parses the given metadata dictionary.
        """
        self.root_title = QTreeWidgetItem(self, ['Title'])
Severity: Minor
Found in dunyadesktop_app/widgets/treewidget.py - About 1 hr to fix

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

        def dropEvent(self, event):
            # The QTableWidget from which selected rows will be moved
            sender = event.source()
    
            # Default dropEvent method fires dropMimeData with appropriate
    Severity: Minor
    Found in dunyadesktop_app/widgets/table.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

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

            self.setItem(self.rowCount()-1, 0,
                         self._make_item(str(self.rowCount())))
    Severity: Minor
    Found in dunyadesktop_app/widgets/table.py and 1 other location - About 45 mins to fix
    dunyadesktop_app/widgets/models/recordingmodel.py on lines 127..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 35.

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

    def compute_overall_histogram(histograms):
        """--------------------------------------------------------------------
        Plot an overall histogram obtained by the sum of the histograms provided
        as inputs. Every histogram is converted in cents. A new x-axis interval
        is created using minimum and maximum value in cents for all the
    Severity: Minor
    Found in dunyadesktop_app/utilities/corpusbasestatistics.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

    Avoid deeply nested control flow statements.
    Open

                                if feature:
                                    json.dump(feature, open(f_path, 'w'))
                            except:
    Severity: Major
    Found in dunyadesktop_app/cultures/makam/utilities.py - About 45 mins to fix

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

          def download_score(self, docid):
              SCORE_FOLDER = os.path.join(FOLDER, '..', 'scores')
      
              if not os.path.exists(SCORE_FOLDER):
                  os.makedirs(SCORE_FOLDER)
      Severity: Minor
      Found in dunyadesktop_app/cultures/makam/utilities.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

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

              self.setItem(self.rowCount()-1, 0,
                           self._make_item(str(self.rowCount())))
      Severity: Minor
      Found in dunyadesktop_app/widgets/models/recordingmodel.py and 1 other location - About 45 mins to fix
      dunyadesktop_app/widgets/table.py on lines 503..504

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

      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

      Consider simplifying this complex logical expression.
      Open

              if index_melodic is -1 and index_form is -1 and index_rhythm is -1 \
                      and index_composer is -1 and index_performer is -1 and \
                              index_instrument is -1:
                  self.toolButton_query.setDisabled(True)
              else:
      Severity: Major
      Found in dunyadesktop_app/widgets/audioattframe.py - About 40 mins to fix

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

        def get_document_as_json(recordingid, thetype, subtype=None, part=None, version=None):
        Severity: Minor
        Found in dunyadesktop_app/cultures/dunya/docserver.py - About 35 mins to fix

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

          def change_color(path, tree, root, note_id, color):
          Severity: Minor
          Found in dunyadesktop_app/cultures/makam/svgparser.py - About 35 mins to fix

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

            def file_for_document(recordingid, thetype, subtype=None, part=None, version=None):
            Severity: Minor
            Found in dunyadesktop_app/cultures/dunya/docserver.py - About 35 mins to fix

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

              def create_and_upload_document(collection, document, filetype, title, file):
              Severity: Minor
              Found in dunyadesktop_app/cultures/dunya/docserver.py - About 35 mins to fix

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

                def get_works_by_query(mid='', uid='', fid='', cmbid='', ambid=''):
                Severity: Minor
                Found in dunyadesktop_app/cultures/dunya/makam.py - About 35 mins to fix

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

                  def get_filenames_in_dir(dir_name, keyword='*.mp3', skip_foldername='',
                  Severity: Minor
                  Found in dunyadesktop_app/cultures/makam/utilities.py - About 35 mins to fix

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

                        def __init__(self, values=[0, 1], orientation=None, brush=None,
                    Severity: Minor
                    Found in dunyadesktop_app/widgets/waveformwidget.py - About 35 mins to fix

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

                              self.setItem(self.rowCount()-1, 2, self._make_item(metadata['title']))
                      Severity: Major
                      Found in dunyadesktop_app/widgets/table.py and 6 other locations - About 35 mins to fix
                      dunyadesktop_app/widgets/models/recordingmodel.py on lines 129..129
                      dunyadesktop_app/widgets/models/recordingmodel.py on lines 130..131
                      dunyadesktop_app/widgets/models/recordingmodel.py on lines 132..132
                      dunyadesktop_app/widgets/models/recordingmodel.py on lines 133..133
                      dunyadesktop_app/widgets/models/recordingmodel.py on lines 134..134
                      dunyadesktop_app/widgets/table.py on lines 507..508

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

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

                          def add_1d_roi_items(self, f_type, item):
                              """
                              Adds 1d roi item.
                      
                              :param f_type: (str) Feature type
                      Severity: Minor
                      Found in dunyadesktop_app/widgets/playerframe.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 7 locations. Consider refactoring.
                      Open

                              self.setItem(self.rowCount()-1, 3,
                                           self._make_item(metadata['artists']))
                      Severity: Major
                      Found in dunyadesktop_app/widgets/table.py and 6 other locations - About 35 mins to fix
                      dunyadesktop_app/widgets/models/recordingmodel.py on lines 129..129
                      dunyadesktop_app/widgets/models/recordingmodel.py on lines 130..131
                      dunyadesktop_app/widgets/models/recordingmodel.py on lines 132..132
                      dunyadesktop_app/widgets/models/recordingmodel.py on lines 133..133
                      dunyadesktop_app/widgets/models/recordingmodel.py on lines 134..134
                      dunyadesktop_app/widgets/table.py on lines 506..506

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

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

                          def create_table(self, coll):
                              # first cleans the table, sets the columns and enables the widget
                              self.setRowCount(0)
                      
                              self._set_columns()
                      Severity: Minor
                      Found in dunyadesktop_app/widgets/table.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 7 locations. Consider refactoring.
                      Open

                              self.setItem(self.rowCount()-1, 4, self._make_item(metadata['usul']))
                      Severity: Major
                      Found in dunyadesktop_app/widgets/models/recordingmodel.py and 6 other locations - About 35 mins to fix
                      dunyadesktop_app/widgets/models/recordingmodel.py on lines 129..129
                      dunyadesktop_app/widgets/models/recordingmodel.py on lines 130..131
                      dunyadesktop_app/widgets/models/recordingmodel.py on lines 132..132
                      dunyadesktop_app/widgets/models/recordingmodel.py on lines 134..134
                      dunyadesktop_app/widgets/table.py on lines 506..506
                      dunyadesktop_app/widgets/table.py on lines 507..508

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

                      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