Showing 84 of 154 total issues
Function inclusion
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
inclusion: function(element, options) {
var lower, message, option, upper, _ref;
message = this.presence(element, options);
if (message) {
if (options.allow_blank === true) {
Method show
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
@user = user_signed_in? ? current_user : User.new
if params[:code]
confirmed_question = Question.where(id: params[:id])
.where(confirm_code: params[:code]).first
Function exclusion
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
exclusion: function(element, options) {
var lower, message, option, upper, _ref;
message = this.presence(element, options);
if (message) {
if (options.allow_blank === true) {
Method set_candidates_if_referring_partner
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def set_candidates_if_referring_partner
return unless @has_partner
extra_state_candidates = []
people_collections.each do |name, ids|
- 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 cdn_image_tag
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def cdn_image_tag(url, opts = {})
if opts[:size]
width, height = opts[:size].split('x')
else
width, height = opts[:width], opts[:height]
- 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 most_recent
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def most_recent(attribute)
if read_attribute(attribute)
read_attribute(attribute)
else
read_attribute(:old_roles).to_a.reverse.each do |_, roles|
- 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 length
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
length: function(element, options) {
var CHECKS, blankOptions, check, fn, message, operator, tokenized_length, tokenizer;
tokenizer = options.js_tokenizer || "split('')";
tokenized_length = new Function('element', "return (element.val()." + tokenizer + " || '').length")(element);
CHECKS = {
Function uniqueness
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
uniqueness: function(element, options) {
var form, matches, name, name_prefix, name_suffix, valid, value;
name = element.attr('name');
if (/_attributes\]\[\d/.test(name)) {
matches = name.match(/^(.+_attributes\])\[\d+\](.+)$/);
Function addMetaTags
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addMetaTags(tagId, options) {
this._createMetaTag = function(name, content) {
var metaTag = jQuery("<meta>", {
name: name,
content: content
Function addMetaTags
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addMetaTags(tagId, options) {
this._createMetaTag = function(name, content) {
var metaTag = jQuery("<meta>", {
name: name,
content: content
Function addMetaTags
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addMetaTags(tagId, options) {
this._createMetaTag = function(name, content) {
var metaTag = jQuery("<meta>", {
name: name,
content: content
Method match_to_person
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def match_to_person
if person_id.present?
add_attributes_to(person)
return person
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 run
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def run(twitter_user)
data = twitter_user.as_json
data.each do |key, value|
case 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"
Further reading
Method person_match_official?
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def person_match_official?(person, official)
return false unless district_or_office_for(person) ==
pvs_district_or_office_for(official)
return false unless NameComparison.new(comparable_family_name_for(person),
- 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 set_attributes_based_on_partner
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def set_attributes_based_on_partner
return unless referring_partner_info.present?
return if persisted?
self.password = Devise.friendly_token.first(6)
- 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 tab
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def tab(tab)
@governor = Governor.connected_to(@jurisdiction.abbreviation).active.first
@mayor = Mayor.connected_to(@jurisdiction.abbreviation).active.first ||
Councilmember.connected_to(@jurisdiction.abbreviation).active
.where(district: "Mayor").first
- 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
Avoid deeply nested control flow statements. Open
if ($(this).data('notLocallyUnique')) {
return $(this).removeData('notLocallyUnique').data('changed', true);
}
Method show
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def show
@blurb = Blurb.active.where(target_url: person_path(parent, resource)).first
@questions = resource.questions.in(needs_confirmation: [nil, false])
.includes(:user).desc(:created_at).page(params[:page])
tab "questions"
- 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 officials_by_state_and_office
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def officials_by_state_and_office(state_id, office_ids)
office_ids.each_with_index do |office_id, index|
begin
state_id = state_id == 'us' ? 'NA' : state_id.upcase
return get('Officials.getByOfficeState',
- 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 perform
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def perform(id)
question = Question.find(id)
user = question.user
if user && question.coordinates.blank?
- 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"