honeybee/trellis

View on GitHub
src/Runtime/Validator/Rule/Type/SpoofcheckerRule.php

Summary

Maintainability
C
1 day
Test Coverage

Method execute has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function execute($value, EntityInterface $entity = null)
    {
        if (!is_string($value)) {
            $this->throwError('non_string_value', [ 'value' => $value ], IncidentInterface::CRITICAL);
            return false;
Severity: Minor
Found in src/Runtime/Validator/Rule/Type/SpoofcheckerRule.php - About 1 hr to fix

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

        protected function execute($value, EntityInterface $entity = null)
        {
            if (!is_string($value)) {
                $this->throwError('non_string_value', [ 'value' => $value ], IncidentInterface::CRITICAL);
                return false;
    Severity: Minor
    Found in src/Runtime/Validator/Rule/Type/SpoofcheckerRule.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 getConfusableChecker has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function getConfusableChecker()
        {
            $spoofchecker = new Spoofchecker();
    
            // Allowing only certain locales enables rejection of e.g. korean script when a text should be en_US only
    Severity: Minor
    Found in src/Runtime/Validator/Rule/Type/SpoofcheckerRule.php - About 1 hr to fix

      Method getSuspiciousChecker has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function getSuspiciousChecker()
          {
              $spoofchecker = new Spoofchecker();
      
              // Allowing only certain locales enables rejection of e.g. korean script when a text should be en_US only
      Severity: Minor
      Found in src/Runtime/Validator/Rule/Type/SpoofcheckerRule.php - About 1 hr to fix

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

            protected function getSuspiciousChecker()
            {
                $spoofchecker = new Spoofchecker();
        
                // Allowing only certain locales enables rejection of e.g. korean script when a text should be en_US only
        Severity: Minor
        Found in src/Runtime/Validator/Rule/Type/SpoofcheckerRule.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 getConfusableChecker has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function getConfusableChecker()
            {
                $spoofchecker = new Spoofchecker();
        
                // Allowing only certain locales enables rejection of e.g. korean script when a text should be en_US only
        Severity: Minor
        Found in src/Runtime/Validator/Rule/Type/SpoofcheckerRule.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 true;
        Severity: Major
        Found in src/Runtime/Validator/Rule/Type/SpoofcheckerRule.php - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status