Showing 4,504 of 4,504 total issues
Function renderApp
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderApp: function(app, template, selector, firstExperimental) {
if (!template) {
var source = $("#app-template").html();
template = Handlebars.compile(source);
}
Function lazyLoadPreview
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
lazyLoadPreview : function(options) {
var self = this;
var path = options.path;
var mime = options.mime;
var ready = options.callback;
Function initMouseTrack
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initMouseTrack() {
var interval = 120; // 2 minutes
if (oc_config.session_lifetime) {
interval = Math.floor(oc_config.session_lifetime / 2);
}
Method translateShort
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function translateShort($text, IL10N $l, array $params) {
switch ($text) {
case self::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED:
case self::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED:
return (string) $l->t('Downloaded via public link');
Method prepare
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function prepare(INotification $notification, $languageCode) {
if ($notification->getApp() !== 'files_sharing') {
// Not my app => throw
throw new \InvalidArgumentException();
}
Method commentEvent
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function commentEvent(CommentsEvent $event) {
if ($event->getComment()->getObjectType() !== 'files'
|| !\in_array($event->getEvent(), [CommentsEvent::EVENT_ADD])
|| !$this->appManager->isInstalled('activity')) {
// Comment not for file, not adding a comment or no activity-app enabled (save the energy)
Method restoreVersion
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function restoreVersion($uid, $filename, $fileToRestore, $revision) {
if (\OC::$server->getConfig()->getSystemValue('files_versions', Storage::DEFAULTENABLED) !== true) {
return false;
}
$users_view = new View('/'.$uid);
Method get
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get($file) {
if (\is_string($file) or $file == '') {
// normalize file
$file = $this->normalize($file);
Method __construct
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($data = []) {
$factory = new InputFilterFactory();
$this->inputFilter = $factory->createInputFilter([
'file' => [
'required' => true,
Method generalChecks
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function generalChecks(\OCP\Share\IShare $share) {
if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
// We expect a valid user as sharedWith for user shares
if (!$this->userManager->userExists($share->getSharedWith())) {
throw new \InvalidArgumentException('SharedWith is not a valid user');
Method loginWithApache
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function loginWithApache(IApacheBackend $apacheBackend) {
$uidAndBackend = $apacheBackend->getCurrentUserId();
if (\is_array($uidAndBackend)
&& \count($uidAndBackend) === 2
&& $uidAndBackend[0] !== ''
Method new
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function new(?string $parent_container_id, ?string $filename): DataResponse {
$userAgent = $this->request->getHeader('User-Agent') ?? '-';
$this->logger->info("new($parent_container_id, $filename) - $userAgent");
if ($parent_container_id === null) {
Similar blocks of code found in 3 locations. Consider refactoring. Open
private function checkBlackListMethod($class, $functionName, Node $node) {
$name = $class . '::' . $functionName;
$lowerName = \strtolower($name);
if (isset($this->blackListedMethods[$lowerName])) {
- 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 117.
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 3 locations. Consider refactoring. Open
private function checkBlackListConstant($class, $constantName, Node $node) {
$name = $class . '::' . $constantName;
$lowerName = \strtolower($name);
if (isset($this->blackListedConstants[$lowerName])) {
- 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 117.
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 3 locations. Consider refactoring. Open
private function checkBlackListFunction($class, $functionName, Node $node) {
$name = $class . '::' . $functionName;
$lowerName = \strtolower($name);
if (isset($this->blackListedFunctions[$lowerName])) {
- 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 117.
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 ocFederationAddServer
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.ocFederationAddServer = function() {
/* Go easy on jquery and define some vars
========================================================================== */
Function render
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function() {
var self = this;
var fileActions = this._context.fileActions;
var actions = fileActions.getActions(
fileActions.getCurrentMimeType(),
Function done
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
done: function() {
if (!this.data.isChunked) {
return $.Deferred().resolve().promise();
}
Method addShare
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addShare($remote, $token, $password, $name, $owner, $accepted = false, $user = null, $remoteId = -1) {
$user = $user ? $user : $this->uid;
$accepted = $accepted ? 1 : 0;
$name = Filesystem::normalizePath('/' . $name);
Method addUser
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addUser() {
$userId = isset($_POST['userid']) ? $_POST['userid'] : null;
$password = isset($_POST['password']) ? $_POST['password'] : null;
$groups = isset($_POST['groups']) ? $_POST['groups'] : null;
$user = $this->userSession->getUser();