Showing 14 of 84 total issues
Function onload
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.onload = function () {
// If pretty URLs are enabled ('urlManager' => ['enablePrettyUrl' => 'true'])
// one can use relative URLs, so controller_url can be emtpy.
// But when the index action is called implicitly (when no action is given in the URL)
Task
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
class Task extends ActiveRecord implements TaskInterface {
/**
* @return array
*/
Function checkAndRunTasks
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public static function checkAndRunTasks($tasks)
{
$invocationTimestamp = time();
$invocationDatetime = date('Y-m-d H:i:00');
- 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 runTask
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function runTask($task)
{
$result = $task->acquireLock();
if ($result) {
$run = $task->createTaskRun();
Function runTask
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function runTask($task)
{
$result = $task->acquireLock();
if ($result) {
$run = $task->createTaskRun();
- 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 acquireLock
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function acquireLock() {
if (!$this->id) {
throw new \LogicException('Task ID must be set to acquire a lock');
}
$db = \Yii::$app->getDb();
Function parseCrontab
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function parseCrontab($cron, $taskClass)
{
$cronArray = explode(PHP_EOL, $cron);
$tasks = [];
foreach ($cronArray as $cronElement) {
- 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 checkAndRunTasks
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function checkAndRunTasks($tasks)
{
$invocationTimestamp = time();
$invocationDatetime = date('Y-m-d H:i:00');
Method parseCrontab
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function parseCrontab($cron, $taskClass)
{
$cronArray = explode(PHP_EOL, $cron);
$tasks = [];
foreach ($cronArray as $cronElement) {
Function getControllersList
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected static function getControllersList($paths, $namespacesList)
{
$controllers = [];
foreach ($paths as $pathIndex => $path) {
if (!file_exists($path)) {
- 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 acquireLock
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function acquireLock() {
if (!$this->id) {
throw new \LogicException('Task ID must be set to acquire a lock');
}
$db = \Yii::$app->getDb();
- 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 editTask
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function editTask($task, $time, $command, $status = TaskInterface::TASK_STATUS_ACTIVE,
$comment = null)
Function loadController
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function loadController($className)
{
foreach (self::$classFolders as $f) {
$f = rtrim($f, '/');
$filename = $f . '/' . $className . '.php';
- 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 parseCommand
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function parseCommand($command)
{
if (preg_match('/([@\w\\\\]+)::(\w+)\((.*)\)/', $command, $match)) {
$params = explode(',', $match[3]);
// trim params and strip quotes
- 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"