thenetcircle/dino

View on GitHub

Showing 809 of 809 total issues

Function murmurhash2_32_gc has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function murmurhash2_32_gc(str, seed) {
        var
            l = str.length,
            h = seed ^ l,
            i = 0,
Severity: Minor
Found in dino/templates/js/jstorage.js - About 1 hr to fix

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

                    print("{}={}".format(args[0][0], args[0][1][k]))
    Severity: Major
    Found in bin/create_broadcast_groups.py and 2 other locations - About 1 hr to fix
    bin/create_broadcast_groups.py on lines 71..71
    bin/create_broadcast_groups.py on lines 72..72

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 40.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

                    print("{}={}".format(args[1][0], args[1][1][j]))
    Severity: Major
    Found in bin/create_broadcast_groups.py and 2 other locations - About 1 hr to fix
    bin/create_broadcast_groups.py on lines 70..70
    bin/create_broadcast_groups.py on lines 72..72

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 40.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

                    print("{}={}".format(args[2][0], args[2][1][i]))
    Severity: Major
    Found in bin/create_broadcast_groups.py and 2 other locations - About 1 hr to fix
    bin/create_broadcast_groups.py on lines 70..70
    bin/create_broadcast_groups.py on lines 71..71

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 40.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            if form.target_type.data != 'global':
                if field.data is None or len(field.data.strip()) == 0:
                    raise ValidationError('Need target ID if type is not global ban')
    Severity: Major
    Found in dino/admin/forms/__init__.py and 1 other location - About 1 hr to fix
    dino/admin/forms/__init__.py on lines 75..77

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 40.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        _socketio = SocketIO(
                _app,
                logger=logger,
                engineio_logger=os.environ.get('DINO_DEBUG', '0') == '1',
    Severity: Major
    Found in dino/restful.py and 1 other location - About 1 hr to fix
    dino/web.py on lines 88..91

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 40.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        def __call__(self, form, field):
            if field.data is None or len(field.data.strip()) == 0:
                raise ValidationError('Need non-blank value')
    Severity: Major
    Found in dino/admin/forms/__init__.py and 1 other location - About 1 hr to fix
    dino/admin/forms/__init__.py on lines 64..66

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 40.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        _socketio = SocketIO(
                _app,
                logger=logger,
                engineio_logger=os.environ.get('DINO_DEBUG', '0') == '1',
    Severity: Major
    Found in dino/web.py and 1 other location - About 1 hr to fix
    dino/restful.py on lines 75..78

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 40.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function create_env has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def create_env(config_paths: list = None) -> GNEnvironment:
        logging.basicConfig(level='DEBUG', format=ConfigKeys.DEFAULT_LOG_FORMAT)
    
        gn_environment = os.getenv(ENV_KEY_ENVIRONMENT)
        logger.info('using environment %s' % gn_environment)
    Severity: Minor
    Found in dino/environ.py - About 1 hr to fix

      Function join_the_room has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def join_the_room(
      Severity: Major
      Found in dino/utils/__init__.py - About 1 hr to fix

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

            def _msg_delete(self, message_id: str, deleted: bool, clear_body: bool = True) -> None:
                """
                We're doing three queries here, one to get primary index of messages table from message_id, then getting the
                complete row from messages table, and finally updating that row. This could be lowered to two queries by
                duplicating everything from messages table to messages_by_id materialized view, but would also double storage
        Severity: Minor
        Found in dino/storage/cassandra_driver.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 leave_room has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def leave_room(self, user_id: str, room_id: str) -> None:
                @with_session
                def _leave(session=None):
                    room = session.query(Rooms).filter(Rooms.uuid == room_id).first()
                    if room 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 get_acls_in_room_for_action has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_acls_in_room_for_action(self, room_id: str, action: str):
                @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 get_user_name has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_user_name(self, user_id: str, skip_cache=False) -> str:
                @with_session
                def _get_user_name(session=None):
                    user = session.query(Users).filter(Users.uuid == user_id).first()
                    if user 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 do_get has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def do_get(self):
                is_valid, msg, json = self.validate_json(self.request, silent=True)
                if not is_valid:
                    logger.error('invalid json: %s' % msg)
                    return dict()
        Severity: Minor
        Found in dino/rest/resources/muted.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_acls_in_channel_for_action has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_acls_in_channel_for_action(self, channel_id: str, action: str):
                @with_session
                def _acls(session=None):
                    channel = session.query(Channels)\
                        .outerjoin(Channels.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 ban_user has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def ban_user(
                    self, user_id: str, target_id: str, duration: str, target_type: str,
                    reason: str = None, banner_id: str = None, user_name: str = None, target_name: str = None
            ) -> None:
                if target_type not in {'global', 'channel', 'room'}:
        Severity: Minor
        Found in dino/db/manager/users.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 _test_a_clause has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def _test_a_clause(self, clause, is_validating_a_user: bool, activity: Activity=None, env=None):
                if '=' not in clause:
                    raise ValidationException('no equal sign in clause: %s' % clause)
        
                if len(clause.split('=')) != 2:
        Severity: Minor
        Found in dino/validation/acl.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_channel has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_all_acls_channel(self, channel_id: str) -> dict:
                @with_session
                def _acls(session=None):
                    channel = session.query(Channels)\
                        .outerjoin(Channels.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 do_get has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def do_get(self):
                is_valid, msg, json = self.validate_json(self.request, silent=False)
                if not is_valid:
                    logger.error('invalid json: %s' % msg)
                    return dict()
        Severity: Minor
        Found in dino/rest/resources/users_in_rooms.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

        Severity
        Category
        Status
        Source
        Language