Showing 23 of 23 total issues
Function dropdown
has 188 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.dropdown = function (options) {
var defaults = {
inDuration: 300,
outDuration: 225,
constrain_width: false, // Does not change width of dropdown to that of the activator
Method import_events
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def import_events
puts "Importing events"
Geocoder.configure(lookup: :yandex)
use_old_db
- 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 placeDropdown
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
function placeDropdown(eventType) {
// Check for simultaneous focus and click events.
if (eventType === 'focus') {
isFocused = true;
}
Identical blocks of code found in 2 locations. Consider refactoring. Open
xhr: function () { // Custom XMLHttpRequest
var myXhr = $.ajaxSettings.xhr();
if (myXhr.upload) { // Check if upload property exists
myXhr.upload.addEventListener('progress', function progressHandlingFunction() {
}, false); // For handling the progress of the upload
- 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 72.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
xhr: function () { // Custom XMLHttpRequest
var myXhr = $.ajaxSettings.xhr();
if (myXhr.upload) { // Check if upload property exists
myXhr.upload.addEventListener('progress', function progressHandlingFunction() {
}, false); // For handling the progress of the upload
- 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 72.
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 imageImport
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
var imageImport = (function () {
// Import image to Canvas when $setImage input changed
var importImage = function ($croppedModalImage, $imageInput, $modal) {
var files = $imageInput[0].files;
var file;
- 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
Method import_events
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import_events
puts "Importing events"
Geocoder.configure(lookup: :yandex)
use_old_db
Function autocomplete
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.autocomplete = function (options) {
var $container,
_data = [],
self = this.filter('input');
Function imageImport
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
var imageImport = (function () {
// Import image to Canvas when $setImage input changed
var importImage = function ($croppedModalImage, $imageInput, $modal) {
var files = $imageInput[0].files;
var file;
Function bindGeocoder
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function bindGeocoder() {
function addressValue() {
return $placeAddress.val();
}
Function cropper
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
var cropper = (function () {
var createCropper = function ($croppedModalImage, $currentImage, $form, onCropperCreated) {
$croppedModalImage.cropper({
background: false,
Method all_providers
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def all_providers
{
facebook: {
name: t("socials.facebook"),
class: "fa fa-facebook",
Method import_social_accounts
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def import_social_accounts
puts "Importing social accounts"
use_old_db
social_accounts = ActiveRecord::Base.connection.execute("SELECT * FROM authentications")
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (!activates.is(e.target) && !origin.is(e.target) && (!origin.find(e.target).length)) {
hideDropdown();
$(document).unbind('click.' + activates.attr('id') + ' touchstart.' + activates.attr('id'));
}
- 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 53.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
else if (origin.hasClass('active')) {
hideDropdown();
$(document).unbind('click.' + activates.attr('id') + ' touchstart.' + activates.attr('id'));
}
- 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 53.
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 initCropper
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
initCropper: function($croppedModalImage, $imageInput, $modal, $uploadImage, $imageForm, $currentImage) {
Method build_permalink
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build_permalink
target_field_value = send(permalink_configuration[:target_field])
return if permalink.present? || target_field_value.blank?
permalink_base = I18n.transliterate(target_field_value).parameterize.downcase
- 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 swing
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
swing: function (x, t, b, c, d) {
Function easeOutQuad
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
easeOutQuad: function (x, t, b, c, d) {
Function easeOutCubic
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
easeOutCubic: function (x, t, b, c, d) {