Showing 4,504 of 4,504 total issues
Method createCalendarsTable
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function createCalendarsTable(Schema $schema) {
if (!$schema->hasTable("{$this->prefix}calendars")) {
$table = $schema->createTable("{$this->prefix}calendars");
$table->addColumn('id', 'integer', [
'autoincrement' => true,
Method httpGet
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function httpGet(RequestInterface $request, ResponseInterface $response) {
$queryParams = $request->getQueryParameters();
if (!\array_key_exists('preview', $queryParams)) {
return true;
}
Method fopen
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function fopen($path, $mode) {
$pos = \strrpos($path, '.');
if ($pos !== false) {
$ext = \substr($path, $pos);
} else {
Method findInvalidShareOwner
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function findInvalidShareOwner(InputInterface $input, OutputInterface $output, $fix, $scopeUid) {
$output->writeln([
"<info>==========================</info>",
"<info>Searching for shares that have invalid uid_owner, meaning share uid_owner that does not match associated file storage id.</info>",
"<info>==========================</info>",
Method getFileInfo
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFileInfo($path, $includeMountPoints = true) {
$this->assertPathLength($path);
if (!Filesystem::isValidPath($path)) {
return false;
}
Method updateForRecipient
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateForRecipient(\OCP\Share\IShare $share, $recipient) {
if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
if ($share->getSharedWith() !== $recipient) {
throw new ProviderException('Recipient does not match');
}
Method getAllowedCorsHeaders
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function getAllowedCorsHeaders(\OCP\IConfig $config = null) {
if ($config === null) {
$config = \OC::$server->getConfig();
}
$allowedDefaultHeaders = [
Method loadRoutes
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function loadRoutes($app = null) {
if (\is_string($app)) {
$app = \OC_App::cleanAppId($app);
}
Method configure
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function configure() {
$this
->setName('db:convert-type')
->setDescription('Convert the ownCloud database to the newly configured one. This feature is currently experimental.')
->addArgument(
Similar blocks of code found in 2 locations. Consider refactoring. Open
$.get(OC.generateUrl(
'/avatar/{user}/{size}',
{user: OC.currentUser, size: 1}
), function (result) {
if (typeof(result) === 'string') {
- 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 79.
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
$.get(OC.generateUrl(
'/avatar/{user}/{size}',
{user: OC.currentUser, size: 1}
), function (result) {
if (typeof(result) === 'string') {
- 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 79.
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
File JobList.php
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @author Joas Schilling <coding@schilljs.com>
* @author Morris Jobke <hey@morrisjobke.de>
* @author Robin Appelman <icewind@owncloud.com>
Storage
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Storage extends DAV implements ISharedStorage {
/** @var string */
private $remoteUser;
/** @var string */
private $remote;
Share20OcsController
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Share20OcsController extends OCSController {
/** @var IManager */
private $shareManager;
/** @var IGroupManager */
private $groupManager;
Calendar
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
public function __construct(BackendInterface $caldavBackend, $calendarInfo, IL10N $l10n) {
parent::__construct($caldavBackend, $calendarInfo);
if ($this->getName() === BirthdayService::BIRTHDAY_CALENDAR_URI) {
Checker
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Checker {
public const CACHE_KEY = 'oc.integritycheck.checker';
/** @var EnvironmentHelper */
private $environmentHelper;
/** @var AppLocator */
Storage
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Storage implements IStorage {
// hidden file which indicate that the folder is a valid key storage
public const KEY_STORAGE_MARKER = '.oc_key_storage';
/** @var View */
OC_Defaults
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class OC_Defaults {
private $theme;
private $l;
private $defaultEntity;
Function move
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
move: function(fileNames, targetPath) {
var self = this;
var dir = this.getCurrentDirectory();
if (dir.charAt(dir.length - 1) !== '/') {
dir += '/';
Function _handleUpdateShareAttributes
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
_handleUpdateShareAttributes: function(shareId, properties, options) {
var shareAttributesV1 = [];
var filteredAttributes = [];
var filteredRegisteredAttributes = this._filterRegisteredAttributes(properties.permissions);
_.map(filteredRegisteredAttributes, function(filteredRegisteredAttribute) {