Function run
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function run(IOutput $output) {
if ($this->config->getSystemValue('has_internet_connection', true) !== true) {
$link = $this->defaults->buildDocLinkToKey('admin-marketplace-apps');
$output->info('No internet connection available - no app updates will be taken from the marketplace.');
$output->info("How to update apps in such situation please see $link");
- 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 Apps.php
has 283 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @author Viktar Dubiniuk <dubiniuk@owncloud.com>
*
* @copyright Copyright (c) 2018, ownCloud GmbH
Method run
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run(IOutput $output) {
if ($this->config->getSystemValue('has_internet_connection', true) !== true) {
$link = $this->defaults->buildDocLinkToKey('admin-marketplace-apps');
$output->info('No internet connection available - no app updates will be taken from the marketplace.');
$output->info("How to update apps in such situation please see $link");
Function getAppsFromMarket
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function getAppsFromMarket(IOutput $output, $appList, $event) {
$failedApps = [];
foreach ($appList as $app) {
$output->info("Fetching app from market: $app");
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 getAppsFromMarket
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getAppsFromMarket(IOutput $output, $appList, $event) {
$failedApps = [];
foreach ($appList as $app) {
$output->info("Fetching app from market: $app");
try {
Method changeSchema
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function changeSchema(Schema $schema, array $options) {
$prefix = $options['tablePrefix'];
if ($schema->hasTable("{$prefix}jobs")) {
$jobsTable = $schema->getTable("{$prefix}jobs");
Method fixMarketAppState
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function fixMarketAppState(IOutput $output) {
// no core update -> nothing to do
if (!$this->isCoreUpdate()) {
return false;
}
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct(IAppManager $appManager, EventDispatcherInterface $eventDispatcher, IConfig $config, \OC_Defaults $defaults, $forceMajorUpgrade = false) {
Function changeSchema
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function changeSchema(Schema $schema, array $options) {
$prefix = $options['tablePrefix'];
if ($schema->hasTable("{$prefix}jobs")) {
$jobsTable = $schema->getTable("{$prefix}jobs");
- 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 false;