MTG/dunya-desktop

View on GitHub

Showing 42 of 219 total issues

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

    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

                    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

                    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

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

                        def add_recording(self, work):
                            for rec in work['recordings']:
                                check_item = QStandardItem()
                                check_item.setCheckable(True)
                                title = QStandardItem(rec['title'])
                    Severity: Minor
                    Found in dunyadesktop_app/widgets/models/recordingmodel.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 download_release has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def download_release(releaseid, location, slugify=False):
                        """Download the mp3s of all recordings in a release and save
                        them to the specificed directory.
                    
                        :param release: The MBID of the release
                    Severity: Minor
                    Found in dunyadesktop_app/cultures/dunya/makam.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 add_items has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def add_items(self):
                            if self.feature_dict:
                                for key in self.feature_dict.keys():
                                    root = QTreeWidgetItem(self, [key])
                    
                    
                    Severity: Minor
                    Found in dunyadesktop_app/widgets/treewidget.py - 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

                    Function download_mp3 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def download_mp3(recordingid, location, slugify=False):
                        """Download the mp3 of a document and save it to the specificed directory.
                    
                        :param recordingid: The MBID of the recording
                        :param location: Where to save the mp3 to
                    Severity: Minor
                    Found in dunyadesktop_app/cultures/dunya/makam.py - 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

                    Function get_feature_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def get_feature_list(self, docid):
                            fullnames, folders, names = get_filenames_in_dir(
                                os.path.join(DOCS_PATH, docid), keyword='*.json')
                    
                            for name in names:
                    Severity: Minor
                    Found in dunyadesktop_app/widgets/treewidget.py - 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

                    Function add_sections_to_waveform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def add_sections_to_waveform(self, feature_path):
                            sections = get_sections(feature_path)
                    
                            colors = {}
                            color_index = 0
                    Severity: Minor
                    Found in dunyadesktop_app/widgets/playerframe.py - 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

                    Function check_new_doc has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def check_new_doc(self, docs):
                            download = []
                            for docid in docs:
                                if not os.path.isdir(os.path.join(DOCS_PATH, str(docid))):
                                    download.append(str(docid))
                    Severity: Minor
                    Found in dunyadesktop_app/mainui_makam.py - 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

                    Severity
                    Category
                    Status
                    Source
                    Language