skybluesofa/onthisday

View on GitHub

Showing 97 of 97 total issues

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

    public static $configurationEvents = [
        "first Sunday of August %Y" => ["American Family Day", "Friendship Day", "National Doll Day", "National Kids' Day", "Sister's Day"],
        "first Tuesday of August %Y" => ["National Night Out",],
        "first Thursday of August %Y" => ["India Pale Ale Beer Day",],
        "first Friday of August %Y" => ["Homemade Pie Day", "International Beer Day", "Tomboy Tools Day"],
Severity: Major
Found in src/Data/Region/En/Us/Month/September.php and 1 other location - About 5 hrs to fix
src/Data/Region/En/Us/Month/August.php on lines 48..64

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

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

    public static $configurationEvents = [
        "first Sunday of August %Y" => ["American Family Day", "Friendship Day", "National Doll Day", "National Kids' Day", "Sister's Day"],
        "first Tuesday of August %Y" => ["National Night Out",],
        "first Thursday of August %Y" => ["India Pale Ale Beer Day",],
        "first Friday of August %Y" => ["Homemade Pie Day", "International Beer Day", "Tomboy Tools Day"],
Severity: Major
Found in src/Data/Region/En/Us/Month/August.php and 1 other location - About 5 hrs to fix
src/Data/Region/En/Us/Month/September.php on lines 48..64

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

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

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

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

            if ($date->day == date("d", strtotime("first Friday of June ".$date->year)) || $date->day == date("d", strtotime("first Friday of June ".$date->year))+1  || $date->day == date("d", strtotime("first Friday of June ".$date->year))+2 ) {
                $events[] = "Horseradish Days";
            }
    Severity: Major
    Found in src/Data/Region/En/Us/Month/June.php and 2 other locations - About 1 hr to fix
    src/Data/Region/En/Us/Month/August.php on lines 81..83
    src/Data/Region/En/Us/Month/August.php on lines 86..88

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

    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 3 locations. Consider refactoring.
    Open

            if ($date->day == date("d", strtotime("second Friday of August ".$date->year)) || $date->day == date("d", strtotime("second Friday of August ".$date->year))+1  || $date->day == date("d", strtotime("second Friday of August ".$date->year))+2 ) {
                $events[] = "Kool-Aid Day";
            }
    Severity: Major
    Found in src/Data/Region/En/Us/Month/August.php and 2 other locations - About 1 hr to fix
    src/Data/Region/En/Us/Month/August.php on lines 81..83
    src/Data/Region/En/Us/Month/June.php on lines 110..112

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

    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 3 locations. Consider refactoring.
    Open

            if ($date->day == date("d", strtotime("first Friday of August ".$date->year)) || $date->day == date("d", strtotime("first Friday of August ".$date->year))+1  || $date->day == date("d", strtotime("first Friday of August ".$date->year))+2 ) {
                $events[] = "Twins Day";
            }
    Severity: Major
    Found in src/Data/Region/En/Us/Month/August.php and 2 other locations - About 1 hr to fix
    src/Data/Region/En/Us/Month/August.php on lines 86..88
    src/Data/Region/En/Us/Month/June.php on lines 110..112

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

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

    Avoid excessively long variable names like $recurringAdvancedConfigurationHolidays. Keep variable name length under 20.
    Open

        public static $recurringAdvancedConfigurationHolidays = [];
    Severity: Minor
    Found in src/Data/Contract/Month.php by phpmd

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#longvariable

    Avoid excessively long variable names like $configurationHolidays. Keep variable name length under 20.
    Open

        public static $configurationHolidays = [];
    Severity: Minor
    Found in src/Data/Region/En/Us/Month/April.php by phpmd

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#longvariable

    Avoid excessively long variable names like $configurationHolidays. Keep variable name length under 20.
    Open

        public static $configurationHolidays = [
            "third Sunday of June %Y" => ["Father's Day"],
        ];
    Severity: Minor
    Found in src/Data/Region/En/Us/Month/June.php by phpmd

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#longvariable

    Avoid excessively long variable names like $recurringAdvancedConfigurationEvents. Keep variable name length under 20.
    Open

        public static $recurringAdvancedConfigurationEvents = [];
    Severity: Minor
    Found in src/Data/Contract/Month.php by phpmd

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#longvariable

    Avoid excessively long variable names like $configurationHolidays. Keep variable name length under 20.
    Open

        public static $configurationHolidays = [];
    Severity: Minor
    Found in src/Data/Region/En/Us/Month/July.php by phpmd

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#longvariable

    Avoid excessively long variable names like $configurationHolidays. Keep variable name length under 20.
    Open

        public static $configurationHolidays = [
            "Fourth Thursday of November %y" => ["Thanksgiving"],
        ];

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#longvariable

    Avoid excessively long variable names like $configurationHolidays. Keep variable name length under 20.
    Open

        public static $configurationHolidays = [];

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#longvariable

    Avoid excessively long variable names like $configurationHolidays. Keep variable name length under 20.
    Open

        public static $configurationHolidays = [];

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#longvariable

    Avoid excessively long variable names like $configurationHolidays. Keep variable name length under 20.
    Open

        public static $configurationHolidays = [];

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#longvariable

    Avoid excessively long variable names like $configurationHolidays. Keep variable name length under 20.
    Open

        public static $configurationHolidays = [
            "second Sundays of May %y" => ["Mother's Day"],
        ];
    Severity: Minor
    Found in src/Data/Region/En/Us/Month/May.php by phpmd

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#longvariable

    Avoid excessively long variable names like $configurationHolidays. Keep variable name length under 20.
    Open

        public static $configurationHolidays = [
          "first Monday of September %Y" => ["Labor Day"]
        ];

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#longvariable

    Avoid excessively long variable names like $configurationHolidays. Keep variable name length under 20.
    Open

        public static $configurationHolidays = [];

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#longvariable

    Severity
    Category
    Status
    Source
    Language