thenetcircle/dino

View on GitHub

Showing 809 of 809 total issues

Function init_database has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def init_database(gn_env: GNEnvironment):
    if len(gn_env.config) == 0 or gn_env.config.get(ConfigKeys.TESTING, False):
        # assume we're testing
        return

Severity: Minor
Found in dino/environ.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 msg_insert has 11 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def msg_insert(self, msg_id, from_user_id, from_user_name, target_id, target_name, body, domain, sent_time, channel_id, channel_name, deleted=False) -> None:
Severity: Major
Found in dino/storage/cassandra_driver.py - About 1 hr to fix

    Function parse has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            JSON.parse = function (text, reviver) {
    
    // The parse method takes a text and an optional reviver function, and returns
    // a JavaScript value if the text is a valid JSON text.
    
    
    Severity: Minor
    Found in dino/templates/js/json2.js - About 1 hr to fix

      Function ban has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function ban() {
          var value = banElement.val();
          var ban_url = $(banUrlField).val();
          var valid = true;
      
      
      Severity: Minor
      Found in dino/admin/static/custom/js/index.js - About 1 hr to fix

        Function __init__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(self, env):
                self.env = env
        
                conf = env.config.get(ConfigKeys.STATS_SERVICE)
                host = conf.get(ConfigKeys.HOST)
        Severity: Minor
        Found in dino/stats/statsd.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 join_room has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def join_room(arg: tuple) -> None:
                data, activity = arg
                room_id = activity.target.id
                user_id = activity.actor.id
        
        
        Severity: Minor
        Found in dino/hooks/join.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 get_user_info has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_user_info(self, user_id: str, skip_cache: bool = False) -> dict:
                key = RedisKeys.auth_key(user_id)
        
                if not skip_cache:
                    session = self.env.cache.get_user_info(user_id)
        Severity: Minor
        Found in dino/auth/redis.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 _get_banned_users has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def _get_banned_users(self, all_bans, encode_response: bool = False, session=None):
                output = dict()
                if all_bans is None or len(all_bans) == 0:
                    return output
        
        
        Severity: Minor
        Found in dino/db/rdbms/handler.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 find_config has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def find_config(config_paths: list) -> tuple:
            default_paths = ["dino.yaml", "dino.json"]
            config_dict = dict()
            config_path = None
        
        
        Severity: Minor
        Found in dino/environ.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 init_request_validators has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def init_request_validators(gn_env: GNEnvironment) -> None:
            from yapsy.PluginManager import PluginManager
            logging.getLogger('yapsy').setLevel(logging.DEBUG)
        
            plugin_manager = PluginManager()
        Severity: Minor
        Found in dino/environ.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 _remove_role_on_channel_for_user has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def _remove_role_on_channel_for_user(self, the_role: str, channel_id: str, user_id: str) -> None:
                @with_session
                def _remove(session=None):
                    channel = session.query(Channels).outerjoin(Channels.roles).filter(Channels.uuid == channel_id).first()
                    if channel is None:
        Severity: Minor
        Found in dino/db/rdbms/handler.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 update_spam_config has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def update_spam_config(
                    self, enabled, max_length, min_length, should_delete,
                    should_save, threshold, ignore_emoji, session=None
            ) -> None:
                config = session.query(Config).first()
        Severity: Minor
        Found in dino/db/rdbms/handler.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 on_create has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def on_create(self, activity: Activity) -> (bool, int, str):
                if not hasattr(activity, 'object') or not hasattr(activity.object, 'url'):
                    return False, ECodes.MISSING_OBJECT_URL, 'no channel id set'
                if not hasattr(activity.target, 'display_name'):
                    return False, ECodes.MISSING_TARGET_DISPLAY_NAME, 'no room name set'
        Severity: Minor
        Found in dino/validation/request.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 get_user_infos has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_user_infos(self, user_ids: set) -> dict:
                @with_session
                def _get_infos(_ids: set, session=None) -> dict:
                    _users = session.query(UserInfo).filter(UserInfo.user_id.in_(_ids)).all()
                    _infos = dict()
        Severity: Minor
        Found in dino/db/rdbms/handler.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 remove_sid_for_user_in_room has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def remove_sid_for_user_in_room(self, user_id, room_id, sid_to_remove):
                @with_session
                def _remove_sid_for_user_in_room(session=None):
                    if room_id is None:
                        sids = session.query(RoomSids) \
        Severity: Minor
        Found in dino/db/rdbms/handler.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 get_all_acls_room has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_all_acls_room(self, room_id: str) -> dict:
                @with_session
                def _acls(session=None):
                    room = session.query(Rooms)\
                        .outerjoin(Rooms.acls)\
        Severity: Minor
        Found in dino/db/rdbms/handler.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 find_config_acl has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def find_config_acl(acl_paths: list) -> (dict, str):
            default_paths = ["acl.yaml", "acl.json"]
            acl_dict = dict()
            acl_path = None
        
        
        Severity: Minor
        Found in dino/environ.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 find_config has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def find_config(config_paths: list=None) -> tuple:
            default_paths = ["dino.yaml", "dino.json"]
            config_dict = dict()
            config_path = None
        
        
        Severity: Minor
        Found in bin/kafka_to_rabbitmq.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 _handle_server_activity has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def _handle_server_activity(self, data: dict, activity: Activity) -> None:
                if activity.id in self.recently_delegated_events_set:
                    return
        
                if activity.id in self.recently_handled_events_set:
        Severity: Minor
        Found in dino/endpoint/queue.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 _handleTTL has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function _handleTTL() {
                var curtime, i, TTL, CRC32, nextExpire = Infinity,
                    changed = false,
                    deleted = [];
        
        
        Severity: Minor
        Found in dino/templates/js/jstorage.js - About 1 hr to fix
          Severity
          Category
          Status
          Source
          Language