Showing 224 of 370 total issues
Function _render
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
_render: function() {
this.App.setTitle('Search: ' + (this.model.isNew() ? 'New':this.model.get('id')));
this.registerView(new SearchNavbarView(this.App, {model: this.model}), true);
this.listenTo(this.App.Bus, 'stats', this.showStatistics);
this.listenTo(this.App.Bus, 'changelog', this.showChangelog);
Method processSite
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function processSite($site, $date) {
$base_title = sprintf('411] Time: %d Site: %d', $date, $site['id']);
cli_set_process_title($base_title);
print "[+] Worker: $date\n";
$timer = new Timer();
File Alerts.php
has 299 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace FOO;
/**
Method _run
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _run($commit, Search $search, $disable_search_commit=false) {
$alerts = [];
$errors = [];
// Don't allow saving Alerts if the Search isn't in the DB.
Function query
has a Cognitive Complexity of 22 (exceeds 5 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);
- 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 getActiveAlertCounts
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getActiveAlertCounts() {
$client = self::getClient();
$filter = [
[
Method GET
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function GET(array $get) {
$users = $this->generateUsers();
$search_types = $this->generateTypeNames(Search::getTypes());
$target_types = $this->generateTypeNames(Target::getTypes());
Function ___render
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
___render: function() {
var projects = Data.Jira.Issues;
var users = Data.Jira.Users;
var issuetypes = {};
File Search.php
has 284 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace FOO;
/**
Function initializeCollectionData
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
initializeCollectionData: function(params) {
var frag = document.createDocumentFragment();
this.destroyViews();
var data = {};
Alerts_REST
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class Alerts_REST extends Models_REST {
const SLOG_TYPE = SLog::T_ALERT;
public static $MODEL = 'Alert';
public static $CREATABLE = [];
Method GET
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function GET(array $get) {
$data = [];
$meta = new DBMeta;
$cfg = new DBConfig;
$client = new ESClient;
Function offsetSet
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function offsetSet($key, $value) {
$schema = static::getSchema();
if(array_key_exists($key, $this->obj)) {
switch($schema[$key][0]) {
case static::T_BOOL:
- 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 _execute
has a Cognitive Complexity of 19 (exceeds 5 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) {
- 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 query
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function query($query, $fields=null, $from=null, $to=null, $scroll=false, $offset=null, $count=null) {
$client = self::getClient();
$filter = [];
$conds = [];
Function _render
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
_render: function() {
this.groups = [];
if(this.settings.count > 0) {
// Always allow these.
Model
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Model implements \JsonSerializable, \ArrayAccess {
// Field types
/** Boolean field type. */
const T_BOOL = 0;
/** Numeric (int/float) field type. */
Function _render
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
_render: function() {
var model_data = this.model.toJSON();
var desc_parts = [];
var alert = this.App.Data.Alerts.get(this.model.get('alert_id'));
Method run
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run() {
switch($this->obj['target_id']) {
case static::I_HOURLY:
$type = Search::NT_HOURLY;
$range = 1 * 60 * 60;
Search
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class Search extends TypeModel {
public static $TYPES = [
Null_Search::class,
ES_Search::class,
ECL_Search::class,