Showing 50 of 22,315 total issues
Function success
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
success: function (response) {
var attachment_input = _this.$('#response_attachment_image');
var uploaded_images = attachment_input[0].files;
if (_this.attachmentCount > 0) {
var formData = new FormData(_this.$('#response_attachment_image_form')[0]);
Function create_civi
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def create_civi(request):
"""
USAGE:
Use this function to insert a new connected civi into the database.
- 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 render_notifications
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
var render_notifications = function(data) {
var unreadCount = parseInt(data.unread_count);
if (unreadCount === 0) {
$('#notify-count-wrapper').addClass('hide');
$('#notify-icon').html('notifications_none').removeClass('active');
Function clickRating
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
clickRating: function (e) {
e.stopPropagation();
var _this = this;
var $this = $(e.currentTarget);
Function upload_thread_image
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def upload_thread_image(request):
"""This function is used to upload an image to a thread"""
if request.method == "POST":
r = request.POST
thread_id = r.get("thread_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 renderResponses
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderResponses: function () {
this.$('.responses-box').empty().append(this.responseWrapper());
this.newResponseView = new cw.NewResponseView({
model: this.model,
parentView: this
Function clickFavorite
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
clickFavorite: function (e) {
var _this = this;
if ($this.text() === 'star_border') {
$.ajax({
Function deleteEdit
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
deleteEdit: function(e) {
var _this = this;
e.stopPropagation();
$.ajax({
Function publishThread
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
publishThread: function(e){
var _this = this;
_this.$(e.currentTarget).addClass('disabled').attr('disabled', true);
$.ajax({
Consider simplifying this complex logical expression. Open
if (target.hasClass('btn') || target.hasClass('rating-button') || target.is('input') || target.is('textarea') || target.is('label') || target.hasClass('input') || ms_check) {
return;
}
Function clickRating
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
clickRating: function (e) {
e.stopPropagation();
var _this = this;
var $this = $(e.currentTarget);
- 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 edit_civi
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def edit_civi(request):
"""Use this function to edit an existing Civi"""
civi_id = request.POST.get("civi_id", "")
title = request.POST.get("title", "")
body = request.POST.get("body", "")
- 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 renderOutline
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
renderOutline: function(){
var _this = this;
if (this.civis.length === 0){
// render with mock data to prevent errors
var mockData = {
- 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 delete_civi
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def delete_civi(request):
"""Use this function to delete an existing Civi"""
civi_id = request.POST.get("civi_id", "")
c = Civi.objects.get(id=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 edit_thread
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def edit_thread(request):
"""Use this function to edit an existing thread"""
thread_id = request.POST.get("thread_id")
non_required_params = [
"title",
- 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
Consider simplifying this complex logical expression. Open
} else if (this.imageRemoveList.length===0 && this.attachmentCount===0 && (new_body == this.model.get('body') && new_title == this.model.get('title') && _.isEqual(links, this.model.get('links')) && new_type == this.model.get('type') )){
this.closeEdit(e);
return;
} else {
var data;
Function create_related_profile
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_related_profile(sender, instance, created, *args, **kwargs):
Function handle
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def handle(self, *app_labels, name, dry_run, merge, **options):
Function send_email
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_email(subject, message, sender, recipient_list, html_message=None):
Function get
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get(self, request, uidb64, token):
try:
uid = force_str(urlsafe_base64_decode(uidb64))
user = get_user_model().objects.get(pk=uid)
- 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"