Showing 3,235 of 4,504 total issues
Function execute
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output): int {
$confirmed = $input->getOption('continue');
if (($confirmed !== 'yes') && ($confirmed !== 'no')) {
$output->writeln('Continue can accept either yes or no');
return 2;
- 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 validateArray
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function validateArray($array) {
$arrayKeys = \array_keys($array);
$additionalKeys = \array_diff($arrayKeys, $this->validRootKeys);
$commonKeys = \array_intersect($arrayKeys, $this->validRootKeys);
if (!empty($additionalKeys)) {
- 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 execute
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output): int {
if ($input->getOption('list')) {
$backends = $this->userManager->getBackends();
foreach ($backends as $backend) {
$output->writeln(\get_class($backend));
- 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 sortGroups
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
sortGroups: function () {
var lis = this.$userGroupList.find('.isgroup').get();
lis.sort(function (a, b) {
// "Everyone" always at the top
Function createFile
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
createFile: function(name) {
var self = this;
var deferred = $.Deferred();
var promise = deferred.promise();
Function add
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
add: function(fileData, options) {
var index = -1;
var $tr;
var $rows;
var $insertionPoint;
Function bindKeyboardShortcuts
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Files.bindKeyboardShortcuts = function(document, $) {
$(document).keydown(function(event) { //check for modifier keys
if(!$(event.target).is('body')) {
return;
}
Function callMethod
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function callMethod(client, options, model, headers) {
var data = options.data;
if (_.isObject(data)) {
headers['Content-Type'] = 'application/json';
data = JSON.stringify(data);
Method testRemoteUrl
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testRemoteUrl(IClientService $clientService, string $remote) {
$parsed_host = parse_url($remote, PHP_URL_HOST);
$parsed_port = parse_url($remote, PHP_URL_PORT);
if (\is_string($parsed_host)) {
$remote = $parsed_host;
Method registerListeners
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function registerListeners() {
$container = $this->getContainer();
$server = $container->getServer();
$eventDispatcher = $server->getEventDispatcher();
Method handleGetProperties
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handleGetProperties(
PropFind $propFind,
\Sabre\DAV\INode $node
) {
if (!($node instanceof SystemTagNode) && !($node instanceof SystemTagMappingNode)) {
Method getACL
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getACL() {
$acl = [
[
'privilege' => '{DAV:}all',
'principal' => '{DAV:}owner',
Method searchEx
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function searchEx($addressBookId, $pattern, $searchProperties, $options, $limit = 100, $offset = 0) {
$query = $this->db->getQueryBuilder();
$cardIdSelect = $this->db->getQueryBuilder();
$cardIdSelect->selectDistinct('cp.cardid')->from($this->dbCardsPropertiesTable, 'cp');
Method configure
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function configure() {
$this
->setName('files_external:list')
->setDescription('List configured admin or personal mounts')
->addArgument(
Method updateCard
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateCard(VCard $vCard, IUser $user) {
$uid = $user->getUID();
$displayName = $user->getDisplayName();
$displayName = empty($displayName) ? $uid : $displayName;
$emailAddress = $user->getEMailAddress();
Method getAllVersions
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAllVersions($uid) {
$view = $this->getUserView($uid);
$dirs = [self::VERSIONS_RELATIVE_PATH];
$versions = [];
Method createSelectStatement
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function createSelectStatement($format, $fileDependent, $uidOwner = null) {
$select = '*';
if ($format == self::FORMAT_STATUSES) {
if ($fileDependent) {
$select = '`*PREFIX*share`.`id`, `*PREFIX*share`.`parent`, `share_type`, `path`, `storage`, '
Method downloadApp
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function downloadApp($data = []) {
$l = \OC::$server->getL10N('lib');
if (!isset($data['source'])) {
throw new \Exception($l->t("No source specified when installing app"));
Method getUsersForUserValue
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getUsersForUserValue($appName, $key, $value) {
// TODO - FIXME
$this->fixDIInit();
$queryBuilder = $this->connection->getQueryBuilder();
Function displayStorageWarnings
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
displayStorageWarnings: function() {
if (!OC.Notification.isHidden()) {
return;
}