Showing 342 of 342 total issues
Function State
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Spontaneous.State = (function($, S) {
var ajax = S.Ajax;
var ContentState = new JS.Class({
initialize: function(content) {
Function Types
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
Spontaneous.Types = (function($, S) {
var ajax = S.Ajax
, user = S.User
, type_map = {};
- 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 at_depth
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def at_depth(depth, opts = {})
return root_at_depth(depth) if is_public_root? || is_private_root?
parent_depth = [0, depth - 1].max
parent = if (parent_depth == 0)
public_root
- 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 to_html
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def to_html(opts={})
default_attr = { src: src, alt: "" }
attrs = Spontaneous::Field::Image.default_attributes.merge(opts)
if template_params && template_params.length > 0 && template_params[0].is_a?(Hash)
- 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 safe_load
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def safe_load(file, mtime=nil)
reload = mtime && mtime > mtimes[file]
logger.debug "Reloading #{relativize_path(file)}" if reload
- 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 expand_selection
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
expand_selection: function(state) {
var selected = (state.selection || ''), m, s, l, start = state.start, end = state.end, br = /\r?\n/, below = false;
// detect & deal with the cursor being on the line below
// (the one with the -'s or ='s)
// TODO: deal with the case where the cursor is at the start of the =- line
Similar blocks of code found in 2 locations. Consider refactoring. Open
find_path: function(path) {
if (this.location() && path === this.location().path) {
return this.location();
}
this.retrieve_with_progress('/map/path'+path, this.location_loaded.bind(this));
- 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 82.
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
find_id: function(id) {
if (this.location() && id === this.location().id) {
return this.location();
}
this.retrieve_with_progress('/map/'+id, this.location_loaded.bind(this));
- 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 82.
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
Class Style
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Style
attr_reader :owner, :prototype
def initialize(owner, prototype = nil)
@owner, @prototype = owner, prototype
Class Generator
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Generator
attr_reader :modified_pages
# Both revision & source_revision should be instances of Revision
def initialize(revision)
Class AllowedType
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class AllowedType
prepend Spontaneous::Model::Page::Singleton::AllowedTypeMethods
attr_accessor :allow_subclasses
Function Select
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Spontaneous.Field.Select = (function($, S) {
'use strict';
var dom = S.Dom
, ajax = S.Ajax;
File loader.rb
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'pathname'
module Spontaneous
class Loader
attr_reader :use_reloader, :load_paths
Identical blocks of code found in 2 locations. Consider refactoring. Open
for (var i = 0, ii = fields.length; i < ii; i++) {
var f = fields[i];
this.field_names.push(f.name);
this.field_prototypes[f.name] = f;
}
- 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 81.
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
for (var i = 0, ii = fields.length; i < ii; i++) {
var f = fields[i];
this.field_names.push(f.name);
this.field_prototypes[f.name] = f;
}
- 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 81.
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 PopoverView
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Spontaneous.PopoverView = (function($, S) {
var dom = S.Dom;
var PopoverView = new JS.Class({
initialize: function() {
// should be over-ridden by subclasses
Method parse_response
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def parse_response(response)
case
when response.is_a?(site.model)
@page = response
when response.respond_to?(:to_str)
- 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 ContentArea
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Spontaneous.ContentArea = (function($, S) {
var dom = S.Dom;
var ContentArea = new JS.Singleton({
include: Spontaneous.Properties,
- 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 add_allowed_types_bar
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
add_allowed_types_bar: function(position, insert_at) {
var allowed = this.box.allowed_types();
if (allowed.length === 0) { return ''; }
var _box = this
, allowed_bar = dom.div('.slot-addable')
File file.js
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
// console.log('Loading FileField...')
Spontaneous.Field.File = (function($, S) {
var dom = S.Dom;
var FileField = new JS.Class(Spontaneous.Field.String, {
selected_files: false,