IET-OU/open-media-player

View on GitHub

Showing 39 of 39 total issues

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

        if (preg_match('/oup-light|ouplayer-base|mejs-default/', $this->_theme->name)) {
            $this->load->theme($this->_theme->name);

            $this->theme->prepare($player);

Severity: Major
Found in application/controllers/embed.php and 1 other location - About 1 hr to fix
application/controllers/embed.php on lines 128..146

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 110.

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

        if (preg_match('/oup-light|ouplayer-base|mejs-default/', $this->_theme->name)) {
            $this->load->theme($this->_theme->name);

            $this->theme->prepare($player);

Severity: Major
Found in application/controllers/embed.php and 1 other location - About 1 hr to fix
application/controllers/embed.php on lines 251..269

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 110.

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 _player has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _player($class, $options)
    {
        header('Content-Type: text/html; charset=utf-8');

      // Security: No access control required?
Severity: Minor
Found in application/controllers/embed.php - 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 pod has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function pod($custom_id = null, $shortcode = null)
    {
        if (!$custom_id || !$shortcode) {
            $this->_error("an album ID and track MD5 hash are required in the URL", 400);
        }
Severity: Minor
Found in application/controllers/embed.php - 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

Method index has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function index($return = false)
    {
        @header('Content-Disposition: inline; filename=ouplayer-ou-embed-services.json');

      // JSON-P callback: security. Only allow eg. 'Object.func_CB_1234'
Severity: Minor
Found in application/controllers/services.php - About 1 hr to fix

    Function _authenticate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function _authenticate()
        {
            if ($this->config->item('auth_localhost_bypass') && 'localhost' == $_SERVER['HTTP_HOST']) {
                $this->_debug('auth_localhost_bypass');
                return;
    Severity: Minor
    Found in application/controllers/admin.php - About 55 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_item has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public function get_item($basename, $shortcode = null, $captions = false)
        {
    
            $url = $this->_feed_url($basename, $shortcode);
    
    
    Severity: Minor
    Found in application/models/podcast_items_feed_model.php - About 55 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

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

    <?php if ($help_url && $about_url): ?>
      <a rel="help" class="help" href="<?php echo $help_url ?>" target="_blank" title="<?php echo t('New window') ?>"><span><?php echo t('Player help') ?></span></a>
      <a class="about" href="<?php echo $about_url ?>" target="_blank" title="<?php echo t('New window') ?>"><span><?php echo t('About the player') ?></span></a>
    <?php else: ?>
      <a rel="help" class="help" href="<?php echo $about_url ? $about_url : $help_url ?>" target="_blank" title="<?php echo t('New window') ?>"><span><?php echo t('Help and about') ?></span></a>
    Severity: Minor
    Found in application/views/ouplayer/oup_settings.php and 1 other location - About 55 mins to fix
    application/views/ouplayer/oup_settings.php on lines 118..123

    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 98.

    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

    <?php if ($help_url && $about_url): ?>
      <a rel="help" class="help" href="<?php echo $help_url ?>" target="_blank" title="<?php echo t('New window') ?>"><span><?php echo t('Player help') ?></span></a>
      <a class="about" href="<?php echo $about_url ?>" target="_blank" title="<?php echo t('New window') ?>"><span><?php echo t('About the player') ?></span></a>
    <?php else: ?>
      <a rel="help" class="help" href="<?php echo $about_url ? $about_url : $help_url ?>" target="_blank" title="<?php echo t('New window') ?>"><span><?php echo t('Help and about') ?></span></a>
    Severity: Minor
    Found in application/views/ouplayer/oup_settings.php and 1 other location - About 55 mins to fix
    application/views/ouplayer/oup_settings.php on lines 75..80

    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 98.

    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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function initialize()
        {
            $CI =& get_instance();
            //$CI->load->library('POParser');
          #$lang = $CI->input->get('lang');
    Severity: Minor
    Found in application/core/MY_Lang.php - About 45 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

    Method log_exception has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function log_exception($severity, $message, $filepath, $line, $label = 'Error')
    Severity: Minor
    Found in application/core/MY_Exceptions.php - About 35 mins to fix

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

          public function jquery_oembed($cache_minutes = 10)
          {
      
              $cache_key = 'scripts_jquery.oembed.js';
              $this->_cache_init($cache_key);
      Severity: Minor
      Found in application/controllers/scripts.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 _feed_url has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function _feed_url($basename, $shortcode)
          {
              $url_pattern = $this->config->item('podcast_feed_url_pattern');
              $locate = "\$config[podcast_feed_url_pattern] in 'config/embed_config.php'";
      
      
      Severity: Minor
      Found in application/models/podcast_items_feed_model.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 _join_yuicompress has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function _join_yuicompress($assets, $ctype = 'application/x-javascript')
          {
              #@header("Content-Type: $ctype; charset=utf-8");
              $out = array();
              foreach ($assets as $file) {
      Severity: Minor
      Found in application/controllers/scripts.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 url_exists has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function url_exists($url)
          {
              $url = str_replace("http://", "", $url);
              if (strstr($url, "/")) {
                  $url = explode("/", $url, 2);
      Severity: Minor
      Found in application/models/podcast_items_feed_model.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 index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function index($return = false)
          {
              @header('Content-Disposition: inline; filename=ouplayer-ou-embed-services.json');
      
            // JSON-P callback: security. Only allow eg. 'Object.func_CB_1234'
      Severity: Minor
      Found in application/controllers/services.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 html has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function html($lang = 'x', $download = false)
          {
              $lang = $langx = strtolower($lang);
      
              if ('en'==$lang) {
      Severity: Minor
      Found in application/controllers/localize.php - 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_oembed_examples has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function _get_oembed_examples()
          {
              $examples = $names = array();
              $providers = $this->_get_oembed_providers();
      
      
      Severity: Minor
      Found in application/controllers/demo.php - 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 _cache_init has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function _cache_init($key)
          {
              // Start with a low value for caching. (No, set expires headers in .htaccess/ httpd.conf)
              $cache = $this->input->get('cache');
              $minutes = $this->config->item('cache_minutes');
      Severity: Minor
      Found in application/controllers/scripts.php - 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

      Severity
      Category
      Status
      Source
      Language