Showing 4,504 of 4,504 total issues
Method addStorage
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addStorage(IStorageConfig $newStorage) {
$allStorages = $this->readConfig();
$configId = $this->dbConfig->addMount(
$newStorage->getMountPoint(),
Method deleteOrphanEntries
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function deleteOrphanEntries(IOutput $output, $repairInfo, $deleteTable, $deleteId, $sourceTable, $sourceId, $sourceNullColumn) {
$qb = $this->connection->getQueryBuilder();
$qb->select('d.' . $deleteId)
->from($deleteTable, 'd')
Method addQueryConditionsParentIdWrongPath
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function addQueryConditionsParentIdWrongPath($qb) {
// thanks, VicDeo!
if ($this->connection->getDatabasePlatform() instanceof MySqlPlatform) {
$concatFunction = $qb->createFunction("CONCAT(fcp.path, '/', fc.name)");
} else {
Method createShare
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function createShare($data) {
$share = new Share($this->rootFolder, $this->userManager);
$share->setId($data['id'])
->setShareType((int)$data['share_type'])
->setPermissions((int)$data['permissions'])
Method cropAndFill
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function cropAndFill($image, $askedWidth, $askedHeight, $previewWidth, $previewHeight) {
if ($previewWidth > $askedWidth) {
$cropX = \floor(($previewWidth - $askedWidth) * 0.5);
$image->crop($cropX, 0, $askedWidth, $previewHeight);
$previewWidth = $askedWidth;
Method findAppInDirectories
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function findAppInDirectories($appId) {
$sanitizedAppId = \OC_App::cleanAppId($appId);
if ($sanitizedAppId !== $appId) {
return false;
}
Method adjustStreamChunkSize
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function adjustStreamChunkSize($handle) {
$stream = $handle;
$metadata = \stream_get_meta_data($stream);
while ($metadata['stream_type'] === 'user-space') {
\stream_set_chunk_size($stream, 64 * 1024);
Method getAccessList
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAccessList($path) {
// Make sure that a share key is generated for the owner too
list($owner, $ownerPath) = $this->util->getUidAndFilename($path);
// always add owner to the list of users with access to the file
Method decryptAll
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function decryptAll(InputInterface $input, OutputInterface $output, $user = '') {
$this->input = $input;
$this->output = $output;
if ($user !== '' && $this->userManager->userExists($user) === false) {
Method syncHome
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function syncHome(Account $a, UserInterface $backend) {
// Fallback for backends that dont yet use the new interfaces
$providesHome = $backend instanceof IProvidesHomeBackend || $backend->implementsActions(\OC_User_Backend::GET_HOME);
$uid = $a->getUserId();
// Log when the backend returns a string that is a different home to the current value
Method update
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function update(IComment $comment) {
return $this->emittingCall(function () use (&$comment) {
$qb = $this->dbConn->getQueryBuilder();
$affectedRows = $qb
->update('comments')
Method getFileSizeViaCurl
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFileSizeViaCurl($fileName) {
if (\OC::$server->getIniWrapper()->getString('open_basedir') === '') {
$pathParts = \explode('/', $fileName);
$encodedPathParts = \array_map('rawurlencode', $pathParts);
$encodedFileName = \implode('/', $encodedPathParts);
Method insert
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function insert(IComment &$comment) {
$qb = $this->dbConn->getQueryBuilder();
$affectedRows = $qb
->insert('comments')
->values([
Method execute
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output): int {
// collate config setting to the end, to avoid partial configuration
$toBeSet = [];
if ($backend = $input->getOption('backend')) {
Method execute
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute($command, $token, $params = []) {
try {
$this->validateRequest($command, $token);
$output = new BufferedOutput();
Similar blocks of code found in 3 locations. Consider refactoring. Open
if(!data.forwardedForHeadersWorking) {
messages.push({
msg: t('core', 'The reverse proxy headers configuration is incorrect, or you are accessing ownCloud from a trusted proxy. If you are not accessing ownCloud from a trusted proxy, this is a security issue and can allow an attacker to spoof their IP address as visible to ownCloud. Further information can be found in our <a target="_blank" rel="noreferrer" href="{docLink}">documentation</a>.', {docLink: data.reverseProxyDocs}),
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
});
- 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 59.
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
if(!data.isUrandomAvailable) {
messages.push({
msg: t('core', '/dev/urandom is not readable by PHP which is highly discouraged for security reasons. Further information can be found in our <a target="_blank" rel="noreferrer" href="{docLink}">documentation</a>.', {docLink: data.securityDocs}),
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
});
- 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 59.
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
if(!data.isMemcacheConfigured) {
messages.push({
msg: t('core', 'No memory cache has been configured. To enhance your performance please configure a memcache if available. Further information can be found in our <a target="_blank" rel="noreferrer" href="{docLink}">documentation</a>.', {docLink: data.memcacheDocs}),
type: OC.SetupChecks.MESSAGE_TYPE_INFO
});
- 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 59.
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 processSharesToConfirm
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
processSharesToConfirm: function() {
var fileList = this.filesApp.fileList;
// check for new server-to-server shares which need to be approved
$.get(OC.generateUrl('/apps/files_sharing/api/externalShares'),
{},
Function processIncomingShareFromUrl
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
processIncomingShareFromUrl: function() {
var fileList = this.filesApp.fileList;
var params = OC.Util.History.parseUrlQuery();
//manually add server-to-server share
if (params.remote && params.token && params.owner && params.name) {