File kernel.php
has 698 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @author Adam Williamson <awilliam@redhat.com>
* @author Andreas Fischer <bantu@owncloud.com>
* @author Arthur Schiwon <blizzz@arthur-schiwon.de>
Method init
has 179 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function init() {
// calculate the root directories
OC::$SERVERROOT = \str_replace("\\", '/', \substr(__DIR__, 0, -4));
// register autoloader
Function init
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
public static function init() {
// calculate the root directories
OC::$SERVERROOT = \str_replace("\\", '/', \substr(__DIR__, 0, -4));
// register autoloader
- 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 initPaths
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
public static function initPaths() {
if (\defined('PHPUNIT_CONFIG_DIR')) {
self::$configDir = OC::$SERVERROOT . '/' . PHPUNIT_CONFIG_DIR . '/';
} elseif (\defined('PHPUNIT_RUN') and PHPUNIT_RUN and \is_dir(OC::$SERVERROOT . '/tests/config/')) {
self::$configDir = OC::$SERVERROOT . '/tests/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
Function handleRequest
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public static function handleRequest() {
\OC::$server->getEventLogger()->start('handle_request', 'Handle request');
$systemConfig = \OC::$server->getSystemConfig();
// load all the classpaths from the enabled apps so they are available
// in the routing files of each app
- 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 handleRequest
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function handleRequest() {
\OC::$server->getEventLogger()->start('handle_request', 'Handle request');
$systemConfig = \OC::$server->getSystemConfig();
// load all the classpaths from the enabled apps so they are available
// in the routing files of each app
Method initPaths
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function initPaths() {
if (\defined('PHPUNIT_CONFIG_DIR')) {
self::$configDir = OC::$SERVERROOT . '/' . PHPUNIT_CONFIG_DIR . '/';
} elseif (\defined('PHPUNIT_RUN') and PHPUNIT_RUN and \is_dir(OC::$SERVERROOT . '/tests/config/')) {
self::$configDir = OC::$SERVERROOT . '/tests/config/';
OC
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class OC {
/**
* Associative array for autoloading. classname => filename
*/
public static $CLASSPATH = [];
Method printUpgradePage
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function printUpgradePage() {
$systemConfig = \OC::$server->getSystemConfig();
$disableWebUpdater = $systemConfig->getValue('upgrade.disable-web', false);
$tooBig = false;
Method crashLog
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function crashLog(\Throwable $ex): void {
$crashDir = self::$SERVERROOT . '/data';
if (self::$config) {
$dataDir = self::$config->getValue('datadirectory', self::$SERVERROOT . '/data');
$crashDir = self::$config->getValue('crashdirectory', $dataDir);
Method initSession
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function initSession() {
// Let the session name be changed in the initSession Hook
$sessionName = OC_Util::getInstanceId();
try {
Function initSession
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function initSession() {
// Let the session name be changed in the initSession Hook
$sessionName = OC_Util::getInstanceId();
try {
- 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 checkConfig
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function checkConfig() {
$l = \OC::$server->getL10N('lib');
// Create config if it does not already exist
$configFilePath = self::$configDir .'/config.php';
Function checkConfig
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function checkConfig() {
$l = \OC::$server->getL10N('lib');
// Create config if it does not already exist
$configFilePath = self::$configDir .'/config.php';
- 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 checkSingleUserMode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function checkSingleUserMode($lockIfNoUserLoggedIn = false) {
if (!\OC::$server->getSystemConfig()->getValue('singleuser', false)) {
return;
}
$user = OC_User::getUserSession()->getUser();
- 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
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return false;
Function checkInstalled
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function checkInstalled() {
if (\defined('OC_CONSOLE')) {
return;
}
// Redirect to installer if not installed
- 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 handleAuthHeaders
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected static function handleAuthHeaders() {
//copy http auth headers for apache+php-fcgid work around
if (isset($_SERVER['HTTP_XAUTHORIZATION']) && !isset($_SERVER['HTTP_AUTHORIZATION'])) {
$_SERVER['HTTP_AUTHORIZATION'] = $_SERVER['HTTP_XAUTHORIZATION'];
}
- 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 loadAppClassPaths
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function loadAppClassPaths() {
foreach (OC_App::getEnabledApps() as $app) {
$appPath = OC_App::getAppPath($app);
if ($appPath === false) {
continue;
- 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"