Showing 370 of 370 total issues
Method whitelistAlerts
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function whitelistAlerts($data) {
if(!$this->allowUpdate()) {
throw new ForbiddenException;
}
Method afterStore
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function afterStore($model, $data, $new, $delete) {
$fields = ['tags', 'priority', 'category', 'owner'];
// Trigger a job to delete all Alerts if the Search was deleted.
if($delete) {
Method process
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process(Alert $alert, $date) {
$site = SiteFinder::getCurrent();
$alert_url = $site->urlFor('/');
if(!$alert->isNew()) {
Method generateClauses
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function generateClauses($count=null, $offset=null, $sort=[], $group=[], $reverse=null) {
$MODEL = 'FOO\\' . static::$MODEL;
$clauses = [];
$order = [];
Method generateSchema
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function generateSchema() {
return [
'name' => [self::T_STR, null, ''],
'source' => [self::T_STR, null, ''],
'query_data' => [self::T_OBJ, null, []],
Function initTimeSelect
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
var initTimeSelect = function(elems, options) {
options = options || {};
var fmt = options.format || formatTime;
var intvs = [1, 5, 10, 15, 30, 60, 90, 120, 180, 360, 720, 1440, 2880, 4320, 10080, 20160];
Method sendAlerts
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function sendAlerts($data) {
if(!$this->allowUpdate()) {
throw new ForbiddenException;
}
Function registerView
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
registerView: function(view, init, sel, str) {
if(_.isUndefined(str)) str = view.cid;
if(_.isUndefined(sel)) sel = this.$el;
var arr = str.substr(-2) === '[]';
if(this.childViewNamesToIDs[str] && !arr) {
Function _render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
_render: function() {
var search = this.App.Data.Searches.get(this.model.get('search_id'));
var vars = this.model.toJSON();
_.extend(vars, {
preview: this.preview,
Method generateWhere
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function generateWhere(array $query) {
$MODEL = 'FOO\\' . static::$MODEL;
$clauses = [];
$vals = [];
Function afterStore
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function afterStore($model, $data, $new, $delete) {
$fields = ['tags', 'priority', 'category', 'owner'];
// Trigger a job to delete all Alerts if the Search was deleted.
if($delete) {
- 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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function process(Alert $alert, $date) {
$data = $this->obj['data'];
$include = Util::get($data, 'include', true);
$keys = [Util::get($data, 'key', '*')];
if ($keys[0] == '*') {
- 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 POST
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function POST(array $get, array $data) {
$cfg = new DBConfig();
foreach(self::$FIELDS as $field=>$type) {
$val = Util::get($data, $field);
- 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 generateClauses
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected static function generateClauses($count=null, $offset=null, $sort=[], $group=[], $reverse=null) {
$MODEL = 'FOO\\' . static::$MODEL;
$clauses = [];
$order = [];
- 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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function process() {
Logger::info('Worker run', [], self::LOG_NAMESPACE);
cli_set_process_title('411] Worker');
print "[+] Worker\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 loadMoreAlerts
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
loadMoreAlerts: function(e) {
var elem = $(e.currentTarget).closest('.alerts-load').find('input').get(0);
var n = parseInt(elem.value, 10);
var data = {
Function _render
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
_render: function() {
NavbarView.prototype._render.call(this);
var default_search = this.App.Data.User.get('settings')['default'];
var query = Util.parseQuery(window.location.href);
Function readForm
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
readForm: function() {
var data = SearchView.SearchView.prototype.readForm.call(this);
if("result_type" in data) {
data.query_data.result_type = parseInt(data.result_type, 10);
Function processResults
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
var processResults = this.cbRendered(function(resp) {
this.collections = [];
for(var i = 0; i < resp.length; ++i) {
var c = resp[i].count;
Function save
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
save: function(data, options) {
if(_.isUndefined(data)) {
data = [];
for(var k in this.models) {
var attrs = this.models[k].toJSON();