Showing 4,504 of 4,504 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
$notificationTargetGroups.change(function(ev) {
var groups = ev.val || [];
groups = JSON.stringify(groups);
OC.AppConfig.setValue('updatenotification', 'notify_groups', groups);
});
- 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 65.
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
function newFile() {
$("#new").addClass("active");
$(".popup.popupTop").toggle(true);
$('#new li[data-type="file"]').trigger('click');
removeA(keys, keyCodes.n);
- 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 65.
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
$publicShareSharersGroupsAllowlist.change(function(ev) {
var groups = ev.val || [];
groups = JSON.stringify(groups);
OC.AppConfig.setValue('files_sharing', 'public_share_sharers_groups_allowlist', groups);
- 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 65.
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 _showMountOptionsDropdown
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
_showMountOptionsDropdown: function($tr) {
if (this._preventNextDropdown) {
// prevented because the click was on the toggle
this._preventNextDropdown = false;
return;
Function _resize
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
_resize: function() {
var i, $crumb, $ellipsisCrumb;
if (!this.availableWidth) {
this.availableWidth = this.$el.width();
Function update
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
update: function (gid, limit) {
if (UserList.updating) {
return;
}
if(!limit) {
Function _setShareTreeUserGroupView
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
_setShareTreeUserGroupView: function() {
var self = this;
var $list = $('<ul>', { id : 'shareTreeUserGroupList' });
if (! _.keys(self._shareTreeCache).length > 0) {
Function render
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function() {
if (!this.model.hasReshare()
|| this.model.getReshareOwner() === OC.currentUser)
{
this.$el.empty();
Function _moveOrCopy
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
_moveOrCopy: function(operation, path, destinationPath, allowOverwrite, headers, options) {
if (!path) {
throw 'Missing argument "path"';
}
if (!destinationPath) {
Method translateLong
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function translateLong($text, IL10N $l, array $params) {
switch ($text) {
case self::CREATE_TAG:
$params[1] = $this->convertParameterToTag($params[1], $l);
if ($this->actorIsCurrentUser($params[0])) {
Method sendUpdateToRemote
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function sendUpdateToRemote($remote, $remoteId, $token, $action, $data = [], $try = 0) {
$ocmNotification = $this->notificationManager->convertToOcmFileNotification($remoteId, $token, $action, $data);
$ocmFields = $ocmNotification->toArray();
$url = \rtrim(
$this->addressHandler->removeProtocolFromUrl($remote),
Method getUsersOwnCalendars
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getUsersOwnCalendars($principalUri) {
$principalUri = $this->convertPrincipal($principalUri, true);
$fields = \array_values($this->propertyMap);
$fields[] = 'id';
$fields[] = 'uri';
Method removeFromGroup
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function removeFromGroup($parameters) {
// Check if user is logged in
$loggedInUser = $this->userSession->getUser();
if ($loggedInUser === null) {
return new Result(null, API::RESPOND_UNAUTHORISED);
Method emitPreHooks
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function emitPreHooks($exists, $path = null) {
if ($path === null) {
$path = $this->path;
}
$hookPath = Filesystem::getView()->getRelativePath($this->fileView->getAbsolutePath($path));
Method getACL
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getACL() {
$acl = [
[
'privilege' => '{DAV:}all',
'principal' => '{DAV:}owner',
Method run
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run(IOutput $out) {
if (!$this->config->getSystemValue('installed', false)) {
// Skip the migration for new installations -> nothing to migrate
return;
}
Method configure
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function configure() {
$this
->setName('files_external:create')
->setDescription('Create a new mount configuration')
->addOption(
Method update
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function update(
$id,
$mountPoint,
$backend,
$authMechanism,
Method expireOlderThanMaxForUser
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function expireOlderThanMaxForUser($uid) {
$expiration = self::getExpiration();
$threshold = $expiration->getMaxAgeAsTimestamp();
$versions = self::getFileHelper()->getAllVersions($uid);
if (!$threshold || !\array_key_exists('all', $versions)) {
Method getQueryForFilter
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getQueryForFilter($filter) {
$user = $this->activityManager->getCurrentUserId();
// Display actions from all files
if ($filter === self::FILTER_FILES) {
return ['`app` = ?', [self::APP_FILES]];