Showing 4,504 of 4,504 total issues
Function unscalable
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function unscalable($x, $y) {
$maxX = $this->getMaxX();
$maxY = $this->getMaxY();
$scalingUp = $this->getScalingUp();
$maxScaleFactor = $this->getMaxScaleFactor();
- 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 getDescription
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getDescription($errorCode, $errorObject) {
switch ($errorCode) {
case CodeChecker::STATIC_CALL_NOT_ALLOWED:
$functions = $this->getLocalFunctions();
$functions = \array_change_key_case($functions, CASE_LOWER);
- 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 scale
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function scale($image, $askedWidth, $askedHeight, $previewWidth, $previewHeight) {
$scalingUp = $this->getScalingUp();
$maxScaleFactor = $this->getMaxScaleFactor();
$factorX = $askedWidth / $previewWidth;
- 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 listNotifiers
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function listNotifiers() {
if (!empty($this->notifiersInfo)) {
return $this->notifiersInfo;
}
- 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 prepare
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function prepare(INotification $notification, $languageCode) {
$notifiers = $this->getNotifiers();
foreach ($notifiers as $notifier) {
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
Avoid deeply nested control flow statements. Open
if (!$officeFound) {
$whichOpenOffice = \shell_exec('command -v openoffice');
$officeFound = !empty($whichOpenOffice);
}
Function getInsecureServerHost
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getInsecureServerHost() {
$host = 'localhost';
if (isset($this->server['HTTP_X_FORWARDED_HOST'])) {
if (\strpos($this->server['HTTP_X_FORWARDED_HOST'], ',') !== false) {
$parts = \explode(',', $this->server['HTTP_X_FORWARDED_HOST']);
- 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 deeply nested control flow statements. Open
if ($sameNum != 0) {
$bmpData .= \chr($sameNum) . \chr($lastIndex);
}
Function getDisplayName
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function getDisplayName($uid = null) {
if ($uid) {
$user = \OC::$server->getUserManager()->get($uid);
if ($user) {
return $user->getDisplayName();
- 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 getAppInfo
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getAppInfo($appId) {
if (!\is_string($appId) || $appId === '') {
return null; // TODO explode?
}
- 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 deeply nested control flow statements. Open
if (($enabled || \in_array($filename, \OC::$server->getAppManager()->getAlwaysEnabledApps()))
&& \OC::$server->getConfig()->getAppValue($filename, 'enabled') !== 'no') {
$shippedApps[] = $filename;
}
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
View $view,
Util $util,
Mount\Manager $mountManager,
Manager $encryptionManager,
File $file,
Avoid deeply nested control flow statements. Open
if (\is_file($extractDir.'/'.$folder.'/appinfo/info.xml')) {
$extractDir.='/'.$folder;
}
Function sendHeaders
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function sendHeaders($filename, $name, array $rangeArray) {
OC_Response::setContentDispositionHeader($name, 'attachment');
\header('Content-Transfer-Encoding: binary', true);
OC_Response::disableCaching();
$fileSize = \OC\Files\Filesystem::filesize($filename);
- 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 enable
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function enable($app, $groups = null) {
self::$enabledAppsCache = []; // flush
// check for required dependencies
$config = \OC::$server->getConfig();
- 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 getAppInfoByPath
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getAppInfoByPath($path, $etag = null) {
$file = \realpath($path);
// check the cache
$data = $this->appInfo->get($file);
- 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 getStorage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function getStorage($appId) {
if (OC_App::isEnabled($appId)) { //sanity check
if (OC_User::isLoggedIn()) {
$view = new \OC\Files\View('/' . OC_User::getUser());
if (!$view->file_exists($appId)) {
- 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 installShippedApp
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function installShippedApp($app) {
\OC::$server->getLogger()->info('Attempting to install shipped app: '.$app);
$info = OC_App::getAppInfo($app);
if ($info === null) {
- 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 useBackend
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function useBackend($backend = 'database') {
if ($backend instanceof \OCP\UserInterface) {
self::$_usedBackends[\get_class($backend)] = $backend;
\OC::$server->getUserManager()->registerBackend($backend);
} else {
- 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 isExcluded
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function isExcluded($path) {
$normalizedPath = Filesystem::normalizePath($path);
$root = \explode('/', $normalizedPath, 4);
if (\count($root) > 1) {
// detect alternative key storage root
- 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"