thenetcircle/dino

View on GitHub

Showing 809 of 809 total issues

Function get_user_id has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get_user_id(self, user_name: str) -> str:
        @with_session
        def _get_user_name(session=None):
            user = session.query(Users).filter(Users.name == user_name).first()
            if user is None:
Severity: Minor
Found in dino/db/rdbms/handler.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 publish has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def publish(self, message: dict, topic: str = None) -> None:
        if self.recently_sent_has(topic, message['id']):
            self.logger.debug('ignoring external event with verb %s and id %s, already sent' %
                         (message['verb'], message['id']))
            return
Severity: Minor
Found in dino/endpoint/base.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

Avoid too many return statements within this function.
Open

        return True
Severity: Major
Found in dino/utils/__init__.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return True
    Severity: Major
    Found in dino/utils/__init__.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                      return False, ErrorCodes.NOT_ALLOWED_TO_WHISPER_SELF
      Severity: Major
      Found in dino/remote/handler.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return api_response(200)
        Severity: Major
        Found in dino/admin/routes.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

          e=j([2e3,1]).day(d),c&&!this._fullWeekdaysParse[d]&&(this._fullWeekdaysParse[d]=new RegExp("^"+this.weekdays(e,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[d]=new RegExp("^"+this.weekdaysShort(e,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[d]=new RegExp("^"+this.weekdaysMin(e,"").replace(".",".?")+"$","i")),this._weekdaysParse[d]||(f="^"+this.weekdays(e,"")+"|^"+this.weekdaysShort(e,"")+"|^"+this.weekdaysMin(e,""),this._weekdaysParse[d]=new RegExp(f.replace(".",""),"i")),c&&"dddd"===b&&this._fullWeekdaysParse[d].test(a))return d;if(c&&"ddd"===b&&this._shortWeekdaysParse[d].test(a))return d;if(c&&"dd"===b&&this._minWeekdaysParse[d].test(a))return d;if(!c&&this._weekdaysParse[d].test(a))return d}}
          Severity: Major
          Found in dino/admin/static/vendor/moment.min.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return api_response(200)
            Severity: Major
            Found in dino/admin/routes.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return success == 1, ErrorCodes.OK
              Severity: Major
              Found in dino/remote/handler.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return api_response(200, user)
                Severity: Major
                Found in dino/admin/routes.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return msg
                  Severity: Major
                  Found in dino/utils/__init__.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return True
                    Severity: Major
                    Found in dino/utils/__init__.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return True, None, session
                      Severity: Major
                      Found in dino/auth/redis.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                        return False, ErrorCodes.NOT_ALLOWED_TO_WHISPER_TURNED_OFF
                        Severity: Major
                        Found in dino/remote/handler.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return api_response(200)
                          Severity: Major
                          Found in dino/admin/routes.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                return is_valid
                            Severity: Major
                            Found in dino/utils/__init__.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return api_response(400, message='could not create acl for room %s: %s' % (room_uuid, str(e)))
                              Severity: Major
                              Found in dino/admin/routes.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                        return False
                                Severity: Major
                                Found in dino/utils/__init__.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                      return False
                                  Severity: Major
                                  Found in dino/utils/__init__.py - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                            return api_response(400, message='could not create acl for channel %s: %s' % (channel_uuid, str(e)))
                                    Severity: Major
                                    Found in dino/admin/routes.py - About 30 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language