thomas-claireau/PHP-P5-Openclassrooms

View on GitHub

Showing 24 of 26 total issues

Function uploadImg has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

    public function uploadImg($type = null, $id = null, $action = null)
    {
        $accepted_origins = array("http://localhost:3000", "http://82.64.201.160", "http://recette.thomas-claireau.fr", "https://recette.thomas-claireau.fr");
        $type = $type == null ? $this->inputGet('type') : $type;

Severity: Minor
Found in src/Controller/MainController.php - About 5 hrs 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 exports has 113 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = (options) => {
  const { dev } = options;
  const hmr = HMR.getClient();

  return {
Severity: Major
Found in public/_webpack/webpack.config.js - About 4 hrs to fix

    Method uploadImg has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function uploadImg($type = null, $id = null, $action = null)
        {
            $accepted_origins = array("http://localhost:3000", "http://82.64.201.160", "http://recette.thomas-claireau.fr", "https://recette.thomas-claireau.fr");
            $type = $type == null ? $this->inputGet('type') : $type;
    
    
    Severity: Major
    Found in src/Controller/MainController.php - About 2 hrs to fix

      Function checkAllInput has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function checkAllInput($context)
          {
              $post = MainController::getData();
      
              if ($context == 'contact') {
      Severity: Minor
      Found in src/Controller/Functions/MainFunctions.php - About 2 hrs 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 updateAccount has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          public function updateAccount()
          {
              // session_start();
      
              $outputData = $this->data;
      Severity: Minor
      Found in src/Controller/AuthController.php - About 2 hrs 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 sendEmail has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function sendEmail()
          {
              require_once 'setup/configMail.php';
              $serveurName = $configMail['smtp'];
              $port = $configMail['port'];
      Severity: Major
      Found in src/Controller/MailController.php - About 2 hrs to fix

        Function defaultMethod has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            public function defaultMethod()
            {
                $action = $this->inputGet('action');
                $type = $this->inputGet('type');
        
        
        Severity: Minor
        Found in src/Controller/AdminController.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 addAccount has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function addAccount()
            {
                require_once 'setup/configMail.php';
                $serveurName = $configMail['smtp'];
                $port = $configMail['port'];
        Severity: Minor
        Found in src/Controller/AuthController.php - About 1 hr to fix

          Method sendForgotPassword has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function sendForgotPassword()
              {
                  require_once 'setup/configMail.php';
                  $serveurName = $configMail['smtp'];
                  $port = $configMail['port'];
          Severity: Minor
          Found in src/Controller/AuthController.php - About 1 hr to fix

            Method defaultMethod has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function defaultMethod()
                {
                    $action = $this->inputGet('action');
                    $type = $this->inputGet('type');
            
            
            Severity: Minor
            Found in src/Controller/AdminController.php - About 1 hr to fix

              Function inputPost has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function inputPost($key = false, $isArray = true)
                  {
                      if (!$isArray && $key) {
                          $post = filter_input(INPUT_POST, $key);
                          switch ($key) {
              Severity: Minor
              Found in src/Controller/Functions/MainFunctions.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 checkAllInput has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function checkAllInput($context)
                  {
                      $post = MainController::getData();
              
                      if ($context == 'contact') {
              Severity: Minor
              Found in src/Controller/Functions/MainFunctions.php - About 1 hr to fix

                Function getPost has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getPost(array $key = null)
                    {
                        if (isset($key) && !empty($key)) {
                            $posts = ModelFactory::getModel('Post')->listData($key[key($key)], key($key));
                
                
                Severity: Minor
                Found in src/Controller/AdminController.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 inputPost has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function inputPost($key = false, $isArray = true)
                    {
                        if (!$isArray && $key) {
                            $post = filter_input(INPUT_POST, $key);
                            switch ($key) {
                Severity: Minor
                Found in src/Controller/Functions/MainFunctions.php - About 1 hr to fix

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

                      public function updateAccount()
                      {
                          // session_start();
                  
                          $outputData = $this->data;
                  Severity: Minor
                  Found in src/Controller/AuthController.php - About 1 hr to fix

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

                        private static function getServerIP()
                        {
                            $adresse = '';
                            $server = filter_input_array(INPUT_SERVER);
                    
                    
                    Severity: Minor
                    Found in src/Controller/Functions/MainFunctions.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 exports has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    module.exports = (options) => {
                      const { dev } = options;
                      const hmr = HMR.getClient();
                    
                      return {
                    Severity: Minor
                    Found in public/_webpack/webpack.config.js - 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 listData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function listData(string $value = null, string $key = null, array $params = null)
                        {
                            if (isset($key)) {
                                $query = 'SELECT * FROM ' . $this->table . ' WHERE ' . $key . ' = ?';
                    
                    
                    Severity: Minor
                    Found in src/Model/MainModel.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

                    Avoid too many return statements within this method.
                    Open

                                        return $post;
                    Severity: Major
                    Found in src/Controller/Functions/MainFunctions.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return filter_input_array(INPUT_POST);
                      Severity: Major
                      Found in src/Controller/Functions/MainFunctions.php - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language