Function getRemoteUrl
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
protected function getRemoteUrl() {
if ( !isset( $this->cache['remoteURL'] ) ) {
$config = "{$this->basedir}/config";
$url = false;
if ( is_readable( $config ) ) {
- Read upRead up
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
File GitInfo.php
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
Function __construct
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( $repoDir, $usePrecomputed = true ) {
$this->repoDir = $repoDir;
$services = MediaWikiServices::getInstance();
$this->options = new ServiceOptions(
self::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
- Read upRead up
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 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct( $repoDir, $usePrecomputed = true ) {
$this->repoDir = $repoDir;
$services = MediaWikiServices::getInstance();
$this->options = new ServiceOptions(
self::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
Method getHeadCommitDate
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getHeadCommitDate() {
$gitBin = $this->options->get( MainConfigNames::GitBin );
if ( !isset( $this->cache['headCommitDate'] ) ) {
$date = false;
Function getHeadSHA1
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getHeadSHA1() {
if ( !isset( $this->cache['headSHA1'] ) ) {
$head = $this->getHead();
$sha1 = false;
- Read upRead up
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 getCacheFilePath
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function getCacheFilePath( $repoDir ) {
$gitInfoCacheDirectory = $this->options->get( MainConfigNames::GitInfoCacheDirectory );
if ( $gitInfoCacheDirectory === false ) {
$gitInfoCacheDirectory = $this->options->get( MainConfigNames::CacheDirectory ) . '/gitinfo';
}
- Read upRead up
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 getHeadCommitDate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getHeadCommitDate() {
$gitBin = $this->options->get( MainConfigNames::GitBin );
if ( !isset( $this->cache['headCommitDate'] ) ) {
$date = false;
- Read upRead up
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 getHead
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getHead() {
if ( !isset( $this->cache['head'] ) ) {
$headFile = "{$this->basedir}/HEAD";
$head = false;
- Read upRead up
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 precomputeValues
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function precomputeValues() {
if ( $this->cacheFile !== null ) {
// Try to completely populate the cache
$this->getHead();
$this->getHeadSHA1();
- Read upRead up
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"