dallgoot/yaml

View on GitHub

Showing 22 of 721 total issues

Function omap has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function omap($node, &$parent = null)
    {
        if ($node instanceof NodeGeneric) {
            $key = $node->value;
            if ($node instanceof Nodes\Item && $key instanceof Nodes\Key) {
Severity: Minor
Found in src/Tag/CoreSchema.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 getTargetOnLessIndent has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function getTargetOnLessIndent(NodeGeneric &$node): ?NodeGeneric
    {
        $supposedParent = $this->getParent($node->indent);
        if ($node instanceof Item && $supposedParent instanceof Root) {
            if ($supposedParent->value->has('Key')) {
Severity: Minor
Found in src/Nodes/Generic/NodeGeneric.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 getParent has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function getParent(?int $indent = null): ?NodeGeneric
    {
        if (!is_int($indent)) {
            if ($this->_parent instanceof NodeGeneric) {
                return $this->_parent;
Severity: Minor
Found in src/Nodes/Generic/NodeGeneric.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 build has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function build(&$parent = null)
    {
        if (is_null($parent)) {
            throw new \Exception(__METHOD__ . " expects a YamlObject as parent", 1);
        }
Severity: Minor
Found in src/Nodes/DocStart.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 buildMultiline has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function buildMultiline(): string
    {
        $output = '';
        $list = clone $this;
        if ($list->count() > 0) {
Severity: Minor
Found in src/NodeList.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 getFinalString has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function getFinalString(NodeList $value, ?int $refIndent = null): string
    {
        $result = '';
        $list = $value->filterComment();
        if ($this->identifier !== '+') {
Severity: Minor
Found in src/Nodes/LiteralFolded.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 isAwaitingChild has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function isAwaitingChild(NodeGeneric $node): bool
    {
        if (is_null($this->value) || $node instanceof Comment) {
            return true;
        } elseif ($this->value instanceof NodeGeneric) {
Severity: Minor
Found in src/Nodes/Key.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 setIdentifier has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function setIdentifier(string $keyString): void
    {
        if ($keyString === '') {
            throw new \ParseError(sprintf(self::ERROR_NO_KEYNAME, $this->line));
        } else {
Severity: Minor
Found in src/Nodes/Key.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 getSourceGenerator has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private function getSourceGenerator(?string $strContent = null): \Generator
    {
        if (is_null($strContent)) {
            if(is_null($this->content)) {
                throw new \Exception(self::EXCEPTION_LINE_SPLIT);
Severity: Minor
Found in src/Loader.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 buildContent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function buildContent(Root $root)
    {
        switch ($this->_debug) {
            case 2 : print_r($root);// fall-through
            case 1 : return null;
Severity: Minor
Found in src/Builder.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 getChildValue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getChildValue(NodeGeneric $child, ?int $refIndent = 0): string
    {
        $value = $child->value;
        $start = '';
        if (is_null($value)) {
Severity: Minor
Found in src/Nodes/Generic/Literals.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 filterComment has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function filterComment(): NodeList
    {
        $this->rewind();
        $out = new NodeList;
        foreach ($this as $index => $child) {
Severity: Minor
Found in src/NodeList.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 str has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function str($node, &$parent = null): ?string
    {
        if ($node instanceof Literals) {
            $node = $node->value;
        }
Severity: Minor
Found in src/Tag/CoreSchema.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 build has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function build(&$parent = null)
    {
        if (is_null($this->value) && $this->getParent() instanceof Root) {
            if (!preg_match(Regex::TAG_PARTS, (string) $this->tag, $matches)) {
                throw new \UnexpectedValueException("Tag '$this->tag' is invalid", 1);
Severity: Minor
Found in src/Nodes/Tag.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 runHandler has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function runHandler($handle, $tagname, $value, &$parent = null)
    {
        if (array_key_exists($handle, self::$schemaHandles)) {
            $schemaName = self::$schemaHandles[$handle];
            if (array_key_exists($schemaName, self::$schemas)) {
Severity: Minor
Found in src/Tag/TagFactory.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 getTargetOnEqualIndent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getTargetOnEqualIndent(NodeGeneric &$node): NodeGeneric
    {
        if ($this->value instanceof NodeGeneric) {
            if ($this->value instanceof Tag) {
                if (!preg_match("/" . Regex::TAG_URI . "/", $this->value->raw)) {
Severity: Minor
Found in src/Nodes/DocStart.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 getFinalString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getFinalString(NodeList $list, ?int $refIndent = null): string
    {
        $result = '';
        $list = $list->filterComment();
        if ($this->identifier !== '+') {
Severity: Minor
Found in src/Nodes/Literal.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 add has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function add(NodeGeneric $child): NodeGeneric
    {
        $value = $this->value;
        if ($value instanceof Key && $child instanceof Key) {
            if ($value->indent === $child->indent) {
Severity: Minor
Found in src/Nodes/Item.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

Function set has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function set($node, &$parent = null)
    {
        if (!($node instanceof NodeList)) {
            throw new \LogicException(self::ERROR_SET);
        } else {
Severity: Minor
Found in src/Tag/CoreSchema.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

Function push has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function push($node): void
    {
        $type = null;
        if ($node instanceof Item) {
            $type = self::SEQUENCE;
Severity: Minor
Found in src/NodeList.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