jarvisteach/appJar

View on GitHub

Showing 542 of 3,395 total issues

File appjar.py has 12086 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
""" appJar.py: Provides a GUI class, for making simple tkinter GUIs. """
# Nearly everything I learnt came from: http://effbot.org/tkinterbook/
# with help from: http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/index.html
# with snippets from stackexchange.com
Severity: Major
Found in appJar/appjar.py - About 1 mo to fix

    gui has 902 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class gui(object):
        """ Class to represent the GUI
            - Create one of these
            - add some widgets
            - call the go() function """
    Severity: Major
    Found in appJar/appjar.py - About 2 wks to fix

      File widget_test.py has 2888 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      import sys
      import time
      import datetime
      import pytest
      Severity: Major
      Found in tests/widget_test.py - About 1 wk to fix

        File png.py has 2025 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        #!/usr/bin/env python
        
        from __future__ import print_function
        
        # png.py - PNG encoder/decoder in pure Python
        Severity: Major
        Found in appJar/lib/png.py - About 5 days to fix

          Function changeLanguage has a Cognitive Complexity of 267 (exceeds 5 allowed). Consider refactoring.
          Open

              def changeLanguage(self, language):
                  """ changes the language used by the GUI
                      will iterate through all widgets and update their text
                      as well as populate a translation dictionary for later lookups """
                  self._loadConfigParser()
          Severity: Minor
          Found in appJar/appjar.py - About 5 days 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 _tabbedFrameMaker has a Cognitive Complexity of 126 (exceeds 5 allowed). Consider refactoring.
          Open

              def _tabbedFrameMaker(self, master, useTtk=False, **kwargs):
                  global OrderedDict
                  if OrderedDict is None:
                      from collections import OrderedDict
          
          
          Severity: Minor
          Found in appJar/appjar.py - About 2 days 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 configureWidget has a Cognitive Complexity of 116 (exceeds 5 allowed). Consider refactoring.
          Open

              def configureWidget(self, kind, name, option, value, key=None, deprecated=False):
                  gui.trace("Configuring: %s of %s with %s of %s", name, kind, option, value)
                  # warn about deprecated functions
                  if deprecated:
                      self.warn("Deprecated config function (%s) used for %s -> %s use %s deprecated", option, WIDGET_NAMES.name(kind), name, deprecated)
          Severity: Minor
          Found in appJar/appjar.py - About 2 days 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 test_containers has 346 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def test_containers():
              print("\tTesting containers")
          
              ## LABEL FRAMES
              lf = app.startLabelFrame("lf1")
          Severity: Major
          Found in tests/widget_test.py - About 1 day to fix

            Function loadSettings has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
            Open

                def loadSettings(self, fileName="appJar.ini", useSettings=True):
                    """ loads setting from a settings file, and adjusts the GUI to match
                        called by go() function, if user has requested settings """
                    self._loadConfigParser()
                    if not ConfigParser:
            Severity: Minor
            Found in appJar/appjar.py - About 1 day 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 _makeAjTreeNode has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
            Open

                def _makeAjTreeNode(self):
                    class AjTreeNode(TreeNode, object):
            
                        def __init__(self, canvas, parent, item):
                            super(AjTreeNode, self).__init__(canvas, parent, item)
            Severity: Minor
            Found in appJar/appjar.py - About 1 day 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 a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
            Open

                def __init__(
                                self, title=None, geom=None, handleArgs=True, language=None,
                                startWindow=None, useTtk=False, useSettings=False, showIcon=True, **kwargs
                            ):
                    """ constructor - sets up the empty GUI window, and inits the various properties """
            Severity: Minor
            Found in appJar/appjar.py - About 1 day 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 setOptionBox has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
            Open

                def setOptionBox(self, title, index, value=True, callFunction=True, override=False):
                    """ Main purpose is to select/deselect the item at the specified position
                    But will also: delete an item if value is set to None or rename an item if value is set to a String
            
                    :param title: the OptionBox to change
            Severity: Minor
            Found in appJar/appjar.py - About 1 day 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 listBox has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
            Open

                def listBox(self, title, value=None, *args, **kwargs):
                    """ simpleGUI -- adds, sets & gets listBoxes all in one go """
                    widgKind = WIDGET_NAMES.ListBox
            
                    rows = kwargs.pop("rows", None)
            Severity: Minor
            Found in appJar/appjar.py - About 1 day 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 nanojpeg.py has 582 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import array, sys
            # NanoJPEG -- KeyJ's Tiny Baseline JPEG Decoder
            # version 1.1 (2010-03-05)
            # by Martin J. Fiedler <martin.fiedler@gmx.net>
            # http://keyj.emphy.de/nanojpeg/
            Severity: Major
            Found in appJar/lib/nanojpeg.py - About 1 day to fix

              Function _receiveExternalDrop has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _receiveExternalDrop(self, event):
                      """ receives external drag events """
                      widgType = gui.GET_WIDGET_CLASS(event.widget)
                      event.widget.dropData = event.data
                      if not hasattr(event.widget, 'dndFunction'):
              Severity: Minor
              Found in appJar/appjar.py - About 1 day 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 test_entries has 197 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              def test_entries():
                  print("\tTesting entries")
                  assert isinstance(app.addEntry("e1"), Entry)
                  with pytest.raises(Exception) :
                      app.addEntry("e1")
              Severity: Major
              Found in tests/widget_test.py - About 7 hrs to fix

                Function optionBox has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
                Open

                    def optionBox(self, title, value=None, *args, **kwargs):
                        """ simpleGUI - adds, sets & gets optionBoxes all in one go """
                        widgKind = WIDGET_NAMES.OptionBox
                        kind = kwargs.pop("kind", "standard").lower().strip()
                        label = kwargs.pop("label", False)
                Severity: Minor
                Found in appJar/appjar.py - About 7 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 _makeAutoCompleteEntry has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _makeAutoCompleteEntry(self):
                        ### Create the dynamic class
                        class AutoCompleteEntry(entryBase, object):
                
                            def __init__(self, words, tl, *args, **kwargs):
                Severity: Minor
                Found in appJar/appjar.py - About 6 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 from_array has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                Open

                def from_array(a, mode=None, info={}):
                    """Create a PNG :class:`Image` object from a 2- or 3-dimensional
                    array.  One application of this function is easy PIL-style saving:
                    ``png.from_array(pixels, 'L').save('foo.png')``.
                
                
                Severity: Minor
                Found in appJar/lib/png.py - About 6 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 _keyPressed has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _keyPressed(self, event):
                        # work out if alt/ctrl/shift are pressed
                        # http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/event-handlers.html
                        state = event.state
                        ctrl  = (state & 0x4) != 0
                Severity: Minor
                Found in appJar/appjar.py - About 6 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

                Severity
                Category
                Status
                Source
                Language