Showing 4,504 of 4,504 total issues
Function moveInto
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
public function moveInto($targetName, $fullSourcePath, INode $sourceNode) {
if (!$sourceNode instanceof Node) {
if ($sourceNode instanceof ITrashBinNode) {
if (!$this->fileView->isCreatable($this->getPath())) {
throw new SabreForbidden('Destination directory is not writable');
- 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 setupFS
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
public static function setupFS($user = '', $fullInit = true) {
//setting up the filesystem twice can only lead to trouble
if (self::$fsSetup) {
return 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 showLoginForm
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
public function showLoginForm($user, $redirect_url, $remember_login) {
// check if there is apache auth backend available and try to obtain session,
// if apache backend not registered or failed to login, proceed with show login form
if ($this->handleApacheAuth()) {
// apache auth was completed server-side and there is active session,
- 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 newStorage
has 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
newStorage: function(storageConfig, onCompletion) {
var mountPoint = storageConfig.mountPoint;
var backend = this._allBackends[storageConfig.backend];
var isInvalidAuth = false;
File ja.js
has 356 lines of code (exceeds 250 allowed). Consider refactoring. Open
OC.L10N.register(
"settings",
{
"Wrong current password" : "現在のパスワードが間違っています",
"The new password cannot be the same as the previous one" : "新しいパスワードは前のパスワードと同じにできません",
File cs_CZ.js
has 356 lines of code (exceeds 250 allowed). Consider refactoring. Open
OC.L10N.register(
"core",
{
"Please select a file." : "Prosím vyberte soubor.",
"File is too big" : "Soubor je příliš velký",
File is.js
has 355 lines of code (exceeds 250 allowed). Consider refactoring. Open
OC.L10N.register(
"settings",
{
"Wrong current password" : "Rangt núverandi lykilorð",
"The new password cannot be the same as the previous one" : "Nýja lykilorðið má ekki vera eins og það fyrra",
File SystemTagManager.php
has 355 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @author Joas Schilling <coding@schilljs.com>
* @author Vincent Petry <pvince81@owncloud.com>
*
Trashbin
has 35 functions (exceeds 20 allowed). Consider refactoring. Open
class Trashbin {
/**
* @var IURLGenerator
*/
private $urlGenerator;
AppManager
has 35 functions (exceeds 20 allowed). Consider refactoring. Open
class AppManager implements IAppManager {
/**
* Apps with these types can not be enabled for certain groups only
* @var string[]
*/
Function setupUploadEvents
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
setupUploadEvents: function(uploader) {
var self = this;
self._uploads = {};
Method expire
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function expire($filename, $uid) {
$config = \OC::$server->getConfig();
$expiration = self::getExpiration();
if ($config->getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true' && $expiration->isEnabled()) {
Method getDirectoryContent
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getDirectoryContent($directory, $mimetype_filter = '') {
$this->assertPathLength($directory);
if (!Filesystem::isValidPath($directory)) {
return [];
}
File commentstabview.js
has 352 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Copyright (c) 2016
*
* This file is licensed under the Affero General Public License version 3
* or later.
File Availability.php
has 352 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @author Robin Appelman <icewind@owncloud.com>
* @author Robin McCorkell <robin@mccorkell.me.uk>
*
File ConvertType.php
has 352 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @author Andreas Fischer <bantu@owncloud.com>
* @author Bart Visscher <bartv@thisnet.nl>
* @author Joas Schilling <coding@schilljs.com>
Method updateShare
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateShare($id) {
if (!$this->shareManager->shareApiEnabled()) {
return new Result(null, 404, $this->l->t('Share API is disabled'));
}
Function init
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
private function init() {
if ($this->init) {
return;
}
$this->init = 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 match
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
public function match($url) {
if (\substr($url, 0, 6) === '/apps/') {
// empty string / 'apps' / $app / rest of the route
list(, , $app, ) = \explode('/', $url, 4);
- 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
Similar blocks of code found in 60 locations. Consider refactoring. Open
OC.L10N.register(
"comments",
{
"Type in a new comment..." : "新しいコメントを入力...",
"Delete comment" : "コメントを削除",
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 123.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76