FlameCore/Infernum

View on GitHub

Showing 43 of 43 total issues

Method log has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function log($severity, $message, array $context = [])
    {
        if (!$this->active) {
            return true;
        }
Severity: Minor
Found in libraries/Logger.php - About 1 hr to fix

    Method createCookie has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function createCookie($name, $value = null, $expire = 0, $path = null, $domain = null, $secure = false, $httpOnly = true)
    Severity: Major
    Found in libraries/Application.php - About 50 mins to fix

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

              $rootNode
                  ->children()
                      ->scalarNode('title')
                          ->isRequired()
                          ->cannotBeEmpty()
      Severity: Minor
      Found in libraries/Configuration/ModuleMetadata.php and 1 other location - About 45 mins to fix
      libraries/Configuration/PluginMetadata.php on lines 35..51

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

      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

              $rootNode
                  ->children()
                      ->scalarNode('title')
                          ->isRequired()
                          ->cannotBeEmpty()
      Severity: Minor
      Found in libraries/Configuration/PluginMetadata.php and 1 other location - About 45 mins to fix
      libraries/Configuration/ModuleMetadata.php on lines 35..51

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

      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

      Method connect has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public static function connect($driver, $host = 'localhost', $user = 'root', $password = '', $database, array $options = [])
      Severity: Minor
      Found in libraries/Database/Database.php - About 45 mins to fix

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

            public function handleRequest(Request $request)
            {
                if ($this->get('_submit')->retrieve($request) == $this->name) {
                    $this->submitted = true;
                }
        Severity: Minor
        Found in libraries/UI/Form/Form.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 validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function validate($value)
            {
                if ($this->scheme) {
                    $value = (string) $value;
        
        
        Severity: Minor
        Found in libraries/UI/Form/Field/TextField.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 toTimestamp has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function toTimestamp($input)
            {
                if (is_numeric($input)) {
                    // Numeric input, we handle it as timestamp
                    return (int) $input;
        Severity: Minor
        Found in libraries/Util.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 encode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function encode($value)
            {
                if (is_bool($value)) {
                    return (int) $value;
                } elseif (is_scalar($value)) {
        Severity: Minor
        Found in libraries/Database/AbstractStatement.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 handle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function handle(Request $request, Application $app)
            {
                if (!$this->isReady()) {
                    throw new \LogicException('Kernel must be booted to handle requests.');
                }
        Severity: Minor
        Found in libraries/Kernel.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 mountModule has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function mountModule($name, $alias = null, $extra = null)
            {
                if (!$this->kernel->moduleExists($name)) {
                    throw new \LogicException(sprintf('Cannot mount module "%s" since it does not exist.', $name));
                }
        Severity: Minor
        Found in libraries/Router.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

        Avoid too many return statements within this method.
        Open

                    return implode(',', $value);
        Severity: Major
        Found in libraries/Database/AbstractStatement.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return $value;
          Severity: Major
          Found in libraries/Resource/AbstractResource.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return unserialize($value);
            Severity: Major
            Found in libraries/Resource/AbstractResource.php - About 30 mins to fix

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

                  public function select($table, $columns = '*', array $params = [])
                  {
                      if (is_array($columns)) {
                          $columns = implode(', ', array_map([$this, 'quoteField'], $columns));
                      } elseif ($columns != '*') {
              Severity: Minor
              Found in libraries/Database/MySQL/MySQLDriver.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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function __construct($sid, Application $app)
                  {
                      $sql = 'SELECT * FROM <PREFIX>sessions WHERE id = ? AND expire > ? LIMIT 1';
                      $result = $app['db']->query($sql, [$sid, date('Y-m-d H:i:s')]);
              
              
              Severity: Minor
              Found in libraries/Session.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 decode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected static function decode($value, $type)
                  {
                      if ($type == 'int') {
                          return (int) $value;
                      } elseif ($type == 'float') {
              Severity: Minor
              Found in libraries/Resource/AbstractResource.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 setMinimum has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function setMinimum($minimum)
                  {
                      if ($minimum === null) {
                          $this->minimum = null;
                      } elseif ($minimum = $this->normalize($minimum)) {
              Severity: Minor
              Found in libraries/UI/Form/Field/DateField.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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function get($name)
                  {
                      if (!$this->validateName($name)) {
                          throw new \InvalidArgumentException(sprintf('Given cache name "%s" is invalid.', $name));
                      }
              Severity: Minor
              Found in libraries/Cache.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 findFile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function findFile($class)
                  {
                      $class = $this->normalize($class);
              
                      foreach ($this->sources as $prefix => $pattern) {
              Severity: Minor
              Found in libraries/ClassLoader.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