Showing 75 of 125 total issues
Method post
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function post()
{
if (! isset($_POST['profile'])) {
throw new Exception("Missing profile data");
}
Method _getDevelopers
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function _getDevelopers()
{
$query = $this->_getContainer()->User()->selectAll();
$userRows = $this->_getContainer()->LocalConfig()->database()->fetchAll($query);
$users = array();
Function checkInterval
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
self.checkInterval = setInterval(function() {
// if the tooltip and/or its interval should be stopped
if (
// if the origin has been removed
Method loadByUsername
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function loadByUsername($username)
{
$query = $this->_localConfig->database()->select()
->from("users")
->joinLeft(
Function add_option
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
if (option.nodeName.toUpperCase() === "OPTION") {
if (option.text !== "") {
if (group_position != null) {
this.parsed[group_position].children += 1;
Function getFiles
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
EpicEditor.prototype.getFiles = function (name, excludeContent) {
var file
, data = this._getFileStore(name);
if (name) {
Avoid deeply nested control flow statements. Open
Open
if (arrayAlternate == 'even') {
if (areaNumber > areaGreatestX) {
areaGreatestX = areaNumber;
if (i === 0) {
areaSmallestX = areaGreatestX;
Avoid deeply nested control flow statements. Open
Open
if (self.options.interactive) {
// touch events inside the tooltip must not close it
if (deviceHasTouchCapability) {
self.$tooltip.on('touchstart.'+ self.namespace, function(event) {
Avoid deeply nested control flow statements. Open
Open
if (self.options.speed > 0) self.$tooltip.delay(self.options.speed);
Avoid deeply nested control flow statements. Open
Open
if(areEqual(p.position, self.elProxyPosition.position)) identical = true;
Avoid deeply nested control flow statements. Open
Open
if(self.Status != 'hidden'){
self.$tooltip.removeClass('tooltipster-content-changing');
// after the changing animation has completed, reset the CSS transitions
Avoid deeply nested control flow statements. Open
Open
if(self.Status != 'hidden'){
self.$tooltip.fadeTo(self.options.speed, 1);
}
Avoid deeply nested control flow statements. Open
Open
else if(self.options.trigger == 'click'){
// use a timeout to prevent immediate closing if the method was called on a click event and if options.delay == 0 (because of bubbling)
setTimeout(function() {
$('body').on('click.'+ self.namespace +' touchstart.'+ self.namespace, function() {
Avoid deeply nested control flow statements. Open
Open
if (!loose) loose = next;
Avoid deeply nested control flow statements. Open
Open
if (searchText.length) {
startpos = option.search_text.search(zregex);
text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length);
option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
}
Avoid deeply nested control flow statements. Open
Open
if (results_group != null) {
results_group.group_match = true;
}
Avoid deeply nested control flow statements. Open
Open
} else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) {
option.search_match = true;
}
Avoid deeply nested control flow statements. Open
Open
if (target === copy) {
continue;
}
Function post
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
public function post($postId)
{
$imageUrl = isset($_POST['image_url']) ? $_POST['image_url'] : null;
$subject = isset($_POST['subject']) ? $_POST['subject'] : 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
Avoid deeply nested control flow statements. Open
Open
if (deep && copy && typeof copy === "object" && !copy.nodeType) {
target[name] = _mergeObjs(deep,
// Never move original objects, clone them
src || (copy.length != null ? [] : {})
, copy);