slim/base/route.py

Summary

Maintainability
D
1 day
Test Coverage

Function _bind has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    def _bind(self):
        from ._view.request_view import RequestView
        from ._view.abstract_sql_view import AbstractSQLView

        def add_to_url_mapping(_meta, _fullpath):
Severity: Minor
Found in slim/base/route.py - About 5 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 query_path has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def query_path(self, method, path) -> Tuple[Union[RouteInterfaceInfo, RouteStaticsInfo, None], Optional[Dict]]:
        """
        Get route info for specified method and path.
        :param method:
        :param path:
Severity: Minor
Found in slim/base/route.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 interface has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def interface(self, method, url=None, *, summary=None, va_query=None, va_post=None, va_headers=None,
Severity: Major
Found in slim/base/route.py - About 1 hr to fix

    Function get has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def get(self, url=None, *, summary=None, va_query=None, va_post=None, va_headers=None,
    Severity: Major
    Found in slim/base/route.py - About 1 hr to fix

      Function post has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def post(self, url=None, *, summary=None, va_query=None, va_post=None, va_headers=None,
      Severity: Major
      Found in slim/base/route.py - About 1 hr to fix

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

            def interface(self, method, url=None, *, summary=None, va_query=None, va_post=None, va_headers=None,
                          va_resp=ResponseDataModel, deprecated=False):
                """
                Register interface
                :param method:
        Severity: Minor
        Found in slim/base/route.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 query_ws_path has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def query_ws_path(self, path) -> Tuple[Union[RouteWebsocketInfo, None], Optional[Dict]]:
                ret = self._url_ws_mappings.get(path)
                if ret:
                    return ret, {}
        
        
        Severity: Minor
        Found in slim/base/route.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 view has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def view(self, url, tag_name=None):
                """
                Register View Class
                :param url:
                :param tag_name:
        Severity: Minor
        Found in slim/base/route.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 websocket has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def websocket(self, url=None):
                """
                Register Websocket
                :param url:
                :return:
        Severity: Minor
        Found in slim/base/route.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

        There are no issues that match your filters.

        Category
        Status