Showing 4,504 of 4,504 total issues
Method formatItems
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function formatItems($items, $format, $parameters = null) {
if ($format == self::FORMAT_SHARED_STORAGE) {
// Only 1 item should come through for this format call
$item = \array_shift($items);
return [
Method restoreVersionsFromTrashbin
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function restoreVersionsFromTrashbin(View $view, $filename, $targetLocation) {
if (\OCP\App::isEnabled('files_versions')) {
$user = User::getUser();
$rootView = new View('/');
Method createCalendarSubscriptionsTable
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function createCalendarSubscriptionsTable(Schema $schema) {
if (!$schema->hasTable("{$this->prefix}calendarsubscriptions")) {
$table = $schema->createTable("{$this->prefix}calendarsubscriptions");
$table->addColumn('id', 'integer', [
'autoincrement' => true,
Method updateTag
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateTag($tagId, $tagName, $userVisible, $userAssignable, $userEditable = null) {
$userVisible = (int)$userVisible;
$userAssignable = (int)$userAssignable;
/**
Method transferShare
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function transferShare(IShare $share, $oldOwner, $newOwner, $finalTarget, $isChild = null) {
if ($this->userManager->get($oldOwner) === null) {
throw new TransferSharesException("The current owner of the share $oldOwner doesn't exist");
}
if ($this->userManager->get($newOwner) === null) {
Method afterException
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function afterException($controller, $methodName, \Exception $exception) {
$headers = [];
if ($controller instanceof OCSController) {
if ($this->request->getHeader('OC-RequestAppPassword') === 'true'
&& ($exception instanceof NotLoggedInException || $exception instanceof LoginException)) {
Method copyTable
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function copyTable(Connection $fromDB, Connection $toDB, Table $table, InputInterface $input, OutputInterface $output) {
$tableName = $table->getName();
$chunkSize = $input->getOption('chunk-size');
$progress = new ProgressBar($output);
Function renderApp
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
renderApp: function(app, template, selector, firstExperimental) {
if (!template) {
var source = $("#app-template").html();
template = Handlebars.compile(source);
}
- 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 markFileAsShared
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
markFileAsShared: function($tr, hasShares, hasLink) {
var action = $tr.find('.fileactions .action[data-action="Share"]');
var type = $tr.data('type');
var icon = action.find('.icon');
var message;
- 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 18 arguments (exceeds 4 allowed). Consider refactoring. Open
$appName,
IRequest $request,
IUserManager $userManager,
IGroupManager $groupManager,
Session $userSession,
Function isUsedTlsLibOutdated
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private function isUsedTlsLibOutdated(): string {
// Don't run check when:
// 1. Server has `has_internet_connection` set to false
// 2. App Store AND S2S is disabled
if (!$this->config->getSystemValue('has_internet_connection', true)) {
- 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 eatOldLicense
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private function eatOldLicense($source) {
$lines = \explode(PHP_EOL, $source);
while (!empty($lines)) {
$line = $lines[0];
if (\strpos($line, '<?php') !== 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 getShareFolder
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function getShareFolder($view = null) {
if ($view === null) {
$view = Filesystem::getView();
}
// for guests we default to root as their home storage is read-only
- 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 deleteVersions
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private static function deleteVersions(View $view, $file, $user) {
$size = 0;
if (\OCP\App::isEnabled('files_versions')) {
if ($view->is_dir('files_trashbin/versions/' . $file)) {
$size += self::calculateSize(new View('/' . $user . '/files_trashbin/versions/' . $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 tryHttpPostToShareEndpoint
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function tryHttpPostToShareEndpoint($remoteDomain, $urlSuffix, array $fields, $useOcm = false) {
$client = $this->httpClientService->newClient();
$protocol = 'https://';
$result = [
'success' => 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 httpGet
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function httpGet(RequestInterface $request, ResponseInterface $response) {
$queryParams = $request->getQueryParameters();
if (!\array_key_exists('preview', $queryParams)) {
return true;
}
- 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 validateUserPass
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function validateUserPass($username, $password) {
try {
$share = $this->shareManager->getShareByToken($username);
} catch (ShareNotFound $e) {
\OC::$server->getLogger()->error("PublicAuth: share for found $username");
- 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 xmlSerialize
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function xmlSerialize(Writer $writer) {
$cs = '{' . Plugin::NS_OWNCLOUD . '}';
if ($this->organizer !== null) {
$writer->startElement($cs . 'organizer');
- 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 17 (exceeds 5 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output): int {
$mountId = $input->getArgument('mount_id');
try {
$mount = $this->globalService->getStorage($mountId);
} catch (NotFoundException $e) {
- 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 17 (exceeds 5 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output): int {
$user = $input->getOption('user');
$mountPoint = $input->getArgument('mount_point');
$storageIdentifier = $input->getArgument('storage_backend');
$authIdentifier = $input->getArgument('authentication_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"