malept/pyoath-toolkit

View on GitHub

Showing 13 of 13 total issues

File __init__.py has 280 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
#
# Copyright 2013, 2014 Mark Lee
#
# Licensed under the Apache License, Version 2.0 (the "License");
Severity: Minor
Found in oath_toolkit/__init__.py - About 2 hrs to fix

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

    def otp_setup(request):
        confirmed_devices = list(devices_for_user(request.user, True))
        tfa_enabled = len(confirmed_devices) > 0
        if request.method == 'GET' and not tfa_enabled:
            unconfirmed_devices = list(devices_for_user(request.user, False))
    Severity: Minor
    Found in examples/django/example/views.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 generate has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def generate(key_type, key, user, issuer, counter=None, **kwargs):
    Severity: Minor
    Found in oath_toolkit/qrcode.py - About 45 mins to fix

      Function totp_validate has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def totp_validate(self, secret, now, time_step_size, start_offset, window,
      Severity: Minor
      Found in oath_toolkit/__init__.py - About 45 mins to fix

        Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, digits, window, verbose_errors=False, get_secret=None,
        Severity: Minor
        Found in oath_toolkit/wtforms.py - About 45 mins to fix

          Function totp_validate has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def totp_validate(secret, now, time_step_size, start_offset, window, otp):
          Severity: Minor
          Found in oath_toolkit/impl_cffi.py - About 45 mins to fix

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

            def hotp_generate(secret, moving_factor, digits, add_checksum=False,
            Severity: Minor
            Found in oath_toolkit/impl_cffi.py - About 35 mins to fix

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

              def totp_generate(secret, now, time_step_size, time_offset, digits):
              Severity: Minor
              Found in oath_toolkit/impl_cffi.py - About 35 mins to fix

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

                    def totp_generate(self, secret, now, time_step_size, time_offset, digits):
                Severity: Minor
                Found in oath_toolkit/__init__.py - About 35 mins to fix

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

                      def hotp_generate(self, secret, moving_factor, digits, add_checksum=False,
                  Severity: Minor
                  Found in oath_toolkit/__init__.py - About 35 mins to fix

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

                    def generate(key_type, key, user, issuer, counter=None):
                    Severity: Minor
                    Found in oath_toolkit/uri.py - About 35 mins to fix

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

                          def __init__(self, digits, window, start_moving_factor,
                      Severity: Minor
                      Found in oath_toolkit/wtforms.py - About 35 mins to fix

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

                        def otp_verify(request):
                            if request.method == 'POST':
                                redirect_to = request.POST.get(REDIRECT_FIELD_NAME,
                                                               request.GET.get(REDIRECT_FIELD_NAME,
                                                                               ''))
                        Severity: Minor
                        Found in examples/django/example/views.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

                        Severity
                        Category
                        Status
                        Source
                        Language