thenetcircle/dino

View on GitHub

Showing 809 of 809 total issues

Function _get_rooms_for_channel_without_info has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_rooms_for_channel_without_info(self, channel_id: str) -> dict:
        """
        room.uuid: {
            'ephemeral': room.ephemeral,
            'name': room.name
Severity: Minor
Found in dino/cache/redis.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 rename_room has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def rename_room(self, channel_id: str, room_id: str, room_name: str) -> None:
        if self.env.cache.get_channel_exists(channel_id) is None:
            if not self.channel_exists(channel_id):
                raise NoSuchChannelException(channel_id)

Severity: Minor
Found in dino/db/redis.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 _format_acls has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _format_acls(self, all_acls: dict, encode_result: bool = True) -> list:
        output = list()
        for action, acls in all_acls.items():
            for acl_type, acl_value in acls.items():
                output.append({
Severity: Minor
Found in dino/db/manager/acls.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 db_connect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def db_connect(self):
        """
        Performs database connection using database settings from settings.py.
        Returns sqlalchemy engine instance
        """
Severity: Minor
Found in dino/db/rdbms/dbman.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 get_channels has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_channels(self) -> dict:
        @with_session
        def _get_channels(session=None):
            rows = session.query(Channels).all()
            _channels = dict()
Severity: Minor
Found in dino/db/rdbms/handler.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 _get_users_with_role has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_users_with_role(self, roles, role_key):
        if roles is None or len(roles) == 0:
            return dict()

        found = dict()
Severity: Minor
Found in dino/db/rdbms/handler.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 on_invite has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def on_invite(self, activity: Activity) -> (bool, int, str):
        if not hasattr(activity.actor, 'url'):
            return False, ECodes.MISSING_ACTOR_URL, 'need invite room uuid in actor.url'
        invite_room = activity.actor.url

Severity: Minor
Found in dino/validation/request.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 get_all_permanent_rooms has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_all_permanent_rooms(self):
        @with_session
        def _get_all_permanent_rooms(session=None):
            rooms = session.query(Rooms).filter(Rooms.ephemeral.is_(False)).all()
            if rooms is None or len(rooms) == 0:
Severity: Minor
Found in dino/db/rdbms/handler.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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, ban_duration):
        if ban_duration is None or ban_duration == '':
            raise ValueError('empty ban duration')

        valid_ends = {'s', 'm', 'h', 'd'}
Severity: Minor
Found in dino/validation/duration.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 _remove_or_rename_room has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _remove_or_rename_room(self, activity: Activity, action: str) -> (bool, int, str):
        user_id = activity.actor.id
        room_id = activity.target.id

        if utils.is_owner(room_id, user_id):
Severity: Minor
Found in dino/validation/request.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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, env, is_external_queue: bool):
        super().__init__(env, is_external_queue, queue_type='kafka', logger=logger)

        eq_host = env.config.get(ConfigKeys.HOST, domain=self.domain_key, default=None)
        eq_queue = env.config.get(ConfigKeys.QUEUE, domain=self.domain_key, default=None)
Severity: Minor
Found in dino/endpoint/kafka.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 publish has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def publish(self, message: dict) -> None:
        n_tries = 3
        current_try = 0
        failed = False

Severity: Minor
Found in bin/kafka_to_rabbitmq.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 online_count has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def online_count():
    c = statsd.StatsClient(STATSD_HOST, 8125, prefix=PREFIX + 'online')
    while True:
        for _, _, community, db_num in hosts:
            count = r_servers[community].scard('users:multicast')
Severity: Minor
Found in bin/statsd-online-count.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 _setup_external_queue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _setup_external_queue(self, conf, env):
        ext_queue_type = conf.get(ConfigKeys.TYPE, domain=ConfigKeys.EXTERNAL_QUEUE)
        if ext_queue_type is None:
            # external queue not required
            self.env.external_publisher = PubSub.mock_publish
Severity: Minor
Found in dino/endpoint/pubsub.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

TODO found
Open

                # TODO: sentry
Severity: Minor
Found in dino/hooks/disconnect.py by fixme

TODO found
Open

// TODO: Use this.as('ms')?

TODO found
Open

        # TODO: when choosing to login invisibly, this is called before the user connects to dino, so should NOT do set_offline()
Severity: Minor
Found in dino/hooks/status.py by fixme

TODO found
Open

                # TODO: sentry
Severity: Minor
Found in dino/hooks/disconnect.py by fixme

TODO found
Open

// TODO: Another silent failure?

TODO found
Open

        # TODO: support room name
Severity: Minor
Found in dino/db/redis.py by fixme
Severity
Category
Status
Source
Language