Showing 66 of 97 total issues
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+\](.+)$/);
Method find
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.find(ids) # can accept an array of ids or a single id or a string of ids separated by commas
param = ids.class == Array ? ids.join(",") : ids
uri = URI.parse("https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=pubmed&id=#{param}")
response = Net::HTTP.get_response(uri)
Function get_url
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_url(self):
if self.words is None and self.words_some is None \
and self.words_none is None and self.phrase is None \
and self.author is None and self.pub is None \
and self.timeframe[0] is None and self.timeframe[1] is None:
- 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 empty_params
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def empty_params
ep = []
self.boxes.values.each do |box|
@tool = Tool.find box['tool_id']
np = @tool.params
- 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 asset_download
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def asset_download
if params[:release_id]
release = Release.find params[:release_id]
not_found unless release
tool = release.tool
- 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 asset_delete
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def asset_delete
if params[:release_id]
release = Release.find params[:release_id]
not_found unless release
tool = release.tool
- 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(name, desc, icon='fa-file-o', tpl=:binary, reader=Reader::Reader.new)
Function _parse_globals
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _parse_globals(self):
tag = self.soup.find(name='div', attrs={'id': 'gs_ab_md'})
if tag is not None:
raw_text = tag.findAll(text=True)
# raw text is a list because the body contains <b> etc
- 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 apply_settings
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def apply_settings(self, settings):
"""
Applies settings as provided by a ScholarSettings instance.
"""
if settings is None or not settings.is_configured():
- 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 bookmark
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def bookmark
pipeline = Pipeline.find params[:id]
not_found unless pipeline
unauthorized unless pipeline.shared
unauthorized if current_user.is_guest?
- 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 rating_for_user
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def rating_for_user(rateable_obj, rating_user, dimension = nil, options = {})
@object = rateable_obj
@user = rating_user
@rating = Rate.find_by_rater_id_and_rateable_id_and_dimension(@user.id, @object.id, dimension)
stars = @rating ? @rating.stars : 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 create
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create
build_resource(sign_up_params)
if verify_rucaptcha?(resource)
resource.save
- 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 bookmark
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def bookmark
tool = Tool.find params[:id]
not_found unless tool
unauthorized unless tool.shared
unauthorized if current_user.is_guest?
- 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 too many return
statements within this function. Open
return options.message;
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return options.messages.odd;
Avoid too many return
statements within this function. Open
return options.messages.even;
Avoid too many return
statements within this function. Open
return;