Showing 4,504 of 4,504 total issues
Function extend
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
Method buildSuperShares
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function buildSuperShares(array $allShares, \OCP\IUser $user) {
$result = [];
$groupedShares = $this->groupShares($allShares);
Method getShares
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getShares($includingPending = false) {
$shares = [];
$groupExternalManager = null;
foreach ($this->externalManager->getAcceptedShares() as $shareInfo) {
Method fopen
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function fopen($path, $mode) {
if ($source = $this->getSourcePath($path)) {
switch ($mode) {
case 'r+':
case 'rb+':
Method requestReShare
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function requestReShare($token, $id, $shareId, $remote, $shareWith, $permission) {
$data = [
'shareWith' => $shareWith,
'senderId' => $shareId
];
Method getChangesForCalendar
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null) {
// Current synctoken
$stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?');
$stmt->execute([ $calendarId ]);
$currentToken = $stmt->fetchColumn(0);
Method getChangesForAddressBook
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null) {
// Current synctoken
$stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*addressbooks` WHERE `id` = ?');
$stmt->execute([ $addressBookId ]);
$currentToken = $stmt->fetchColumn();
Method printUpgradePage
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function printUpgradePage() {
$systemConfig = \OC::$server->getSystemConfig();
$disableWebUpdater = $systemConfig->getValue('upgrade.disable-web', false);
$tooBig = false;
Method stream_open
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function stream_open($path, $mode, $options, &$opened_path) {
switch ($mode[0]) {
case 'r':
if (!isset(self::$data[$path])) {
return false;
Method rename
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function rename($path1, $path2) {
$renameOk = false;
$copyKeysOk = true; // assume keys are copied, in case we deal with versions
$isVersion = $this->isVersion($path2) || $this->isVersion($path1);
Method doUpgrade
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function doUpgrade($currentVersion, $installedVersion) {
// Stop update if the update is over several major versions
$allowedPreviousVersions = $this->getAllowedPreviousVersions();
if (!self::isUpgradePossible($installedVersion, $currentVersion, $allowedPreviousVersions)) {
throw new \Exception('Updates between multiple major versions and downgrades are unsupported.');
Method generateHashes
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function generateHashes(
\RecursiveIteratorIterator $iterator,
$path
) {
$hashes = [];
Method fixThisShare
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function fixThisShare($groupShares, $subShares) {
if (empty($subShares)) {
return false;
}
Method analyzeLibraries
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function analyzeLibraries(array $dependencies) {
$missing = [];
if (!isset($dependencies['lib'])) {
return $missing;
}
Method decryptUsersFiles
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function decryptUsersFiles($uid, ProgressBar $progress, $userCount) {
$this->setupUserFS($uid);
$directories = [];
$directories[] = '/' . $uid . '/files';
Method validateToken
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function validateToken($token, $user = null) {
try {
$dbToken = $this->tokenProvider->getToken($token);
} catch (InvalidTokenException $ex) {
$this->logger->debug(
Method execute
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output): int {
$outputType = $input->getOption('output');
if ($outputType === self::OUTPUT_FORMAT_JSON || $outputType === self::OUTPUT_FORMAT_JSON_PRETTY) {
$certificates = \array_map(function (ICertificate $certificate) {
return [
Similar blocks of code found in 2 locations. Consider refactoring. Open
OC.L10N.register(
"files_versions",
{
"Versions" : "Versões",
"File {file} has been reverted and marked as new current version" : "O arquivo {file} foi revertido e marcado como a nova versão atual",
- 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 67.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
OC.L10N.register(
"files_versions",
{
"Versions" : "Revisiones",
"File {file} has been reverted and marked as new current version" : "El archivo {file} se ha revertido y se ha marcado como nueva versión actual",
- 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 67.
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
Function _triggerGroupEdit
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
_triggerGroupEdit: function($td, isSubadminSelect) {
var $groupsListContainer = $td.find('.groupsListContainer');
var placeholder = $groupsListContainer.attr('data-placeholder') || t('settings', 'no group');
var user = UserList.getUID($td);
var checked = _.keys($td.data('groups')) || [];
- 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"