shieldfy/shieldfy-php-client

View on GitHub

Showing 47 of 47 total issues

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

    public function run($value, $target = '*', $tag = '*')
    {
        if ($target !== '*' && $target !== $this->data['target']) {
            return;
        }
Severity: Minor
Found in src/Jury/Rule.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 exposeHeaders has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function exposeHeaders()
    {
        if (function_exists('header_remove')) {
            header_remove('x-powered-by');
        } else {
Severity: Minor
Found in src/Guard.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 collectFromStack has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function collectFromStack()
    {
        $stack = array_reverse($this->stack);

        foreach ($this->stack as $trace):
Severity: Minor
Found in src/Collectors/CodeCollector.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 getBaseDirectory has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function getBaseDirectory()
    {

        // -- first method --
        //
Severity: Minor
Found in src/Config.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

Function handleExceptions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function handleExceptions($exception, $is_exception = true)
    {
        if ($this->callback !== null) {
            call_user_func($this->callback, $exception);
        }
Severity: Minor
Found in src/Collectors/ExceptionsCollector.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

Function sendToJail has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    protected function sendToJail($severity = 'low', $charge  = [], $code = [])
    {

        // Based on severity and config. Let's judge it.
        $incidentId = $this->generateIncidentId($this->collectors['user']->getId());
Severity: Minor
Found in src/Monitors/MonitorBase.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

Function log has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function log()
    {
        if ($this->dispatcher->hasData()) {
            return; // There is already a threat in the pipeline.
        }
Severity: Minor
Found in src/Monitors/RequestMonitor.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 __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function __construct(Config $config, Session $session, Dispatcher $dispatcher, array $collectors, Events $events)
Severity: Minor
Found in src/Monitors/MonitorBase.php - About 35 mins to fix

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

        public function bindColumn($column, &$param, $type = null, $maxlen = null, $driverdata = null)
    Severity: Minor
    Found in src/Collectors/PDO/TraceablePDOStatement.php - About 35 mins to fix

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

          public function __construct($get = [], $post = [], $server = [], $cookies = [], $files = [])
      Severity: Minor
      Found in src/Collectors/RequestCollector.php - About 35 mins to fix

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

            public function __construct(Config $config, Session $session, Dispatcher $dispatcher, array $collectors, Events $events)
        Severity: Minor
        Found in src/Monitors/MonitorsBag.php - About 35 mins to fix

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

              public function bindParam($parameter, &$variable, $data_type = PDO::PARAM_STR, $length = null, $driver_options = null)
          Severity: Minor
          Found in src/Collectors/PDO/TraceablePDOStatement.php - About 35 mins to fix

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

                protected function logInternalError($exception)
                {
                    if (!is_writable($this->config['logsDir'])) {
                        return;
                    }
            Severity: Minor
            Found in src/Collectors/ExceptionsCollector.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 execute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function execute($input_parameters = null)
                {
                    $preparedId = spl_object_hash($this);
                    $boundParameters = $this->boundParameters;
                    if (is_array($input_parameters)) {
            Severity: Minor
            Found in src/Collectors/PDO/TraceablePDOStatement.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 runEqual has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                private function runEqual($value)
                {
            
                    // Multiple equals.
                    if (strpos($this->data['rule'], '|') !== false) {
            Severity: Minor
            Found in src/Jury/Rule.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 runContain has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                private function runContain($value)
                {
            
                    // Multiple contain.
                    if (strpos($this->data['rule'], '|') !== false) {
            Severity: Minor
            Found in src/Jury/Rule.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 save has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                private function save(array $data = [])
                {
                    // If not writable, try to chmod it.
                    if (!is_writable($this->config['paths']['data'])) {
                        @chmod($this->config['paths']['data'], 0755);
            Severity: Minor
            Found in src/Callbacks/UpdateCallback.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

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

            <?php
            
            return [
            
                /*
            Severity: Minor
            Found in src/Extensions/Laravel/config/shieldfy.php and 1 other location - About 30 mins to fix
            src/Extensions/Lumen/config/shieldfy.php on lines 1..72

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

            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
            
            return [
            
                /*
            Severity: Minor
            Found in src/Extensions/Lumen/config/shieldfy.php and 1 other location - About 30 mins to fix
            src/Extensions/Laravel/config/shieldfy.php on lines 1..72

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

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

                public function deepAnalyze($exception)
                {
                    $this->issue('exceptions');
                    if (!$this->isInScope($exception)) {
                        // echo 'NON';
            Severity: Minor
            Found in src/Monitors/ExceptionsMonitor.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