Showing 370 of 370 total issues
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if('assignee' in query) {
var assignee = Util.parseAssignee(query.assignee);
query.assignee_type = assignee[0];
query.assignee = assignee[1];
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 60.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if('assignee' in query) {
var assignee = Util.parseAssignee(query.assignee);
query.assignee_type = assignee[0];
query.assignee = assignee[1];
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 60.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
selectAction: function(action) {
switch(action) {
case 'open': this.open(); break;
case 'pdf': this.generatePDF(); break;
case 'csv': this.generateCSV(); break;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 60.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
selectAction: function(action) {
switch(action) {
case 'open': this.open(); break;
case 'select': this.select(); break;
case 'source': this.source(); break;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 60.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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
]]);
Function _render
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
_render: function() {
// These attributes are initialized here because we occasionally
// need to rerender the View.
this.columns = [];
this.keys = [];
Method process
has 31 lines of code (exceeds 25 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();
Method validateField
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function validateField($field, $settings, $value) {
$ok = false;
switch($settings[0]) {
case static::T_BOOL:
$ok = is_bool($value);
Method _execute
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _execute($date, $constructed_qdata) {
$tecfg = $this->getConfig();
if(is_null($tecfg['api_token']) || is_null($tecfg['api_secret'])) {
throw new SearchException('Threatexchange not configured');
}
Method offsetSet
has 31 lines of code (exceeds 25 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:
Method mail
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function mail($to, $from, $title, $message, $file=null) {
list($to, $from, $title, $message, $file) = Hook::call('mail', [$to, $from, $title, $message, $file]);
$to = (array) $to;
$bnd = uniqid();
Similar blocks of code found in 2 locations. Consider refactoring. Open
}, {
success: this.cbRendered(function(resp) {
this.App.addMessage('Sent ' + resp.count + ' alerts', 2);
this.hide();
}),
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 59.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
AlertCollection.whitelist(data, {
success: this.cbRendered(function(resp) {
this.App.addMessage('Whitelisted ' + resp.count + ' alerts', 2);
this.hide();
}),
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 59.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76