honeybee/trellis

View on GitHub

Showing 177 of 223 total issues

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

    protected function valueEquals($other_value)
    {
        if (!is_array($other_value)) {
            return false;
        }
Severity: Minor
Found in src/Runtime/Attribute/AssetList/AssetListValueHolder.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 parseEntityTypeDefinition has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function parseEntityTypeDefinition(DOMXPath $xpath, DOMElement $element)
    {
        $implementor = null;
        $implementor_list = $xpath->query('./implementor', $element);
        if ($implementor_list->length > 0) {
Severity: Minor
Found in src/CodeGen/Parser/Schema/EntityTypeDefinitionXpathParser.php - About 1 hr to fix

    Method buildPhoneMap has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected static function buildPhoneMap(Generator $generator)
        {
            return array_fill_keys(
                [
                    'phone',
    Severity: Minor
    Found in src/Sham/TextGuesser.php - About 1 hr to fix

      Method configure has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function configure()
          {
              $this->setName('generate_code')
                  ->setDescription('Generate and/or deploy code for a given type schema_path.')
                  ->addOption(
      Severity: Minor
      Found in src/CodeGen/Console/GenerateCodeCommand.php - About 1 hr to fix

        Function collateChildren has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function collateChildren(Closure $criteria, $recursive = true)
            {
                $entity_map = new EntityMap;
                $nested_attribute_types = [ EmbeddedEntityListAttribute::CLASS, EntityReferenceListAttribute::CLASS ];
                foreach ($this->getType()->getAttributes([], $nested_attribute_types) as $attribute) {
        Severity: Minor
        Found in src/Runtime/Entity/Entity.php - About 55 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 getReferenceAttributes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getReferenceAttributes($recursive = true)
            {
                $attribute_types = [ EmbeddedEntityListAttribute::CLASS, EntityReferenceListAttribute::CLASS ];
                $reference_attributes = new AttributeMap;
        
        
        Severity: Minor
        Found in src/Runtime/EntityType.php - About 55 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 collateAttributes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function collateAttributes(Closure $filter, $recursive = true)
            {
                $mirrored_attributes = new AttributeMap;
                foreach ($this->getAttributes() as $attribute_name => $attribute) {
                    if ($filter($attribute) === true) {
        Severity: Minor
        Found in src/Runtime/EntityType.php - About 55 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 validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function validate($value, EntityInterface $entity = null)
            {
                $result = new Result($this);
                $result->setInputValue($value);
        
        
        Severity: Minor
        Found in src/Runtime/Validator/Validator.php - About 55 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 createPluginData has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function createPluginData(array $settings, $config_dir)
            {
                $plugin_settings = [];
                foreach ($settings as $setting_label => $setting_data) {
                    if (!preg_match('/^plugin\:/', $setting_label)) {
        Severity: Minor
        Found in src/CodeGen/Parser/Config/ConfigIniParser.php - About 55 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 setSpecificationMap has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function setSpecificationMap($specification_map)
            {
                if ($specification_map instanceof SpecificationMap) {
                    $this->specification_map = $specification_map;
                } elseif (is_array($specification_map)) {
        Severity: Minor
        Found in src/Runtime/Entity/Transform/SpecificationContainer.php - About 55 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 execute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function execute($value, EntityInterface $entity = null)
            {
                if (!is_string($value)) {
                    $this->throwError('non_string_value', [], IncidentInterface::CRITICAL);
                    return false;
        Severity: Minor
        Found in src/Runtime/Validator/Rule/Type/ChoiceRule.php - About 55 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 preRenderOptions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function preRenderOptions(OptionDefinitionList $options, $initial_indent = 0, $indent_size = 4)
            {
                if ($options->getSize() === 0) {
                    return '[]';
                }
        Severity: Minor
        Found in src/CodeGen/ClassBuilder/Common/BaseEntityTypeClassBuilder.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 executePlugins has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function executePlugins(EntityTypeSchema $type_schema)
            {
                foreach ($this->config->getPluginSettings() as $plugin_class => $plugin_options) {
                    if (class_exists($plugin_class)) {
                        if (is_a($plugin_class, '\\Trellis\\CodeGen\\PluginInterface', true)) {
        Severity: Minor
        Found in src/CodeGen/Service.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 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 createValueHolder has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function createValueHolder($apply_default_values = false)
            {
                if (!$this->value_holder_implementor) {
                    $implementor = $this->hasOption(self::OPTION_VALUE_HOLDER)
                        ? $this->getOption(self::OPTION_VALUE_HOLDER)
        Severity: Minor
        Found in src/Runtime/Attribute/Attribute.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 execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function execute($value, EntityInterface $entity = null)
            {
                $null_value = $this->getOption(AttributeInterface::OPTION_NULL_VALUE, null);
                if ($value === $null_value || $value === '') {
                    // accept NULL or empty string as valid NULL value when NULL value is NULL :D
        Severity: Minor
        Found in src/Runtime/Attribute/GeoPoint/GeoPointRule.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 execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function execute($value, EntityInterface $entity = null)
            {
                if (is_null($value)) {
                    $value = '';
                }
        Severity: Minor
        Found in src/Runtime/Validator/Rule/Type/ScalarRule.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

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

            protected function execute($values, EntityInterface $entity = null)
            {
                if (!is_array($values)) {
                    $this->throwError('non_array_value', [], IncidentInterface::CRITICAL);
                    return false;
        Severity: Minor
        Found in src/Runtime/Attribute/UrlList/UrlListRule.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 parseOffsetExpression has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            protected static function parseOffsetExpression($offset_expression)
            {
                $compare_attribute = null;
                $compare_value = null;
        
        
        Severity: Minor
        Found in src/Runtime/Attribute/AttributeValuePath.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

        Severity
        Category
        Status
        Source
        Language