thenetcircle/dino

View on GitHub

Showing 480 of 808 total issues

File handler.py has 2967 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Severity: Major
Found in dino/db/rdbms/handler.py - About 1 wk to fix

    DatabaseRdbms has 192 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class DatabaseRdbms(object):
        def __init__(self, env: GNEnvironment):
            self.env = env
            if self.env.config.get(ConfigKeys.TESTING, False):
                DatabaseRdbms.db = MockDatabase()
    Severity: Major
    Found in dino/db/rdbms/handler.py - About 3 days to fix

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

      import ast
      import logging
      import os
      import re
      import sys
      Severity: Major
      Found in dino/utils/__init__.py - About 3 days to fix

        DatabaseRedis has 183 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class DatabaseRedis(object):
            redis = None
        
            def __init__(self, env: GNEnvironment, host: str, port: int = 6379, db: int = 0):
                if environ.env.config.get(ConfigKeys.TESTING, False) or host == 'mock':
        Severity: Major
        Found in dino/db/redis.py - About 3 days to fix

          IDatabase has 164 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class IDatabase(Interface):
              def init_config(self) -> None:
                  """
                  initialize the config table
          
          
          Severity: Major
          Found in dino/db/__init__.py - About 3 days to fix

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

            #!/usr/bin/env python
            
            # Licensed under the Apache License, Version 2.0 (the "License");
            # you may not use this file except in compliance with the License.
            # You may obtain a copy of the License at
            Severity: Major
            Found in dino/db/__init__.py - About 3 days to fix

              File redis.py has 1164 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import json
              import logging
              import traceback
              import random
              import sys
              Severity: Major
              Found in dino/cache/redis.py - About 2 days to fix

                CacheRedis has 143 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class CacheRedis(object):
                    def __init__(self, env, host: str, port: int = 6379, db: int = 0):
                        if env.config.get(ConfigKeys.TESTING, False) or host == 'mock':
                            from fakeredis import FakeStrictRedis
                
                
                Severity: Major
                Found in dino/cache/redis.py - About 2 days to fix

                  File redis.py has 1093 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  #!/usr/bin/env python
                  
                  # Licensed under the Apache License, Version 2.0 (the "License");
                  # you may not use this file except in compliance with the License.
                  # You may obtain a copy of the License at
                  Severity: Major
                  Found in dino/db/redis.py - About 2 days to fix

                    File routes.py has 1024 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import logging
                    import os
                    import sys
                    import traceback
                    from functools import wraps
                    Severity: Major
                    Found in dino/admin/routes.py - About 2 days to fix

                      ICache has 129 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class ICache(Interface):
                          def get_user_for_sid(self, sid: str):
                              """
                              get the user id for a sid
                      
                      
                      Severity: Major
                      Found in dino/cache/__init__.py - About 2 days to fix

                        File environ.py has 858 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        # Licensed under the Apache License, Version 2.0 (the "License");
                        # you may not use this file except in compliance with the License.
                        # You may obtain a copy of the License at
                        #
                        # http://www.apache.org/licenses/LICENSE-2.0
                        Severity: Major
                        Found in dino/environ.py - About 2 days to fix

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

                          from typing import Set
                          
                          from zope.interface import Interface
                          from typing import Union, Dict, List, Optional
                          
                          
                          Severity: Major
                          Found in dino/cache/__init__.py - About 1 day to fix

                            Function handle_disconnect has a Cognitive Complexity of 91 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def handle_disconnect(arg: tuple, is_socket_disconnect: bool=False) -> None:
                                    """
                                    when a client disconnects this hook will handle the related logic
                            
                                    :param arg: tuple of (data, parsed_activity)
                            Severity: Minor
                            Found in dino/hooks/disconnect.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 do_process has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def do_process(arg: tuple) -> None:
                                    def send(_data: dict, _room: str, _json: bool=True, _broadcast: bool=True) -> None:
                                        environ.env.emit('message', _data, json=_json, room=_room, broadcast=_broadcast)
                            
                                    def publish_activity() -> None:
                            Severity: Minor
                            Found in dino/hooks/message.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 pre_process has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def pre_process(validation_name, should_validate_request=True):
                                def factory(view_func):
                                    @wraps(view_func)
                                    def decorator(*a, **k):
                                        def _pre_process(*args, **kwargs):
                            Severity: Minor
                            Found in dino/utils/decorators.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 on_message has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def on_message(self, activity: Activity) -> (bool, int, str):
                                    room_id = activity.target.id
                                    user_id = activity.actor.id
                                    object_type = activity.target.object_type
                                    message = activity.object.content
                            Severity: Minor
                            Found in dino/validation/request.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 request.py has 592 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import sys
                            from activitystreams.models.activity import Activity
                            from activitystreams.models.defobject import DefObject
                            from activitystreams.models.actor import Actor
                            from activitystreams.models.target import Target
                            Severity: Major
                            Found in dino/validation/request.py - About 1 day to fix

                              File jstorage.js has 579 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              /*
                               * ----------------------------- JSTORAGE -------------------------------------
                               * Simple local storage wrapper to save data on the browser side, supporting
                               * all major browsers - IE6+, Firefox2+, Safari4+, Chrome4+ and Opera 10.5+
                               *
                              Severity: Major
                              Found in dino/templates/js/jstorage.js - About 1 day to fix

                                File acl.py has 560 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                #!/usr/bin/env python
                                
                                # Licensed under the Apache License, Version 2.0 (the "License");
                                # you may not use this file except in compliance with the License.
                                # You may obtain a copy of the License at
                                Severity: Major
                                Found in dino/validation/acl.py - About 1 day to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language