MTG/dunya-desktop

View on GitHub

Showing 42 of 219 total issues

File table.py has 385 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import os
import platform
import json
import sys
import shutil
Severity: Minor
Found in dunyadesktop_app/widgets/table.py - About 5 hrs to fix

    Function download has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

        def download(self, docid):
            if docid:
                doc_folder = os.path.join(self.FOLDER, docid)
                if not os.path.exists(doc_folder):
                    os.makedirs(doc_folder)
    Severity: Minor
    Found in dunyadesktop_app/cultures/makam/utilities.py - About 4 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 evaluate_checked_signal has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        def evaluate_checked_signal(self, type, item, is_checked):
            if item == 'pitch' or item == 'pitch_filtered':
                if is_checked:
                    self.player_frame.plot_1d_data(type, item)
                else:
    Severity: Minor
    Found in dunyadesktop_app/widgets/playermainwindow.py - About 4 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 get_filenames_in_dir has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_filenames_in_dir(dir_name, keyword='*.mp3', skip_foldername='',
                             match_case=True, verbose=None):
        names = []
        folders = []
        fullnames = []
    Severity: Minor
    Found in dunyadesktop_app/cultures/makam/utilities.py - About 3 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

    File playerframe.py has 278 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import os
    import json
    
    import numpy as np
    import pyqtgraph.dockarea as pgdock
    Severity: Minor
    Found in dunyadesktop_app/widgets/playerframe.py - About 2 hrs to fix

      Function run has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def run(self):
              self.recordings = []
              self.works = []
              check_list = [self.mid, self.fid, self.uid, self.cmbid, self.ambid]
              self.combobox_status = [0, 0, 0, 0, 0, 0]
      Severity: Minor
      Found in dunyadesktop_app/cultures/makam/query.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_design has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def _set_design(self, docid):
              self.resize(710, 550)
              self.central_widget = QWidget()
      
              layout = QVBoxLayout(self.central_widget)
      Severity: Major
      Found in dunyadesktop_app/widgets/playermainwindow.py - About 2 hrs to fix

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

            def player_pos_changed(self, playback_pos):
                """
                Updates the positions of cursors when playback position is changed.
                Changes the waveform region item according to the position of playback.
        
        
        Severity: Minor
        Found in dunyadesktop_app/widgets/playerframe.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 _parse_dict has a Cognitive Complexity of 14 (exceeds 5 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

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

        def check_doc(docid):
            """Checks if all the features are downloaded correctly or not"""
            docid = str(docid)
            if os.path.exists(os.path.join(FOLDER, docid)):
                docid = str(docid)
        Severity: Minor
        Found in dunyadesktop_app/cultures/makam/utilities.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 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def __init__(self, parent=None):
                QWidget.__init__(self, parent)
                # self._set_widget()
        
                layout = QVBoxLayout(self)
        Severity: Minor
        Found in dunyadesktop_app/widgets/dockwidget.py - About 1 hr to fix

          Function _set_layout has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def _set_layout(self, layout):
                  """Sets the size policies of layout and initializes the comoboxes and
                  query button."""
                  layout.setSizeConstraint(QLayout.SetNoConstraint)
                  layout.setMargin(MARGIN)
          Severity: Minor
          Found in dunyadesktop_app/widgets/audioattframe.py - About 1 hr to fix

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

            def _dunya_query_file(path, **kwargs):
                """Make a query to dunya and return the raw result"""
                g = _dunya_url_query(_make_url(path, **kwargs))
                if g:
                    cl = g.headers.get('content-length')
            Severity: Minor
            Found in dunyadesktop_app/cultures/dunya/conn.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 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def __init__(self, parent=None):
                    QFrame.__init__(self, parent)
            
                    # grid layout for main window
                    layout_main = QGridLayout(self)
            Severity: Minor
            Found in dunyadesktop_app/widgets/queryframe.py - About 1 hr to fix

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

                  def __init__(self, parent=None):
                      QFrame.__init__(self, parent=parent)
              
                      self._set_size_policy()
                      self._set_visualization()
              Severity: Minor
              Found in dunyadesktop_app/widgets/playbackframe.py - About 1 hr to fix

                Function wf_region_changed has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def wf_region_changed(self):
                        """
                        Updates the plots according to the change in waveform region item.
                        """
                        pos = self.playback.position() / 1000.  # playback pos in seconds
                Severity: Minor
                Found in dunyadesktop_app/widgets/playerframe.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 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def __init__(self, QWidgetParent=None):
                        QMainWindow.__init__(self, QWidgetParent)
                        self._set_main_window()
                        self.centralwidget = QWidget(self)
                
                
                Severity: Minor
                Found in dunyadesktop_app/general_design.py - About 1 hr to fix

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

                      def __init__(self, parent=None):
                          QDialog.__init__(self, parent)
                          self.attribute = None
                          self.setFixedSize(200, 300)
                  
                  
                  Severity: Minor
                  Found in dunyadesktop_app/widgets/filteringdialog.py - About 1 hr to fix

                    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

                      Severity
                      Category
                      Status
                      Source
                      Language