alfs18/ramverk1-module

View on GitHub

Showing 8 of 8 total issues

Function getResultPast has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function getResultPast($info, $result, $dates)
    {
        if ($info == "all") {
            $sum = [];
            $count = 0;
Severity: Minor
Found in src/WeatherController/CheckWeather.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 indexActionPost has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function indexActionPost(): object
    {
        $title = "Kolla ip";

        $request = $this->di->request;
Severity: Minor
Found in src/WeatherController/WeatherController.php - About 1 hr to fix

    Method indexActionPost has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function indexActionPost(): object
        {
            $title = "Kolla ip";
    
            $request = $this->di->request;
    Severity: Minor
    Found in src/WeatherController/RestWeatherController.php - About 1 hr to fix

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

          public function getWeather($latitude, $longitude, $period)
          {
              // Set API access key
              $accessKey = require(ANAX_INSTALL_PATH . "/config/api_key.php");
      
      
      Severity: Minor
      Found in src/WeatherController/CheckWeather.php - About 1 hr to fix

        Method getResultPast has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getResultPast($info, $result, $dates)
            {
                if ($info == "all") {
                    $sum = [];
                    $count = 0;
        Severity: Minor
        Found in src/WeatherController/CheckWeather.php - About 1 hr to fix

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

              public function getResultToCome($info, $result)
              {
                  if ($info == "all") {
                      $sum = $result;
                  } elseif ($info == "currently") {
          Severity: Minor
          Found in src/WeatherController/CheckWeather.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 indexActionPost has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function indexActionPost(): object
              {
                  $title = "Kolla ip";
          
                  $request = $this->di->request;
          Severity: Minor
          Found in src/WeatherController/WeatherController.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 indexActionPost has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function indexActionPost(): object
              {
                  $title = "Kolla ip";
          
                  $request = $this->di->request;
          Severity: Minor
          Found in src/WeatherController/RestWeatherController.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