Showing 342 of 342 total issues
Function Location
has 164 lines of code (exceeds 25 allowed). Consider refactoring. Open
Spontaneous.Location = (function($, S) {
var ajax = S.Ajax;
var State = new JS.Class({
initialize: function(path) {
Class Format
has 45 methods (exceeds 20 allowed). Consider refactoring. Open
class Format
module ClassMethods
# class_attribute :template_engine
def inherited(subclass)
Class Schema
has 45 methods (exceeds 20 allowed). Consider refactoring. Open
class Schema
attr_accessor :schema_loader_class
attr_reader :uids
attr_reader :site
Function Ajax
has 150 lines of code (exceeds 25 allowed). Consider refactoring. Open
Spontaneous.Ajax = (function($, S) {
'use strict';
$.ajaxSetup({
'async': true,
File page_view.js
has 415 lines of code (exceeds 250 allowed). Consider refactoring. Open
// console.log('Loading Page...')
Spontaneous.Views.PageView = (function($, S, document) {
var dom = S.Dom, user = S.User, ajax = S.Ajax, Types = S.Types;
File publish.js
has 410 lines of code (exceeds 250 allowed). Consider refactoring. Open
// console.log('Loading Publishing...')
Spontaneous.Publishing = (function($, S) {
var dom = S.Dom, Dialogue = Spontaneous.Dialogue, User = S.User;
Class Dataset
has 43 methods (exceeds 20 allowed). Consider refactoring. Open
class Dataset
include Enumerable
def initialize(dataset, schema, identity_map)
@dataset, @schema, @identity_map = dataset, schema, identity_map
Class Revision
has 43 methods (exceeds 20 allowed). Consider refactoring. Open
class Revision
class InvalidRevision < Spontaneous::Error; end
class Generator
attr_reader :modified_pages
Function Properties
has a Cognitive Complexity of 38 (exceeds 5 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 = {}; }
- 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 PieceView
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
Spontaneous.Views.PieceView = (function($, S) {
var dom = S.Dom, user = S.User;
var debug = 0;
var ConfirmDeletePopup = new JS.Class(Spontaneous.PopoverView, {
- 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 Views
has 142 lines of code (exceeds 25 allowed). Consider refactoring. Open
Spontaneous.Views = (function($, S) {
var dom = S.Dom;
var View = new JS.Class({
include: Spontaneous.Properties,
initialize: function(content) {
Function PageBrowser
has 141 lines of code (exceeds 25 allowed). Consider refactoring. Open
Spontaneous.PageBrowser = (function($, S) {
var dom = S.Dom
, flattenPageList = function(pageList) {
var pages = []
, comparator = function(a, b) {
Function File
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
Spontaneous.Field.File = (function($, S) {
var dom = S.Dom;
var FileField = new JS.Class(Spontaneous.Field.String, {
selected_files: false,
- 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
fit_dimensions_inverse: function(width, height) {
var ratio = 1.0;
if (this.is_portrait()) {
if (this.width() > width) {
ratio = width/this.width();
- 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 145.
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
fit_dimensions: function(width, height) {
var ratio = 1.0;
if (this.is_landscape()) {
if (this.width() > width) {
ratio = width/this.width();
- 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 145.
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 Location
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
Spontaneous.Location = (function($, S) {
var ajax = S.Ajax;
var State = new JS.Class({
initialize: function(path) {
- 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 Box
has 130 lines of code (exceeds 25 allowed). Consider refactoring. Open
Spontaneous.Box = (function($, S) {
var dom = S.Dom;
var Box = new JS.Class(Spontaneous.Content, {
Function Ajax
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
Spontaneous.Ajax = (function($, S) {
'use strict';
$.ajaxSetup({
'async': true,
- 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 sync_to_revision
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def sync_to_revision(revision, origin=false)
# 'publish' is a lock to make sure the duplication doesn't cross
# page boundaries unless that's necessary (such as in the case
# of a page addition)
publish = origin || !page?
- 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
File box.rb
has 373 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Spontaneous
class Box
include Enumerable
include Spontaneous::Model::Core::SchemaHierarchy