Showing 90 of 90 total issues
Function getIsAdmin
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function getIsAdmin()
{
if ($this->_isAdmin === null) {
if ($this->getIsConsoleRequest() && !$this->forceWebRequest && !Yii::$app->hasModule('admin')) {
$this->_isAdmin = false;
- 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 buildImporterQueue
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function buildImporterQueue()
{
$queue = [];
foreach (Yii::$app->getApplicationModules() as $id => $module) {
$response = $module->import($this);
- 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 actionClone
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function actionClone($vendor = null, $repo = null)
{
// if `vendor/repo` notation is provided
if ($vendor !== null && strpos($vendor, '/')) {
list($vendor, $repo) = explode("/", $vendor);
- 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 actionCreate
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionCreate(string $themeName = null)
{
Console::clearScreenBeforeCursor();
$themeName = $this->prompt("Enter the name (lower case) of the theme you like to generate:", ['default' => $themeName]);
Function _computeTargetAndRootIntersection
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function(target, targetRect, rootRect) {
// If the element isn't displayed, an intersection can't happen.
if (window.getComputedStyle(target).display == 'none') return;
var intersectionRect = targetRect;
Function trigger
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected static function trigger($name)
{
if (isset(static::$_hooks[$name])) {
$events = [];
- 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 play
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
play() {
if (this.isPaused) {
return this.resume()
}
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (!Object.seal) {
Object.seal = function seal(object) {
if (Object(object) !== object) {
throw new TypeError('Object.seal can only be called on Objects.');
}
- 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 71.
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 _monitorIntersections
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
IntersectionObserver.prototype._monitorIntersections = function(doc) {
var win = doc.defaultView;
if (!win) {
// Already destroyed.
return;
Function loadImage
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
loadImage(image) {
const context = this
this.log('Image loading:', { id: image.id, image })
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (!Object.preventExtensions) {
Object.preventExtensions = function preventExtensions(object) {
if (Object(object) !== object) {
throw new TypeError('Object.preventExtensions can only be called on Objects.');
}
- 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 71.
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 beforeRun
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function beforeRun($app)
{
foreach ($app->tags as $name => $config) {
TagParser::inject($name, $config);
}
- 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 buildTraceItem
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function buildTraceItem(array $item)
{
$file = $item['file'] ?? null;
$line = $item['line'] ?? null;
$contextLine = null;
Function getOwnPropertyDescriptor
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
if (isPrimitive(object)) {
throw new TypeError(ERR_NON_OBJECT + object);
}
Method getInternalResolverArray
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getInternalResolverArray()
{
if ($this->_resolved === null) {
$requestPathInfo = $this->trailingPathInfo();
$newRegex = $this->buildRegexPattern();
Function generateClassName
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function generateClassName($tableName, $useSchemaName = null)
{
if (isset($this->classNames[$tableName])) {
return $this->classNames[$tableName];
}
- 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 actionCreate
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionCreate()
{
Console::clearScreenBeforeCursor();
$moduleName = $this->prompt("Enter the name of the module you like to generate:");
Method actionIndex
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionIndex()
{
// opcache reset should run in web context, but might be helpfull as well.
if (function_exists('opcache_reset')) {
@opcache_reset();
Method run
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run()
{
TextToSpeechAsset::register($this->view);
$config = Json::htmlEncode([
Function defineProperty
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Object.defineProperty = function defineProperty(object, property, descriptor) {
if (isPrimitive(object)) {
throw new TypeError(ERR_NON_OBJECT_TARGET + object);
}
if (isPrimitive(descriptor)) {