Showing 370 of 370 total issues

Function PUT has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function PUT(array $get, array $data) {
        $target_id = (int) Util::get($get, 'id');
        // Only an admin user or the user themself should be able to modify a user!
        // That check is done here. Note that the strict compare is necessary as getUserId()
        // can return null.
Severity: Minor
Found in phplib/REST/Users.php - About 25 mins to fix

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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute($get, $data) {
        if(!$this->allowCreate()) {
            throw new ForbiddenException;
        }

Severity: Minor
Found in phplib/REST/Searches.php - About 25 mins to fix

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 prompt has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function prompt($str) {
        $ret = '';
        while(true) {
            printf("%s: ", $str);
            $ret = fgets(STDIN);
Severity: Minor
Found in phplib/Util.php - About 25 mins to fix

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 isWorking has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function isWorking($date) {
        $cfg = $this->getConfig();
        $client = ESClient::getClient($this->getClientConfigKey());

        $working = false;
Severity: Minor
Found in phplib/Search/Elasticsearch.php - About 25 mins to fix

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 constructQuery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function constructQuery() {
        $query = Util::get($this->obj['query_data'], 'query');
        $fields = Util::get($this->obj['query_data'], 'fields', []);
        $parser = new \ESQuery\Parser;
        list($settings, $query_list) = $parser->parse($query);
Severity: Minor
Found in phplib/Search/Elasticsearch.php - About 25 mins to fix

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 processSite has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function processSite($site, $date, $backfill) {
        Logger::info('Process site', ['id' => $site['id'], 'date' => $date, 'backfill' => $backfill], self::LOG_NAMESPACE);
        $base_title = sprintf('411] Time: %d Site: %d', $date, $site['id']);
        cli_set_process_title($base_title);
        $timer = new Timer();
Severity: Minor
Found in phplib/Scheduler.php - About 25 mins to fix

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 bootstrapRecurse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function bootstrapRecurse($node, $data, $count, $fields) {
        $ret = [];

        if(array_key_exists('agg', $data)) {
            $key = array_pop($fields);
Severity: Minor
Found in phplib/ESClient.php - About 25 mins to fix

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 validateData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function validateData(array $data) {
        parent::validateData($data);
        if(strlen(trim($data['name'])) == 0) {
            throw new ValidationException('Invalid name');
        }
Severity: Minor
Found in phplib/User.php - About 25 mins to fix

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 groupAlerts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static function groupAlerts($search_map, array $alerts) {
        $groups = [];
        foreach($alerts as $alert) {
            if(!array_key_exists($alert['search_id'], $groups)) {
                $groups[$alert['search_id']] = [[], []];
Severity: Minor
Found in phplib/Notification.php - About 25 mins to fix

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 shouldRun has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function shouldRun($date, $backfill=false) {
        $due = false;
        $job = JobFinder::getLastByQuery(['type' => Search_Job::$TYPE, 'target_id' => $this->obj[static::$PKEY]]);

        $last_scheduled_date = is_null($job) ? 0:$job['target_date'];
Severity: Minor
Found in phplib/Search.php - About 25 mins to fix

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

Severity
Category
Status
Source
Language