Showing 224 of 370 total issues
Method backtrace
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function backtrace($label, $desc, $file, $line, $bt=null, $skip=0, $ns='NONE') {
Method generateQuery
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function generateQuery(array $fields, array $query=[], $count=null, $offset=null, $sort=[], $group=[], $reverse=null) {
Method query
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
private function query($query, $fields=null, $from=null, $to=null, $scroll=false, $offset=null, $count=null) {
Method sendSummaryEmail
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function sendSummaryEmail($to, $start_date, $stats, $leaders, $noisy_searches, $quiet_searches, $debug_data=[]) {
Avoid deeply nested control flow statements. Open
if(!(k in final_ret)) {
final_ret[k] = [];
}
Avoid deeply nested control flow statements. Open
for(var m in searches) {
// Active
var states = searches[m];
for(var n in states) {
var collection = states[n];
Function getAssigneeName
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
var getAssigneeName = function(assignee_type, assignee, users, groups, def_ret, prefix) {
Function whitelistAlerts
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function whitelistAlerts($data) {
if(!$this->allowUpdate()) {
throw new ForbiddenException;
}
- 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 deserialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Renderer.deserialize = function(App, mapping, model_id, in_mapping, callback, preview) {
Method entry
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function entry($type, $action, $target=0, $actor=0, $a=0, $b=0) {
Function processTargets
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function processTargets(array $alerts, array $targets, $date) {
$errors = [];
foreach($targets as $target) {
// Call process on each Target -> Alert.
foreach($alerts as $alert) {
- 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 sendAlerts
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function sendAlerts($data) {
if(!$this->allowUpdate()) {
throw new ForbiddenException;
}
- 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 processFilters
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function processFilters(array $alerts, array $filters, $date) {
$errors = [];
foreach($filters as $filter) {
$new_alerts = [];
- 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
Avoid deeply nested control flow statements. Open
if(vtok.length === 0) {
throw new ParseException('Empty group: "' + ktok + '"');
}
Method setAlertFields
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
private function setAlertFields($data, $fields, $alog_action, $slog_action, $a=0, $b=0) {
Function constructQuery
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function constructQuery() {
$query = Util::get($this->obj['query_data'], 'query', '');
$range = Util::get($this->obj['query_data'], 'range', 10);
$type = Util::get($this->obj['query_data'], 'type', '');
- 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 getEmails
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function getEmails($type, $entry, $update=true, $all=false) {
$emails = [];
switch($type) {
case self::T_USER:
$user = UserFinder::getById($entry);
- 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 getClient
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function getClient($config_name='alerts', $index=false) {
$escfg = Config::get('elasticsearch')[$config_name];
$cb = \Elasticsearch\ClientBuilder::create();
if($index && count($escfg['index_hosts']) > 0) {
$cb->setHosts($escfg['index_hosts']);
- 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 sendAlertActionEmail
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function sendAlertActionEmail($to, $action, $searches, $alerts, $content_only=false, $debug_data=[]) {
Function processSearches
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function processSearches($date, $search_health, $backfill) {
foreach(SearchFinder::getByQuery(['enabled' => 1]) as $search) {
// If the search doesn't need to run OR
// the search type is failing and isn't time based
// skip it!
- 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"