Showing 4,504 of 4,504 total issues
Method getACL
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getACL() {
$acl = [
[
'privilege' => '{DAV:}read',
'principal' => $this->getOwner(),
Method handleGetProperties
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handleGetProperties(
PropFind $propFind,
\Sabre\DAV\INode $sabreNode
) {
if (!($sabreNode instanceof \OCA\DAV\Connector\Sabre\Node)) {
Method formatFileInfo
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function formatFileInfo(FileInfo $i) {
$entry = [];
$entry['id'] = $i['fileid'];
$entry['parentId'] = $i['parent'];
Method check
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function check() {
// Look up the cache - it is invalidated all 30 minutes
if (((int)$this->config->getAppValue('core', 'lastupdatedat') + 1800) > \time()) {
return \json_decode($this->config->getAppValue('core', 'lastupdateResult'), true);
}
Method __construct
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($prefix = '') {
parent::__construct($prefix);
if (self::$cache === null) {
self::$cache = new \Memcached();
Method __construct
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($params) {
$this->statCache = new ArrayCache();
$this->httpClientService = \OC::$server->getHTTPClientService();
$this->webDavClientService = \OC::$server->getWebDavClientService();
if (isset($params['host'], $params['user'], $params['password'])) {
Method renameFromStorage
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function renameFromStorage(IStorage $sourceStorage, $source, $target) {
if (!$this->enabled or Scanner::isPartialFile($source) or Scanner::isPartialFile($target)) {
return;
}
Method calculateFolderSize
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function calculateFolderSize($path, $entry = null) {
$totalSize = 0;
if ($entry === null or !isset($entry['fileid'])) {
$entry = $this->get($path);
}
Method touch
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function touch($path, $mtime = null) {
if ($mtime === null) {
$mtime = \time();
}
Method createSpecificUser
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function createSpecificUser($username, $connection) {
try {
//user already specified in config
$oldUser = $this->config->getSystemValue('dbuser', false);
Method getFontFile
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getFontFile(array $info): string {
$fontFileDir = __DIR__;
$fontFileDir .= '/../../../core/fonts/';
$fontSet = [
Method userCreateChecks
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function userCreateChecks(\OCP\Share\IShare $share) {
$userTypeHelper = new UserTypeHelper();
$isGuestUser = $userTypeHelper->isGuestUser($share->getSharedWith());
// Check if we can share with group members only
// We still should be able to share with guest user even when it's not a group member
Method getAllSharesBy
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAllSharesBy($userId, $shareTypes, $nodeIDs, $reshares) {
$shares = [];
$qb = $this->dbConn->getQueryBuilder();
$qb->select('*')
Method getPreview
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getPreview() {
if ($this->preview !== null && $this->preview->valid()) {
return $this->preview;
}
Method loginInOwnCloud
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function loginInOwnCloud($loginType, $user, $password, $options = []) {
$login = $user->getUID();
// check the login policies first. It will throw a LoginException if needed
// The LoginPolicyManager can't be injected due to cyclic dependency
Method execute
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output): int {
$output->writeln('<info>This feature is currently experimental.</info>');
$this->targetType = $this->connectionFactory->normalizeType($input->getArgument('type'));
$this->targetHostname = $input->getArgument('hostname');
$this->targetPort = $input->getOption('port');
Method execute
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output): int {
if (Filesystem::isPrimaryObjectStorageEnabled() === true) {
$output->writeln('<info>We detected that the instance is running on a S3 primary object storage, users might not be accurate</info>');
}
Method openWithWeb
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function openWithWeb(?string $file_id, ?string $app_name): DataResponse {
$userAgent = $this->request->getHeader('User-Agent') ?? '-';
$this->logger->info("openWithWeb($file_id, $app_name) - $userAgent");
$fileId = $this->extractFileId($file_id);
$nodes = $this->rootFolder->getById($fileId, true);
Similar blocks of code found in 17 locations. Consider refactoring. Open
OC.L10N.register(
"files_trashbin",
{
"Couldn't delete %s permanently" : "حذف نہیں ہو سکتا %s مستقل طور پر",
"Couldn't restore %s" : "بحال نہيں کيا جا سکتا %s",
- 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 63.
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 17 locations. Consider refactoring. Open
OC.L10N.register(
"settings",
{
"Saved" : "সংরক্ষিত",
"Delete" : "মুছে ফেলা",
- 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 63.
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