HippoPHP/Hippo

View on GitHub

Showing 25 of 25 total issues

Function checkFileInternal has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    protected function checkFileInternal(CheckContext $checkContext, Config $config)
    {
        $file = $checkContext->getFile();

        $this->setIndentStyle($config->get('style', $this->indentStyle));
Severity: Minor
Found in src/Checks/Whitespace/IndentationCheck.php - About 2 hrs 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 checkFileInternal has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    protected function checkFileInternal(CheckContext $checkContext, Config $config)
    {
        $file = $checkContext->getFile();
        $lines = $file->getLines();

Severity: Minor
Found in src/Checks/File/MaxLineLengthCheck.php - About 2 hrs 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 navigateToKey has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    private function &navigateToKey($key, $createSections)
    {
        $current = &$this->array;
        foreach (explode('.', $key) as $key) {
            if (!is_array($current)) {
Severity: Minor
Found in src/Config/Config.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 checkFileInternal has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function checkFileInternal(CheckContext $checkContext, Config $config)
    {
        $file = $checkContext->getFile();

        $this->setIndentStyle($config->get('style', $this->indentStyle));
Severity: Minor
Found in src/Checks/Whitespace/IndentationCheck.php - About 1 hr to fix

Method checkFileInternal has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function checkFileInternal(CheckContext $checkContext, Config $config)
    {
        $file = $checkContext->getFile();

        if (!function_exists('mb_detect_encoding')) {
Severity: Minor
Found in src/Checks/File/EncodingCheck.php - About 1 hr to fix

Method checkFileInternal has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function checkFileInternal(CheckContext $checkContext, Config $config)
    {
        $file = $checkContext->getFile();
        $lines = $file->getLines();

Severity: Minor
Found in src/Checks/File/MaxLineLengthCheck.php - About 1 hr to fix

Function mergeRecursive has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    private function mergeRecursive($array1, $array2)
    {
        $result = [];
        foreach (array_merge(array_keys($array1), array_keys($array2)) as $key) {
            if (!isset($array1[$key])) {
Severity: Minor
Found in src/Config/YAMLConfigReader.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 processArgContainer has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    private function processArgContainer(ArgContainer $argContainer)
    {
        $mappings = $this->buildArgMappings();

        foreach ($argContainer->getAllOptions() as $argName => $argValue) {
Severity: Minor
Found in src/HippoTextUIContext.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 addCheckResults has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function addCheckResults(File $file, array $checkResults)
    {
        if (empty($this->loggedSeverities)) {
            return;
        }
Severity: Minor
Found in src/Reporters/CLIReporter.php - About 1 hr to fix

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

    public function addCheckResults(File $file, array $checkResults)
    {
        if (empty($this->loggedSeverities)) {
            return;
        }
Severity: Minor
Found in src/Reporters/CLIReporter.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 checkFileInternal has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function checkFileInternal(CheckContext $checkContext, Config $config)
    {
        $file = $checkContext->getFile();
        $tokens = $checkContext->getTokenList();

Severity: Minor
Found in src/Checks/Style/QuoteStyleCheck.php - About 1 hr to fix

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

    protected function checkFileInternal(CheckContext $checkContext, Config $config)
    {
        $file = $checkContext->getFile();
        $tokens = $checkContext->getTokenList();

Severity: Minor
Found in src/Checks/Style/VariableNamingCheck.php - About 1 hr to fix

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

    private function load($config, $filename = false)
    {
        if ($filename) {
            $included = [$this->normalizeConfigName($filename)];
        } else {
Severity: Minor
Found in src/Config/YAMLConfigReader.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

Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        Environment $environment,
        FileSystem $fileSystem,
        CheckRepository $checkRepository,
        ConfigReaderInterface $configReader,
        $pathToSelf,
Severity: Minor
Found in src/HippoTextUI.php - About 45 mins to fix

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

    private function extractNextLine($source, array $eols, &$eolUsed)
    {
        $minIndex = false;
        $eolUsed = null;
        foreach ($eols as $eol) {
Severity: Minor
Found in src/File.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

Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function __construct(File $file, $line, $column, $severity, $message)
Severity: Minor
Found in src/Violation.php - About 35 mins to fix

Method addViolation has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    protected function addViolation(File $file, $line, $column, $message, $severity = null)
Severity: Minor
Found in src/Checks/AbstractCheck.php - About 35 mins to fix

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

    protected function checkFileInternal(CheckContext $checkContext, Config $config)
    {
        $file = $checkContext->getFile();

        if (!function_exists('mb_detect_encoding')) {
Severity: Minor
Found in src/Checks/File/EncodingCheck.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 putContent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function putContent($path, $content)
    {
        $isStream = strpos($path, 'php://') !== false;

        if (!$isStream) {
Severity: Minor
Found in src/FileSystem.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 checkFileInternal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function checkFileInternal(CheckContext $checkContext, Config $config)
    {
        $file = $checkContext->getFile();
        $lines = $file->getLines();

Severity: Minor
Found in src/Checks/Whitespace/NoTrailingWhitespaceCheck.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