phpbb-extensions/mediaembed

View on GitHub

Showing 4 of 4 total issues

Method update_data has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function update_data()
    {
        return [
            // Add forum permission
            ['permission.add', ['f_mediaembed', false]],
Severity: Minor
Found in migrations/m4_permissions.php - About 1 hr to fix

    Method custom_forum_roles has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function custom_forum_roles()
        {
            $sql_array = [
                'SELECT'    => 'roles.role_id, roles.role_name',
                'FROM'        => [
    Severity: Minor
    Found in migrations/m7_add_missing_permissions.php - About 1 hr to fix

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

          public function enable_media_sites($event)
          {
              foreach ($this->get_siteIds() as $siteId)
              {
                  // skip media sites that already exist as a BBCode
      Severity: Minor
      Found in event/main_listener.php - 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 set_media_embed_max_width has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function set_media_embed_max_width()
          {
              $input = $this->request->variable('media_embed_max_width', '');
      
              if ($input)
      Severity: Minor
      Found in controller/acp_controller.php - 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

      Severity
      Category
      Status
      Source
      Language