Showing 572 of 572 total issues
Function WorkerTransport_setupMessageHandler
has 205 lines of code (exceeds 25 allowed). Consider refactoring. Open
function WorkerTransport_setupMessageHandler(messageHandler) {
this.messageHandler = messageHandler;
function updatePassword(password) {
messageHandler.send('UpdatePassword', password);
Function get_watchlist_function
has 192 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_watchlist_function(){
var pending_instances = {}
var contacted_instances = {}
var resolved_instances = {}
Function PDFPageProxyClosure
has 190 lines of code (exceeds 25 allowed). Consider refactoring. Open
var PDFPageProxy = (function PDFPageProxyClosure() {
function PDFPageProxy(pageIndex, pageInfo, transport) {
this.pageIndex = pageIndex;
this.pageInfo = pageInfo;
this.transport = transport;
Function AnnotationUtilsClosure
has 182 lines of code (exceeds 25 allowed). Consider refactoring. Open
var AnnotationUtils = (function AnnotationUtilsClosure() {
// TODO(mack): This dupes some of the logic in CanvasGraphics.setFont()
function setTextStyles(element, item, fontObj) {
var style = element.style;
Method local_submit
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
def local_submit
@user = User.find_by(email: params[:user])
@cud = @user ? @course.course_user_data.find_by(user_id: @user.id) : nil
unless @cud
err = "ERROR: invalid username (#{params[:user]}) for class #{@course.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
File materialize-autocomplete.js
has 459 lines of code (exceeds 250 allowed). Consider refactoring. Open
(function (root, factory) {
if(typeof module === 'object' && module.exports) {
module.exports = factory(require('jquery'));
} else if(typeof define === 'function' && define.amd) {
Similar blocks of code found in 2 locations. Consider refactoring. Open
$.ajax({
url:metrics_config_endpoints['update'],
dataType: "json",
contentType:'application/json',
data: JSON.stringify(new_data),
- 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 170.
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
$.ajax({
url: metrics_endpoints['update'],
dataType: "json",
contentType:'application/json',
data: JSON.stringify(new_conditions),
- 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 170.
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 add
has 162 lines of code (exceeds 25 allowed). Consider refactoring. Open
'add': function(shortcut_combination,callback,opt) {
//Provide a set of default options
var default_options = {
'type':'keydown',
'propagate':false,
Function convertImgDataToPngClosure
has 161 lines of code (exceeds 25 allowed). Consider refactoring. Open
var convertImgDataToPng = (function convertImgDataToPngClosure() {
var PNG_HEADER =
new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
var CHUNK_WRAPPER_SIZE = 12;
Function setupColumnResize
has 160 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setupColumnResize() {
var $col, j, c, pageX, columnElements, minPageX, maxPageX, firstResizable, lastResizable;
columnElements = $headers.children();
columnElements.find(".slick-resizable-handle").remove();
columnElements.each(function (i, e) {
Function brushing
has 157 lines of code (exceeds 25 allowed). Consider refactoring. Open
function brushing() {
var chartContext = this;
args = this.args;
Function UtilClosure
has 150 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Util = PDFJS.Util = (function UtilClosure() {
function Util() {}
var rgbBuf = ['rgb(', 0, ',', 0, ',', 0, ')'];
File jquery.simplemodal-1.4.4.js
has 411 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* SimpleModal 1.4.4 - jQuery Plugin
* http://simplemodal.com/
* Copyright (c) 2013 Eric Martin
* Licensed under MIT and GPL
Function createMeshCanvasClosure
has 146 lines of code (exceeds 25 allowed). Consider refactoring. Open
var createMeshCanvas = (function createMeshCanvasClosure() {
function drawTriangle(data, context, p1, p2, p3, c1, c2, c3) {
// Very basic Gouraud-shaded triangle rasterization algorithm.
var coords = context.coords, colors = context.colors;
var bytes = data.data, rowSize = data.width * 4;
File assessment_autograde_core.rb
has 399 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "uri"
require "tango_client"
require_relative Rails.root.join("config", "autogradeConfig.rb")
module AssessmentAutogradeCore
Function SVGGraphics_executeOpTree
has 139 lines of code (exceeds 25 allowed). Consider refactoring. Open
executeOpTree: function SVGGraphics_executeOpTree(opTree) {
var opTreeLen = opTree.length;
for(var x = 0; x < opTreeLen; x++) {
var fn = opTree[x].fn;
var fnId = opTree[x].fnId;
Function HeaderMenu
has 138 lines of code (exceeds 25 allowed). Consider refactoring. Open
function HeaderMenu(options) {
var _grid;
var _self = this;
var _handler = new Slick.EventHandler();
var _defaults = {
Function initialize
has 137 lines of code (exceeds 25 allowed). Consider refactoring. Open
initialize: function () {
var self = this;
var timer;
var fetching = false;
Method getjob
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def getjob
# Make sure we have a job id parameter
if !params[:id]
flash[:error] = "Error: missing job ID parameter in URL"
redirect_to(controller: "jobs", item: nil) && return
- 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"