Showing 503 of 503 total issues
Function run
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function run()
{
$this->refresh('thumbnail', [
'name' => 'Thumbnail',
'imagine_name' => 'thumbnail',
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getParameters
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function getParameters(): array
{
$params = [];
if ($this->getReflection() instanceof ReflectionMethod) {
foreach ($this->getReflection()->getParameters() as $arg) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function template
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
template: function () {
return '' +
'<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}">' +
'<div class="form-side form-side-label">' +
'<label>{{label}}</label>' +
Method getAngularControllerConfig
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getAngularControllerConfig()
{
return [
'apiListQueryString' => $this->context->apiQueryString('list'),
'apiUpdateQueryString' => $this->context->apiQueryString('update'),
Method actionRelationCall
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionRelationCall($arrayIndex, $id, $modelClass, $query = null)
{
$modelClass = base64_decode($modelClass);
if (!class_exists($modelClass)) {
Method onListFind
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function onListFind($event)
{
// async list ignores the onListFind event
if ($this->asyncList) {
return;
Function template
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
template: function () {
return '' +
'<div class="form-group form-side-by-side zaa-datetime" ng-class="{\'input--hide-label\': i18n, \'input--with-time\': model!=null && date!=null}">' +
'<div class="form-side form-side-label">' +
'<label>{{label}}</label>' +
Method startFiles
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function startFiles()
{
$fileCount = 0;
// sync files
foreach ((new Query())->where(['is_deleted' => false])->all() as $file) {
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (Yii::$app->security->validatePassword($backupCode, $user->login_2fa_backup_key)) {
$autologin = Yii::$app->session->get('autologin', false);
if (!$autologin) {
// auto login is disabled, disable the function
- 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 105.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if ($twoFa->verifyCode($user->login_2fa_secret, $verify)) {
$autologin = Yii::$app->session->get('autologin', false);
if (!$autologin) {
// auto login is disabled, disable the function
- 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 105.
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 success
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
success: function (response) {
$('.login-btn[type="submit"]').attr('disabled', false);
$('.login-spinner').hide();
$('.login-btn-label').show();
var refresh = response['refresh'];
Function onTyping
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
thisInput.on('keyup blur', function onTyping() {
if (thisInput[0].value &&
thisInput[0].value.length &&
thisInput[0].value.length > 0) {
Method generateClassName
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function generateClassName($tableName, $useSchemaName = null)
{
if (isset($this->classNames[$tableName])) {
return $this->classNames[$tableName];
}
Method actionPasswordReset
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionPasswordReset($token, $id)
{
if (!$this->module->resetPassword) {
throw new ForbiddenHttpException();
}
Identical blocks of code found in 2 locations. Consider refactoring. Open
if ($scope.api.indexOf('?') > -1) {
var url = $scope.api + '&inline=1';
} else {
var url = $scope.api + '?inline=1';
}
- 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
Method internalGenerateResponseArrayFromModel
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function internalGenerateResponseArrayFromModel($modelClassName, $isArray = false)
{
$object = $this->createObjectFromClassName($modelClassName);
$schema = false;
Identical blocks of code found in 2 locations. Consider refactoring. Open
if ($scope.api.indexOf('?') > -1) {
var url = $scope.api + '&inline=1';
} else {
var url = $scope.api + '?inline=1';
}
- 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 uploadUsingUpload
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
$scope.uploadUsingUpload = function (file) {
file.upload = Upload.upload({
url: 'admin/api-admin-storage/files-upload',
fields: { 'folderId': $scope.currentFolderId },
file: file
Method actionSession
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionSession()
{
$user = Yii::$app->adminuser->identity;
$qrcode = null;
Method actionCleanupImageTable
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionCleanupImageTable()
{
$rows = Yii::$app->db->createCommand('SELECT file_id, filter_id, COUNT(*) as count FROM {{%admin_storage_image}} GROUP BY file_id, filter_id HAVING COUNT(*) > 1')->queryAll();
if (empty($rows)) {