Showing 20 of 40 total issues
Function initFilters
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
var initFilters = function() {
var searchFilterCheckboxes = $('[data-filter-checkbox]');
var daterange = $('input[name="daterange"]');
var searchForm = $('form.search-remote-form');
var loadPanel = $('#ajax-loader__panel');
Function render
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function() {
var icon = '';
var content = '';
if (this.props.json.status === 'ok') {
Function render
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function() {
var content = "";
switch(this.state.step) {
case 'unauthorized':
Function render
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function() {
return (
<div>
<div className="form-box__title">
<div className="row">
Method build_current_url
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def build_current_url
return @current_url unless @params.any?
base = @current_url.split('?')[0]
- 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 componentDidMount
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
componentDidMount: function() {
var _this = this;
var select = null;
if (this.props.autocompletePath) {
Method set_published_at
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def set_published_at
if respond_to?(:published_at) && !published_at
if defined?(metadata) && metadata && metadata['date']
begin
self.published_at = Date.parse(metadata['date'])
- 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 create
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def create
if policy(list).update?
if valid_type? && item
list_item.list = list
list_item.item = item
- 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 componentDidMount
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
componentDidMount: function() {
var _this = this;
var select = null;
if (this.props.autocompletePath) {
- 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 data
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def data
if @resource.respond_to?(:each)
@resource.map do |c|
type = @override_type ? resource_type(c) : @type.pluralize
{ type: type, id: pid(c) }
- 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 initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(url, resource, presenter_module = nil, prefix = nil, fields = nil)
Method write
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def write(attributes)
@attributes = attributes
unless @attributes.is_a? Hash
ap 'Error: given attributes were not provided as 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 initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(current_url, params, total, collection)
@current_url = current_url
@params = params
@total = total
@collection = collection
- 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 included_data
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def included_data(resource, hash)
@presenter.relationships.each do |rel|
next unless @includes.include?(rel.to_s)
associated_resource = resource.send(rel)
- 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 run_if_public
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def run_if_public
if respond_to?(:priv?) && priv?
if previous_changes.keys.include?('privacy')
RemoveFromIndexJob.perform_async(self.class.name, id)
end
- 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 shared_update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def shared_update(success, failure)
authorize @user
if skip_password_update?
user_params = user_password_params.except(:current_password,
- 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 owner
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def owner
return current_user unless list_params[:owner_id] && list_params[:owner_type]
return current_user unless %w(Network User).include?(list_params[:owner_type])
list_params[:owner_type].constantize.find(list_params[:owner_id]) || current_user
end
- 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 build
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def build
return @es_params if @sort.blank?
@attributes.each do |attribute|
dir = if attribute[0] == '-'
- 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 format_records
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def format_records
return [] unless es_records['suggest'] && es_records['suggest']['list_suggest'].any?
formatted_records = es_records['suggest']['list_suggest'].first['options'].map do |l|
{ id: l['_source']['id'], name: l['_source']['name'] }
- 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 fields
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def fields
return @presenter.attributes unless @presenter.fields
return @presenter.attributes unless @presenter.fields[@presenter.type.pluralize]
model_fields = @presenter.fields[@presenter.type.pluralize].split(',').map(&:to_sym)
- 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"