Showing 2,136 of 2,138 total issues
Function getGradientMetrics
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
getGradientMetrics: function( el, width, height, gradientInfo ) {
var angle = gradientInfo.angle,
startPos = gradientInfo.gradientStart,
startX, startY,
endX, endY,
Method create
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
# PUNDIT_REVIEW_AUTHORIZE
# PUNDIT_CHECK_AUTHORIZE
# authorize Portal::Clazz
Method up
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.up
create_table :calibrations do |t|
t.integer :data_filter_id
t.integer :probe_type_id
t.boolean :default_calibration
Function matcherFromGroupMatchers
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
var bySet = setMatchers.length > 0,
byElement = elementMatchers.length > 0,
superMatcher = function( seed, context, xml, results, expandContext ) {
var elem, j, matcher,
Function dropdown_for
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
var dropdown_for = function(dropDownLinkId,dropDownMenuId) {
var dropDownLink = $(dropDownLinkId);
var dropDownMenu = $(dropDownMenuId);
var dropDownLink_width = dropDownLink.getDimensions().width;
var dropDownMenu_width = dropDownMenu.getDimensions().width;
Function render
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { signupText, oauthProviders, anonymous, omniauthOrigin } = this.props;
const { userType, basicData, studentData, teacherData } = this.state;
let form;
Function Enumerable
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
var Enumerable = (function() {
function each(iterator, context) {
try {
this._each(iterator, context);
} catch (e) {
- 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 drawGrid
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
drawGrid: function(){
var v, o = this.options,
ctx = this.ctx;
if(o.grid.verticalLines || o.grid.horizontalLines){
this.el.fire('flotr:beforegrid', [this.axes.x, this.axes.y, o, this]);
- 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 drawGrid
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
drawGrid: function(){
var v, o = this.options,
ctx = this.ctx;
if(o.grid.verticalLines || o.grid.horizontalLines){
this.el.fire('flotr:beforegrid', [this.axes.x, this.axes.y, o, this]);
- 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 handleKeyDown
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
handleKeyDown (e: any) {
let handledKey = false;
const { query, suggestions, selectedSuggestionIndex, showSuggestions } = this.state;
const { onChange, onSubmit } = this.props;
const suggestion = suggestions[selectedSuggestionIndex];
- 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 renderNavLinks
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
renderNavLinks (e: any) {
const headerItems = [];
let key = 1;
const nextKey = (prefix: any) => `navLink_${prefix}_${key++}`;
if (!this.state.isStudent) {
- 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 renderLinks
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
renderLinks () {
const { resource } = this.props;
const isCollection = resource.material_type === "Collection";
const isAssignWrapped = window.self !== window.top &&
window.self.location.hostname === window.top?.location.hostname;
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (
scrollTop > window.innerHeight / 2 &&
!this.state.searching &&
this.state.resources.length !== 0 &&
!(this.state.displayLimit >= this.state.numTotalResources)
- 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 90.
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
if (
scrollTop > window.innerHeight / 3 &&
!this.state.searching &&
this.state.resources.length !== 0 &&
!(this.state.displayLimit >= this.state.numTotalResources)
- 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 90.
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 matcherFromGroupMatchers
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
var bySet = setMatchers.length > 0,
byElement = elementMatchers.length > 0,
superMatcher = function( seed, context, xml, results, outermost ) {
var elem, j, matcher,
Function Grow
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Effect.Grow = function(element) {
element = $(element);
var options = Object.extend({
direction: 'center',
moveTransition: Effect.Transitions.sinoidal,
Method query
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
def query(options, user)
results = {}
scopes = {
Method create_default_clazzes
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.create_default_clazzes
# this method creates default classes,
# teacher class mapping
# student class mapping
File teacher_form.tsx
has 280 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from "react";
import Formsy from "formsy-react";
import TextInput from "./text_input";
import CheckboxInput from "./checkbox_input";
Identical blocks of code found in 2 locations. Consider refactoring. Open
document.whenReady(function() {
if ($('log')) UI.logger = new UI.ElementLogger('log');
else if (window.console) UI.logger = new UI.ConsoleLogger();
else UI.logger = new UI.MemLogger();
});
- 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 89.
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