Showing 10 of 10 total issues
File jquery.pjax.js
has 372 lines of code (exceeds 250 allowed). Consider refactoring. Open
// jquery.pjax.js
// copyright chris wanstrath
// https://github.com/defunkt/jquery-pjax
(function($){
Function pjax
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
function pjax(options) {
options = $.extend(true, {}, $.ajaxSettings, pjax.defaults, options)
if ($.isFunction(options.url)) {
options.url = options.url()
Function onPjaxPopstate
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function onPjaxPopstate(event) {
var state = event.state
if (state && state.container) {
var container = $(state.container)
Function success
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
options.success = function(data, status, xhr) {
var container = extractContainer(data, xhr, options)
if (!container.contents) {
locationReplace(container.url)
Function extractContainer
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function extractContainer(data, xhr, options) {
var obj = {}
// Prefer X-PJAX-URL header if it was set, otherwise fallback to
// using the original requested url.
Method truncate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def truncate(text, options={})
options[:length] ||= 30
options[:omission] ||= "..."
if text
- 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 fallbackPjax
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fallbackPjax(options) {
var url = $.isFunction(options.url) ? options.url() : options.url,
method = options.type ? options.type.toUpperCase() : 'GET'
var form = $('<form>', {
Method authenticate!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def authenticate!
return if authenticated?
unauthorized! unless authentication.provided?
bad_request! unless authentication.basic?
unauthorized! unless authenticate(*authentication.credentials)
- 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 load_config
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.load_config
current_path = File.expand_path(File.dirname(__FILE__))
custom_config_file = File.expand_path("~/.ginatra/config.yml")
default_config_file = File.expand_path("#{current_path}/../../config.yml")
- 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_struct
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_struct
keys = self.keys.sort
members = keys.map(&:to_sym)
Struct.new(*members).new(*keys.map do |key|
(self[key].kind_of? Hash) ? self[key].to_struct : self[key]
- 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"