skybluesofa/onthisday

View on GitHub

Showing 12 of 97 total issues

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

class Parser {

  protected $locale = 'en_US';

  private $carbonDate = null;
Severity: Minor
Found in src/Data/Parser.php - About 2 hrs to fix

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

        public static function getRecurringAdvancedConfigurationBasedEvents(\Carbon\Carbon $date) {
            $events = [];
    
            if ($date->day == 13 && $date->isFriday()) {
                $events[] = "Friday the 13th";
    Severity: Minor
    Found in src/Data/Region/En/Us/Month/September.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 getRecurringAdvancedConfigurationBasedEvents has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getRecurringAdvancedConfigurationBasedEvents(\Carbon\Carbon $date) {
            $events = [];
    
            if ($date->day == 13 && $date->isFriday()) {
                $events[] = "Friday the 13th";
    Severity: Minor
    Found in src/Data/Region/En/Us/Month/June.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 getRecurringAdvancedConfigurationBasedEvents has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getRecurringAdvancedConfigurationBasedEvents(\Carbon\Carbon $date) {
            $events = [];
    
            if ($date->day == 13 && $date->isFriday()) {
                $events[] = "Friday the 13th";
    Severity: Minor
    Found in src/Data/Region/En/Us/Month/August.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 getRecurringAdvancedConfigurationBasedEvents has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function getRecurringAdvancedConfigurationBasedEvents(\Carbon\Carbon $date) {
            $events = [];
    
            if ($date->day == 13 && $date->isFriday()) {
                $events[] = "Friday the 13th";
    Severity: Minor
    Found in src/Data/Region/En/Us/Month/August.php - About 1 hr to fix

      Method getRecurringAdvancedConfigurationBasedEvents has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function getRecurringAdvancedConfigurationBasedEvents(\Carbon\Carbon $date) {
              $events = [];
      
              if ($date->day == 13 && $date->isFriday()) {
                  $events[] = "Friday the 13th";
      Severity: Minor
      Found in src/Data/Region/En/Us/Month/September.php - About 1 hr to fix

        Function getRecurringConfigurationBasedItems has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          private function getRecurringConfigurationBasedItems($type=null) {
            $propertyName = 'configuration'.ucfirst(strtolower($type));
            $items = [];
            foreach ($this->getMonthClasses() as $monthClass) {
              if (property_exists($monthClass, $propertyName)) {
        Severity: Minor
        Found in src/Data/Parser.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 getRecurringAdvancedConfigurationBasedEvents has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function getRecurringAdvancedConfigurationBasedEvents(\Carbon\Carbon $date) {
                $events = [];
        
                if ($date->day == 13 && $date->isFriday()) {
                    $events[] = "Friday the 13th";
        Severity: Minor
        Found in src/Data/Region/En/Us/Month/June.php - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                  if (($date->day==1 && $date->isFriday())
                      || $date->day==2 && in_array($date->englishDayOfWeek, ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"])
                      || ($date->day==3 && $date->isMonday())
                      ) {
                      $events[] = "National Leave the Office Early Day";
          Severity: Major
          Found in src/Data/Region/En/Us/Month/June.php - About 40 mins to fix

            Consider simplifying this complex logical expression.
            Open

                    if (($date->day==28 && $date->isFriday()) || ($date->day==29 && $date->isFriday()) || ($date->day==30 && $date->isMonday())) {
                        $events[] = "Ask A Stupid Question Day";
                    }
            Severity: Major
            Found in src/Data/Region/En/Us/Month/September.php - About 40 mins to fix

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

                  public static function getRecurringAdvancedConfigurationBasedEvents(\Carbon\Carbon $date) {
                      $events = [];
              
                      if ($date->day == 13 && $date->isFriday()) {
                          $events[] = "Friday the 13th";
              Severity: Minor
              Found in src/Data/Region/En/Us/Month/July.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 getRecurringAdvancedConfigurationBasedEvents has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function getRecurringAdvancedConfigurationBasedEvents(\Carbon\Carbon $date) {
                      $events = [];
                      if ($date->day == 13 && $date->englishDayOfWeek=='Friday') {
                          $events[] = "Friday the 13th";
                      }
              Severity: Minor
              Found in src/Data/Region/En/Us/Month/February.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