Showing 503 of 503 total issues
Function getOptionsData
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function getOptionsData($event)
{
$items = [];
$targetModel = new $this->model();
foreach ($this->model->find()->asArray($this->asArray)->all() as $item) {
- 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 onAfterListFind
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function onAfterListFind($event)
{
if (!$this->assignAfterFind) {
return parent::onAfterListFind($event);
}
- 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 actionReset
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function actionReset()
{
if (!$this->module->resetPassword) {
throw new ForbiddenHttpException();
}
- 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 run
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function run()
{
$modules = Yii::$app->getModules();
$ids = [];
foreach ($modules as $id => $moduleObject) {
- 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 actionIndex
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function actionIndex()
{
try {
Image::getImagine();
} catch (\Exception $e) {
- 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 getPathsFromControllerMap
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function getPathsFromControllerMap()
{
foreach ($this->controllerMap as $key => $map) {
if (is_array($map)) {
$controller = Yii::createObject($map['class'], [$key, $map['module']]);
- 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 getUseClasses
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function getUseClasses()
{
$file = $this->reflection->getFileName();
$tokens = \PhpToken::tokenize(file_get_contents($file));
- 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
Method filter
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function filter()
{
$containerData = $this->getDataProvider();
$whereExpression = $this->_where;
Method getResponseContent
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getResponseContent()
{
$modelClass = $this->extractModelClassFromObject($this->getActionObject());
if ($modelClass) {
Identical blocks of code found in 2 locations. Consider refactoring. Open
$scope.$watch(function () {
return $scope.date
}, function (n, o) {
if (n !== o && n !== undefined && n !== null) {
$scope.refactor(n);
- 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 69.
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
$scope.$watch(function () {
return $scope.date
}, function (n, o) {
if (n !== o && n !== undefined && n !== null) {
$scope.refactor(n);
- 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 69.
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
$scope.loadTags = function() {
$http.get($scope.crud.getActiveWindowCallbackUrl('LoadTags')).then(function(transport) {
$scope.tags = transport.data;
});
};
- 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 68.
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
$scope.loadImages = function() {
$http.get($scope.crud.getActiveWindowCallbackUrl('loadAllImages')).then(function(response) {
$scope.files = response.data;
})
};
- 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 68.
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 link
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
link: function (scope, element, attrs) {
scope.elementWidth = 0;
var getElementOriginalWidth = function () {
var elementClone = element.clone().insertAfter(element);
Method updateItemIndex
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function updateItemIndex(AfterSaveEvent $event, $isNewRecord = false)
{
$attributeName = self::sortableField();
$oldPosition = array_key_exists($attributeName, $event->changedAttributes) ? $event->changedAttributes[$attributeName] : false;
$newPosition = $event->sender[$attributeName];
Function controller
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
controller: ['$scope', '$timeout', function ($scope, $timeout) {
$scope.pageNumberInputVal = $scope.currentPage;
$scope.$watch('currentPage', function(newVal) {
$scope.pageNumberInputVal = newVal;
Function controller
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
controller: ['$scope', '$filter', function ($scope, $filter) {
if ($scope.model === undefined) {
$scope.model = [];
}
Method addFile
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addFile($fileSource, $fileName, $folderId = 0, $isHidden = false)
{
// ensure the file upload
$fileData = $this->ensureFileUpload($fileSource, $fileName);
// generate md5 hash from file source
Method ensureFileUpload
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function ensureFileUpload($fileSource, $fileName)
{
// throw exception if source or name is empty
if (empty($fileSource) || empty($fileName)) {
throw new Exception("Filename and source can not be empty.");
Method safeUp
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function safeUp()
{
// admin_auth
$this->createIndex('index_route', '{{%admin_auth}}', ['route']);
$this->createIndex('index_api', '{{%admin_auth}}', ['api']);