Showing 50 of 22,315 total issues
File thread.js
has 1688 lines of code (exceeds 250 allowed). Consider refactoring. Open
cw = cw || {};
cw.DEFAULTS = {
types: ['problem', 'cause', 'solution'],
types_plural: ['problems', 'causes', 'solutions'],
Function saveEdit
has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring. Open
saveEdit: function(e) {
e.stopPropagation();
var _this = this;
var c_type = this.model.get('type');
var new_body = this.$('.edit-civi-body').val().trim();
- 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 saveEdit
has 177 lines of code (exceeds 25 allowed). Consider refactoring. Open
saveEdit: function(e) {
e.stopPropagation();
var _this = this;
var c_type = this.model.get('type');
var new_body = this.$('.edit-civi-body').val().trim();
File models.py
has 440 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime
import json
import math
import os
from calendar import month_name
File api.py
has 415 lines of code (exceeds 250 allowed). Consider refactoring. Open
import json
from accounts.models import Profile
from common.utils import check_database, save_image_from_url
from core.custom_decorators import require_post_params
Function editThread
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
editThread: function (e) {
var _this = this;
_this.$(e.currentTarget).addClass('disabled').attr('disabled', true);
var title = this.$el.find('#thread-title').val().trim();
Function success
has 118 lines of code (exceeds 25 allowed). Consider refactoring. Open
success: function (response) {
_this.closeEdit(e);
// var score = $this.find('.rate-value');
// var new_vote = parseInt(score.text())+ 1;
// score.text(new_vote);
Function createCivi
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
createCivi: function (e) {
var _this = this;
var title = this.$el.find('#civi-title').val(),
body = this.$el.find('#civi-body').val(),
Function renderOutline
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderOutline: function(){
var _this = this;
if (this.civis.length === 0){
// render with mock data to prevent errors
var mockData = {
Function success
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
success: function (response) {
var file = $('#thread_attachment_image').val();
var img_url = _this.$('#link-image-form').val().trim();
if (_this.removeImage) {
// if file
ThreadView
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
cw.ThreadView = BB.View.extend({
el: '#thread',
template: _.template($('#thread-template').html()),
wikiTemplate: _.template($('#thread-wiki-template').html()),
bodyTemplate: _.template($('#thread-body-template').html()),
Function createCivi
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
createCivi: function (e) {
var _this = this;
var title = this.$el.find('#civi-title').val(),
body = this.$el.find('#civi-body').val(),
- 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 createResponse
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
createResponse: function (e) {
var _this = this;
this.$(e.currentTarget).addClass('disabled').attr('disabled', true);
var title = this.$('#response-title').val(),
body = this.$('#response-body').val(),
Function initRecommended
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
initRecommended: function() {
var _this = this;
this.recommendedCivis = [];
this.otherCivis = [];
this.civiRecViewTotals = {problem : 0,cause: 0,solution: 0};
Function editThread
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
editThread: function (e) {
var _this = this;
_this.$(e.currentTarget).addClass('disabled').attr('disabled', true);
var title = this.$el.find('#thread-title').val().trim();
- 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 success
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
success: function (response) {
var new_civi_data = response.data;
var new_civi = new cw.CiviModel(new_civi_data);
var can_edit = new_civi.get('author').username == _this.options.parentView.username ? true : false;
Function upload_civi_image
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def upload_civi_image(request):
"""This function is used to upload an image for a Civi"""
if request.method == "POST":
r = request.POST
civi_id = r.get("civi_id")
- 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 createResponse
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
createResponse: function (e) {
var _this = this;
this.$(e.currentTarget).addClass('disabled').attr('disabled', true);
var title = this.$('#response-title').val(),
body = this.$('#response-body').val(),
- 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 score
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def score(self, requested_user_id=None):
# TODO: add docstring comment describing this score function
# in relatively plain English
# include descriptions of all variables
- 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 renderCivis
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderCivis: function () {
this.$('#thread-problems').empty();
this.$('#thread-causes').empty();
this.$('#thread-solutions').empty();