Showing 224 of 370 total issues
Function hydrateModels
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function hydrateModels($objs) {
$models = [];
foreach($objs as $obj) {
foreach(array_keys($obj) as $key) {
// If a value is numeric, cast it into an int.
- 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 parseDates
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function parseDates($format, array $dates) {
$ret = [];
switch($format) {
case '#':
$ret = $dates;
- 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 filterSearchesFunc
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
var filterSearchesFunc = function(collection, query) {
for(var k in query) {
if(!_.isArray(query[k])) {
query[k] = [query[k]];
}
Function _render
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
_render: function() {
var sidelinks = [
{name: 'Keyboard shortcuts', action: 'shortcuts'},
{name: 'Message history', action: 'messages'}
];
Function readForm
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
readForm: function() {
var form = this.$('#search-form');
var data = Util.serializeForm(form);
// schedule_type is an int.
Function update
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
update: function() {
var query = Util.parseQuery(window.location.href);
var processResults = this.cbRendered(function(resp) {
this.collections = [];
Method process
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process(Alert $alert, $date) {
$site = SiteFinder::getCurrent();
$search = SearchFinder::getById($alert['search_id']);
$issue_key = null;
Method process
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process($date, $backfill) {
Logger::info('Scheduler run', ['time' => $date], self::LOG_NAMESPACE);
cli_set_process_title('411] Scheduler');
print "[+] Scheduler: $date\n";
$timer = new Timer();
Function App
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
var App = function() {
// Store a global collection of each type. This allows for caching objects between pages.
this.Data = {
Searches: new SearchCollection(),
Alerts: new AlertCollection(),
Consider simplifying this complex logical expression. Open
if(
!('href' in anchor) ||
anchor.target === '_blank' ||
anchor.href.length === 0 ||
anchor.href.indexOf('#') !== -1 ||
Method run
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run() {
$cfg = new DBConfig;
$dt = new \DateTime('@' . $this->obj['target_date']);
$dt->setTime(0, 0, 0);
$end_ts = $dt->getTimestamp();
Function initializeCollection
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
initializeCollection: function(params) {
var arr = this.initializeCollectionData(params);
var models = arr[0],
frag = arr[1];
Function formatTime
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function formatTime(mins) {
var weeks = 0;
var days = 0;
var hours = 0;
mins = parseInt(mins, 10);
Function initUserSelect
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
var initUserSelect = function(elems, users, search, options) {
options = options || {};
var user_search = function(q) {
var term = q.term.toLowerCase();
Function destroyElement
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
destroyElement: function(k) {
var elems = this.childElements[k];
if(_.isUndefined(elems)) {
throw 'Called destroyChild on unknown key: ' + k;
}
Function serialize
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function serialize($arr) {
$s_arr = [];
if(is_null($arr)) {
return 'null';
- 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 generateTypeData
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function generateTypeData($types) {
$type_names = [];
if(Auth::isAuthenticated()) {
foreach($types as $type) {
$data = [];
- 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 health
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function health($date) {
$search_health = [];
$cfg = new DBConfig;
$meta = new DBMeta;
- 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 query
has a Cognitive Complexity of 11 (exceeds 5 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 = [];
- 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 run
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run() {
// Grab a list of jobs that have autoclosing enabled.
$searches = SearchFinder::getByQuery(['autoclose_threshold' => [
ModelFinder::C_GT => 0
]]);