shieldfy/shieldfy-php-client

View on GitHub

Showing 47 of 47 total issues

File block.blade.php has 6704 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
Severity: Major
Found in src/Extensions/Laravel/views/block.blade.php - About 2 wks to fix

    File block.blade.php has 6704 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="utf-8">
    Severity: Major
    Found in src/Extensions/Lumen/views/block.blade.php - About 2 wks to fix

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

              $shieldfy = Guard::init([
                      'endpoint'       => config('shieldfy.endpoint'),
                      'app_key'        => config('shieldfy.keys.app_key', env('SHIELDFY_APP_KEY')),
                      'app_secret'     => config('shieldfy.keys.app_secret', env('SHIELDFY_APP_SECRET')),
                      'debug'          => config('shieldfy.debug'),
      Severity: Major
      Found in src/Extensions/Laravel/Middlewares/ShieldfyMiddleware.php and 1 other location - About 3 hrs to fix
      src/Extensions/Lumen/Middlewares/ShieldfyMiddleware.php on lines 19..28

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

      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

              $shieldfy = Guard::init([
                      'endpoint'       => config('shieldfy.endpoint'),
                      'app_key'        => config('shieldfy.keys.app_key', env('SHIELDFY_APP_KEY')),
                      'app_secret'     => config('shieldfy.keys.app_secret', env('SHIELDFY_APP_SECRET')),
                      'debug'          => config('shieldfy.debug'),
      Severity: Major
      Found in src/Extensions/Lumen/Middlewares/ShieldfyMiddleware.php and 1 other location - About 3 hrs to fix
      src/Extensions/Laravel/Middlewares/ShieldfyMiddleware.php on lines 21..30

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

      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

      TraceablePDO has 23 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class TraceablePDO extends PDO
      {
          /** @var PDO */
          protected $pdo;
          public $events = null;
      Severity: Minor
      Found in src/Collectors/PDO/TraceablePDO.php - About 2 hrs to fix

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

                $response = $this->dispatcher->trigger('update/vendors', [
                    'sdk_version' => $this->config['version'],
                    'php_version' => PHP_VERSION,
                    'sapi_type' => @php_sapi_name(),
                    'os_info' => @php_uname(),
        Severity: Major
        Found in src/Callbacks/VendorCallback.php and 1 other location - About 2 hrs to fix
        src/Callbacks/UpdateCallback.php on lines 26..34

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

        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

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

                $response = $this->dispatcher->trigger('update', [
                    'sdk_version'=>$this->config['version'],
                    'php_version'=>PHP_VERSION,
                    'sapi_type' =>@php_sapi_name(),
                    'os_info'=>@php_uname(),
        Severity: Major
        Found in src/Callbacks/UpdateCallback.php and 1 other location - About 2 hrs to fix
        src/Callbacks/VendorCallback.php on lines 23..31

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

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

            public function analyze($object = '')
            {
                $request = $this->collectors['request'];
                $info = $request->getInfo();
                $params = array_merge($info['get'], $info['post'], $info['cookies']);
        Severity: Minor
        Found in src/Monitors/MemoryMonitor.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 deepAnalyze has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public function deepAnalyze($content)
            {
                $foundGuilty = false;
                $charge = [];
                foreach ($this->infected as $infected):
        Severity: Minor
        Found in src/Monitors/ViewMonitor.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 analyze has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public function analyze($query, $bindings = [])
            {
        
                // Get the parameters (all).
                $request = $this->collectors['request'];
        Severity: Minor
        Found in src/Monitors/DBMonitor.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 getDefaults has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getDefaults()
            {
                $defaults = [
                    "app_key"           => "",
                    "app_secret"        => "",
        Severity: Minor
        Found in src/Config.php - About 1 hr to fix

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

              public function analyzeFile($input = '', $file = [])
              {
                  $score = 0;
                  $ruleIds = [];
          
          
          Severity: Minor
          Found in src/Monitors/UploadMonitor.php - About 1 hr to fix

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

                public function run()
                {
            
                    // Get the request info.
                    $request = $this->collectors['request'];
            Severity: Minor
            Found in src/Monitors/UploadMonitor.php - About 1 hr to fix

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

                      if (!is_writable($this->config['paths']['data'])) {
                          @chmod($this->config['paths']['data'], 0755);
                          if (!is_writable($this->config['paths']['data'])) {
                              throw new InstallationException('Data folder :'.$this->config['paths']['data'].' Is not writable', 200);
                          }
              Severity: Major
              Found in src/Callbacks/UpdateCallback.php and 1 other location - About 1 hr to fix
              src/Install/Installer.php on lines 74..79

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

              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 (!is_writable($this->config['paths']['data'])) {
                          @chmod($this->config['paths']['data'], 0755);
                          if (!is_writable($this->config['paths']['data'])) {
                              throw new InstallationException('Data folder :'.$this->config['paths']['data'].' Is not writable', 200);
                          }
              Severity: Major
              Found in src/Install/Installer.php and 1 other location - About 1 hr to fix
              src/Callbacks/UpdateCallback.php on lines 70..75

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

              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 update has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function update()
                  {
                      $response = $this->dispatcher->trigger('update', [
                          'sdk_version'=>$this->config['version'],
                          'php_version'=>PHP_VERSION,
              Severity: Minor
              Found in src/Callbacks/UpdateCallback.php - About 1 hr to fix

                Method sendToJail has 28 lines of code (exceeds 25 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 1 hr to fix

                  Method analyze has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function analyze($query, $bindings = [])
                      {
                  
                          // Get the parameters (all).
                          $request = $this->collectors['request'];
                  Severity: Minor
                  Found in src/Monitors/DBMonitor.php - About 1 hr to fix

                    Method deepAnalyze has 26 lines of code (exceeds 25 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 1 hr to fix

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

                          protected function logInternalError($exception)
                          {
                              if (!is_writable($this->config['logsDir'])) {
                                  return;
                              }
                      Severity: Minor
                      Found in src/Collectors/ExceptionsCollector.php - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language