kn-bibs/dotplot

View on GitHub

Showing 12 of 12 total issues

Function make_windowed_plot has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    def make_windowed_plot(self, sequences, jump=1):
        """Generate matrix of scores using window sliding techinque.

        Partial scores for particular sequence elements will be calculated
        using `get_score` method.
Severity: Minor
Found in dotplot/plotter.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 main_window.py has 283 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QMainWindow
from PyQt5.QtWidgets import QAction
from PyQt5.QtWidgets import QMessageBox
from PyQt5.QtWidgets import QWidget
Severity: Minor
Found in dotplot/gui/main_window.py - About 2 hrs to fix

    Function make_matplotlib has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def make_matplotlib(self, dot_matrix, subplot, sequences):
            """Generate plot using matplotlib.
    
            Args:
                dot_matrix - (list): list of lists representing a dotplot matrix
    Severity: Minor
    Found in dotplot/drawer.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 main has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def main(argv):
        """Main function running dotplot application.
    
        Args:
            argv:
    Severity: Minor
    Found in dotplot/main.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 interpret_arguments has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def interpret_arguments(self, args):
            """Let's try to be more intelligent and guess what the user wants."""
            # if we don't have both files given, then:
            args.parsed_sequences = self.parse_sequences(args.sequences)
    
    
    Severity: Minor
    Found in dotplot/argument_parser.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 make_unicode has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def make_unicode(self, dot_matrix):
            """Generate Unicode representation of dotmatrix.
    
            Args:
                dot_matrix - (list): list of lists representing a dotplot matrix
    Severity: Minor
    Found in dotplot/drawer.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 get_sequence has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_sequence(address, seq_id):
            """
            Attempts to download a sequence from given address 3 times,
            raises exception if download fails.
    
    
    Severity: Minor
    Found in dotplot/sequence.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 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def __init__(self, default_db='ncbi'):
            super().__init__()
    
            self.id_input = QLineEdit(self)
            self.id_input.setPlaceholderText('Sequence ID')
    Severity: Minor
    Found in dotplot/gui/chooser.py - About 1 hr to fix

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

          def on_change(self, given_value, caller_name=None):
      
              if caller_name == 'seq_lt':
                  value = self.seq_len_combo.currentText()
              elif caller_name == 'always':
      Severity: Minor
      Found in dotplot/gui/options.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 make_ascii has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def make_ascii(self, dot_matrix):
              """Generate an ASCII representation of dotmatrix
      
              Args:
                  dot_matrix - (list): list of lists representing a dotplot matrix
      Severity: Minor
      Found in dotplot/drawer.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 callback_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def callback_file(self):
              file_name, file_type = self.select_sequence_dialog()
      
              if not file_name:
                  return
      Severity: Minor
      Found in dotplot/gui/main_window.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 apply_stringency has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def apply_stringency(self, scores):
              """Modify input matrix: place ones if value >= stringenccy, else 0."""
              for row in scores:
                  for i, value in enumerate(row):
                      row[i] = 1 if value >= self.stringency else 0
      Severity: Minor
      Found in dotplot/plotter.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