Showing 224 of 370 total issues
Method setAlertFields
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function setAlertFields($data, $fields, $alog_action, $slog_action, $a=0, $b=0) {
if(!$this->allowUpdate()) {
throw new ForbiddenException;
}
Function _render
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
_render: function() {
this.App.setTitle('Alert: ' + this.model.get('id'));
this.registerView(new AlertNavbarView(this.App, {model: this.model}), true);
this.App.registerSelectableGroup(this);
File view.js
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
define(function(require) {
var $ = require('jquery'),
_ = require('underscore'),
Backbone = require('backbone'),
Function run
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function run() {
switch($this->obj['target_id']) {
case static::I_HOURLY:
$type = Search::NT_HOURLY;
$range = 1 * 60 * 60;
- 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 getAlertActivityCounts
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAlertActivityCounts($range, $search_id=0) {
$client = self::getClient();
$filter = [
[
Function getActiveAlertCounts
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function getActiveAlertCounts() {
$client = self::getClient();
$filter = [
[
- 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 route
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function route() {
$ret = self::format();
try {
$this->checkAuthorization();
- 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 stats
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function stats($data) {
if(!$this->allowRead()) {
throw new ForbiddenException;
}
Function updateSelection
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateSelection: function() {
var data = {esc: 0, assign: 0, state: 0};
var elements = this.$('.alerts-table .alert-checkbox');
if(elements.length === 0) {
return;
Function initAssigneeSelect
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
var initAssigneeSelect = function(elems, users, groups, search, options) {
options = options || {};
var assignee_search = function(q) {
var term = q.term.toLowerCase();
Method query
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function query($query, array $params=[], $ret_type=self::ALL) {
self::keepAlive();
list($query) = Hook::call('db.query', [$query]);
$stmt = self::$dbh->prepare($query);
Function POST
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function POST(array $get, array $data) {
$errors = [];
// Loop over each object we need to process.
foreach($data as &$obj) {
- 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 backfill
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function backfill($start_date, $end_date, $max_jobs=5) {
Logger::info('Scheduler backfill run', ['start' => $start_date, 'end' => $end_date], self::LOG_NAMESPACE);
cli_set_process_title('411] Backfill');
print "[+] Backfill: $start_date to $end_date\n";
$timer = new Timer();
- 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 process
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Renderer.process = function(App, base_mapping, callback, preview) {
var remote_mapping = {};
// First loop over each group of views.
for(var v in base_mapping) {
Method _execute
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _execute($date, $constructed_qdata) {
// If our last_success_date is within 10 seconds of the start time, use that
// as the start time.
$from = $date - ($this->obj['range'] * 60);
if(abs($this->obj['last_success_date'] - $from) < 10) {
Method bootstrap
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function bootstrap($query, $from=null, $to=null) {
$client = self::getClient();
$fields = ['escalated', 'assignee_type', 'assignee', 'search_id', 'state'];
$aggs = [];
Method route
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function route() {
$ret = self::format();
try {
$this->checkAuthorization();
Function process
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function process(Alert $alert, $date) {
$script = self::$SCRIPTS[$this->obj['data']['script']];
$spec = [
0 => ['pipe', 'r'],
1 => ['pipe', 'w'],
- 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 validateData
has a Cognitive Complexity of 14 (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');
- 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 _render
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
_render: function() {
this.App.setTitle('Index');
var user = this.App.Data.User;
var vars = {
logged_in: !!user,