Showing 436 of 436 total issues
Function add
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
add: function (parent) {
var renderer = this.renderer,
parentWrapper = parent || renderer,
parentNode = parentWrapper.element || renderer.box,
Function drawLegendSymbol
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
drawLegendSymbol: function (legend) {
var options = this.options,
markerOptions = options.marker,
radius,
Function verifyDataLabelOverflow
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
verifyDataLabelOverflow: function (overflow) {
var center = this.center,
options = this.options,
centerOption = options.center,
Function positionDropdown
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
positionDropdown: function() {
var offset = this.container.offset(),
height = this.container.outerHeight(),
width = this.container.outerWidth(),
dropHeight = this.dropdown.outerHeight(),
Method graph_values
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def graph_values(current_user)
categories = []
mapping_values = []
if ['numeric', 'integer', 'date', 'choices'].include?(self.variable_type)
Function getBBox
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
getBBox: function () {
var wrapper = this,
bBox = wrapper.bBox,
renderer = wrapper.renderer,
width,
Function getExtremes
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
getExtremes: function () {
var xAxis = this.xAxis,
yAxis = this.yAxis,
xData = this.processedXData,
yData = this.stackedYData || this.processedYData,
Function shadow
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
shadow: function (shadowOptions, group, cutOff) {
var shadows = [],
i,
shadow,
element = this.element,
Function getSegmentPath
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
getSegmentPath: function (segment) {
var series = this,
segmentPath = [],
step = series.options.step;
Function clipRect
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
clipRect: function (x, y, width, height) {
// create a dummy element
var clipRect = this.createElement(),
isObj = isObject(x);
Function local
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function local(options) {
var data = options, // data elements
dataText,
text = function (item) { return ""+item.text; }; // function used to retrieve the text portion of a data item that is matched against the search
Method set_values
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_values
all_sources.each do |source|
wrapper = Aqueduct::Builder.wrapper(source, @current_user)
mappings_for_select_clause = []
Function scanValues
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
scanValues: function () {
var values = this.values,
valcount = values.length,
xvalues = this.xvalues,
yvalues = this.yvalues,
Function translate
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
translate: function (val, backwards, cvsCoord, old, handleLog, pointPlacement) {
var axis = this,
axisLength = axis.len,
sign = 1,
cvsOffset = 0,
Function alignDataLabel
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
alignDataLabel: function (point, dataLabel, options, alignTo, isNew) {
var chart = this.chart,
inverted = chart.inverted,
plotX = pick(point.plotX, -999),
plotY = pick(point.plotY, -999),
Function render
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function (fieldset, lookups, options) {
var self = this,
fields = fieldset,
match, token, lookupkey, fieldvalue, prec;
return this.format.replace(this.fre, function () {
Similar blocks of code found in 2 locations. Consider refactoring. Open
var token_list = $("<ul />")
.addClass(settings.classes.tokenList)
.click(function (event) {
var li = $(event.target).closest("li");
if(li && li.get(0) && $.data(li.get(0), "tokeninput")) {
- 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 65.
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 setVisible
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
setVisible: function (vis, redraw) {
var series = this,
chart = series.chart,
legendItem = series.legendItem,
showOrHide,
Function destroy
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
destroy: function () {
var wrapper = this,
element = wrapper.element || {},
shadows = wrapper.shadows,
parentToClean = wrapper.renderer.isSVG && element.nodeName === 'SPAN' && wrapper.parentGroup,
Function populate_dropdown
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function populate_dropdown (query, results) {
if(results && results.length) {
dropdown.empty();
var dropdown_ul = $("<ul>")
.appendTo(dropdown)