Showing 342 of 342 total issues
File base.rb
has 370 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Spontaneous
module Field
class Base
module ClassMethods
def has_editor(js_class = ui_class)
Class Fog
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
class Fog < Backend
def initialize(config)
@config = config
end
Function ContentArea
has 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
Spontaneous.ContentArea = (function($, S) {
var dom = S.Dom;
var ContentArea = new JS.Singleton({
include: Spontaneous.Properties,
Function edit
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
edit: function() {
var wrap = dom.div(),
drop_wrap = dom.div({'style':'position:relative;'}),
value = this.currentEditValue(),
src = value.src,
File image.js
has 353 lines of code (exceeds 250 allowed). Consider refactoring. Open
// console.log('Loading ImageField...')
Spontaneous.Field.Image = (function($, S) {
'use strict';
var dom = S.Dom;
var ImageFieldConflictView = new JS.Class(S.Field.String.ConflictView, {
Class BoxPrototype
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class BoxPrototype
attr_reader :name, :options, :owner
def initialize(owner, name, options, blocks = [], &block)
Class User
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class User < Sequel::Model(:spontaneous_users)
extend Forwardable
plugin :timestamps
File box_view.js
has 347 lines of code (exceeds 250 allowed). Consider refactoring. Open
// console.log('Loading BoxView...')
Spontaneous.Views.BoxView = (function($, S) {
'use strict';
var dom = S.Dom;
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (_window.createBlobURL) {
_window.URL[createObjectURL] = function(file) {
return _window.createBlobURL(file);
};
} else if (_window[createObjectURL]) {
- 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 121.
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 (_window.revokeBlobURL) {
_window.URL[revokeObjectURL] = function(file) {
return _window.revokeBlobURL(file);
};
} else if (_window[revokeObjectURL]) {
- 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 121.
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
File schema.rb
has 341 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Spontaneous
module Schema
autoload :UID, 'spontaneous/schema/uid'
autoload :UIDMap, 'spontaneous/schema/uid_map'
autoload :SchemaModification, 'spontaneous/schema/schema_modification'
Method schema_validate
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def schema_validate(schema)
if schema_id.nil?
schema.missing_id!(:type, self)
else
# only need to check internal consistency if class already existed
- 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 Properties
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
Spontaneous.Properties = (function($, S) {
var Properties = new JS.Module({
_props_debug: false,
_props_properties: function() {
if (!this._props_property_store) { this._props_property_store = {}; }
Similar blocks of code found in 2 locations. Consider refactoring. Open
currentEditValue: function() {
var value, pending, ui, v = this.get('value');
if ((pending = v.__pending__)) {
return pending.value;
}
- 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 115.
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
currentEditValue: function() {
var value, pending, ui, v = this.get('value');
if ((pending = v.__pending__)) {
return pending.value;
}
- 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 115.
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 Popover
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
Spontaneous.Popover = (function($, S) {
var dom = S.Dom;
var __popover_id = 0;
var Popover = new JS.Class({
initialize: function(view) {
Function Types
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
Spontaneous.Types = (function($, S) {
var ajax = S.Ajax
, user = S.User
, type_map = {};
Function ShardedUpload
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
Spontaneous.ShardedUpload = (function($, S) {
var dom = S.Dom;
var upload_id = (new Date()).valueOf();
var Shard = new JS.Class({
initialize: function(uploader, index, blob) {
- 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 Dom
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
Spontaneous.Dom = (function($, S) {
var tags = 'div p iframe a span strong i img select option label ul li dl dt dd table tr td h1 h2 h3 h4 header input button form textarea optgroup'.split(' ');
var Dom = {
body: function() {
return $(document.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 Image
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
Spontaneous.Image = (function($, S) {
var dom = Spontaneous.Dom;
var Image = new JS.Class({
initialize: function(field) {
this.field = field;
- 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"