mstuttgart/pynocchio

View on GitHub

Showing 47 of 47 total issues

Function setupUi has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def setupUi(self, config_dialog):
        config_dialog.setObjectName("config_dialog")
        config_dialog.setWindowModality(QtCore.Qt.ApplicationModal)
        config_dialog.resize(400, 213)
        icon = QtGui.QIcon()
Severity: Major
Found in pynocchio/uic_files/preference_dialog_ui.py - About 2 hrs to fix

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

                    if get_file_extension(name).lower() in IMAGE_FILE_FORMATS:
                        try:
                            self.data.append(Page(rar.read(name), name, page))
                            page += 1
                        except rarfile.BadRarFile as exc:
    Severity: Major
    Found in pynocchio/comic_file_loader_rar.py and 1 other location - About 2 hrs to fix
    pynocchio/comic_file_loader_zip.py on lines 57..64

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

    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

                        try:
                            self.data.append(Page(zf.read(name), name, page))
                            page += 1
                        except zipfile.BadZipfile as exc:
                            logger.exception(
    Severity: Major
    Found in pynocchio/comic_file_loader_zip.py and 1 other location - About 2 hrs to fix
    pynocchio/comic_file_loader_rar.py on lines 48..56

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

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

        def _get_comic_to_open(self):
            selection_model = self.ui.bookmark_table.selectionModel()
    
            if selection_model.hasSelection():
                path = selection_model.selectedRows(1)[0].data()
    Severity: Minor
    Found in pynocchio/bookmark_manager_dialog.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

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

                    option = QtWidgets.QMessageBox().warning(
                        self, self.tr('Comic does not exist'),
                        self.tr('The selected comic does not exist! Would you '
                                'like to remove it from the bookmark list?'),
                        QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel,
    Severity: Major
    Found in pynocchio/bookmark_manager_dialog.py and 1 other location - About 1 hr to fix
    pynocchio/bookmark_manager_dialog.py on lines 86..90

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

    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

            option = QtWidgets.QMessageBox().warning(
                self, self.tr('Delete bookmarks'),
                self.tr('This action will delete your bookmarks! Proceed?'),
                QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel,
                QtWidgets.QMessageBox.Ok)
    Severity: Major
    Found in pynocchio/bookmark_manager_dialog.py and 1 other location - About 1 hr to fix
    pynocchio/bookmark_manager_dialog.py on lines 115..120

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

    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 go_next_page(self):
            if self.current_page_index < len(self.comic.pages) - 1:
                self.current_page_index += 1
                return True
            else:
    Severity: Major
    Found in pynocchio/comic_page_handler.py and 1 other location - About 1 hr to fix
    pynocchio/comic_page_handler.py on lines 66..71

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

    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 go_next_page(self):
            if self.current_page_index < len(self.comic.pages) - 2:
                self.current_page_index += 2
                return True
            else:
    Severity: Major
    Found in pynocchio/comic_page_handler.py and 1 other location - About 1 hr to fix
    pynocchio/comic_page_handler.py on lines 40..45

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

    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 setupUi has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def setupUi(self, NotFoundDialog):
            NotFoundDialog.setObjectName("NotFoundDialog")
            NotFoundDialog.setWindowModality(QtCore.Qt.ApplicationModal)
            NotFoundDialog.resize(506, 363)
            sizePolicy = QtWidgets.QSizePolicy(
    Severity: Minor
    Found in pynocchio/uic_files/not_found_dialog_ui.py - About 1 hr to fix

      Function setupUi has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def setupUi(self, AboutDialog):
              AboutDialog.setObjectName("AboutDialog")
              AboutDialog.setWindowModality(QtCore.Qt.ApplicationModal)
              AboutDialog.resize(506, 363)
              sizePolicy = QtWidgets.QSizePolicy(
      Severity: Minor
      Found in pynocchio/uic_files/about_dialog_ui.py - About 1 hr to fix

        Function setupUi has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def setupUi(self, Thumbnails):
                Thumbnails.setObjectName("Thumbnails")
                Thumbnails.resize(183, 195)
                sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
                sizePolicy.setHorizontalStretch(0)
        Severity: Minor
        Found in pynocchio/uic_files/thumbnails_ui.py - About 1 hr to fix

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

              def load(self, filename, initial_page=None):
                  logger.info('Loading %s at %i', filename,
                              0 if initial_page is None else initial_page)
          
                  loader = ComicLoaderFactory.create_loader(filename)
          Severity: Minor
          Found in pynocchio/main_window_model.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 load has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def load(self, filename):
                  """ Load tar file and create Page objects with them.
          
                      Args:
                          filename: name of tar file
          Severity: Minor
          Found in pynocchio/comic_file_loader_tar.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 on_action_fullscreen_triggered has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def on_action_fullscreen_triggered(self):
          
                  if self.isFullScreen():
                      self.ui.menubar.show()
                      if self.ui.action_show_toolbar.isChecked():
          Severity: Minor
          Found in pynocchio/main_window_view.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

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

                      new_y = scroll_position['y'] + self.drag_position['y'] - pos.y()
          Severity: Minor
          Found in pynocchio/uic_files/custom_widgets/qscroll_area_viewer.py and 1 other location - About 45 mins to fix
          pynocchio/uic_files/custom_widgets/qscroll_area_viewer.py on lines 45..45

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

              def load(self, dirname):
                  """ Load image files in directory and create Page objects with them.
          
                  Args:
                      dirname: name of directory
          Severity: Minor
          Found in pynocchio/comic_file_loader_dir.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

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

                      new_x = scroll_position['x'] + self.drag_position['x'] - pos.x()
          Severity: Minor
          Found in pynocchio/uic_files/custom_widgets/qscroll_area_viewer.py and 1 other location - About 45 mins to fix
          pynocchio/uic_files/custom_widgets/qscroll_area_viewer.py on lines 46..46

          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

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

              def go_previous_page(self):
                  if self.current_page_index > 0:
                      self.current_page_index -= 1
                      return True
                  else:
          Severity: Minor
          Found in pynocchio/comic_page_handler.py and 1 other location - About 40 mins to fix
          pynocchio/comic_page_handler.py on lines 73..78

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

          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 go_previous_page(self):
                  if self.current_page_index > 1:
                      self.current_page_index -= 2
                      return True
                  else:
          Severity: Minor
          Found in pynocchio/comic_page_handler.py and 1 other location - About 40 mins to fix
          pynocchio/comic_page_handler.py on lines 47..52

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

          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

                  self.page_number.setText(
                      self.tr('Page: ') + str(current_page) + '/' + str(total_pages))
          Severity: Minor
          Found in pynocchio/uic_files/custom_widgets/status_bar.py and 1 other location - About 35 mins to fix
          pynocchio/uic_files/custom_widgets/status_bar.py on lines 101..101

          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