Showing 13 of 26 total issues

Function apply_to_dict_patch has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

def apply_to_dict_patch():
    old_model_to_dict = playhouse.shortcuts.model_to_dict

    # noinspection PyProtectedMember
    def my_model_to_dict(model, recurse=True, backrefs=False, only=None,
Severity: Minor
Found in src/lib/pvpatch.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

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

def startapp(appname=None):
    global input  # fix4py3
    if py_major_ver == 2:
        input = raw_input
    
Severity: Minor
Found in fpage.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 pagination_calc has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

def pagination_calc(count_all, page_size, cur_page=1, nearby=2):
    """
    :param nearby:
    :param count_all: count of all items
    :param page_size: size of one page
Severity: Minor
Found in src/model/__init__.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 pagination_calc has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

def pagination_calc(count_all, page_size, cur_page=1, nearby=2):
    """
    :param nearby:
    :param count_all: count of all items
    :param page_size: size of one page
Severity: Minor
Found in src/model_peewee/__init__.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 my_model_to_dict has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def my_model_to_dict(model, recurse=True, backrefs=False, only=None,
Severity: Major
Found in src/lib/pvpatch.py - About 1 hr to fix

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

    def main():
        if len(argv) > 1:
            if argv[1] == 'help':
                help()
            elif argv[1] == 'new':
    Severity: Minor
    Found in fpage.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 pagination_sqlalchemy has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def pagination_sqlalchemy(count_all, query, page_size, cur_page=1, nearby=2):
    Severity: Minor
    Found in src/model/__init__.py - About 35 mins to fix

      Function pagination_peewee has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def pagination_peewee(count_all, query, page_size, cur_page=1, nearby=2):
      Severity: Minor
      Found in src/model_peewee/__init__.py - About 35 mins to fix

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

            def render(self, fn=None, **kwargs):
                if not fn:
                    fn = ('/%s/%s.html' % (
                        '/'.join(self.__module__.split('.')[1:-1]), 
                        self.__class__.__name__.lower()
        Severity: Minor
        Found in src/view/__init__.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 post has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def post(self):
                username = self.get_argument("username")
                password = self.get_argument("password")
                password_again = self.get_argument("password_again")
                next = self.get_argument('next', None)
        Severity: Minor
        Found in src/view/user.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

        Avoid too many return statements within this function.
        Open

                return
        Severity: Major
        Found in fpage.py - About 30 mins to fix

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

              def post(self):
                  username = self.get_argument("username")
                  password = self.get_argument("password")
                  remember = self.get_argument('remember', False)
                  next = self.get_argument('next', None)
          Severity: Minor
          Found in src/view/user.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 gen has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def gen(project_dir, project_name, tmpl_engine, db_orm):
              shutil.copytree(join(src_dir, 'src'), project_dir)
          
              if tmpl_engine == 'mako':
                  shutil.rmtree(join(project_dir, 'templates_jinja2'))
          Severity: Minor
          Found in fpage.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