Showing 29 of 37 total issues
Function addDigit
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Odometer.prototype.addDigit = function(value, repeating) {
var chr, digit, resetted, _ref;
if (repeating == null) {
repeating = true;
}
Function option
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
option: function( key, value ) {
var options = key,
parts,
curOption,
i;
Function animateCount
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Odometer.prototype.animateCount = function(newValue) {
var cur, diff, last, start, tick,
_this = this;
if (!(diff = +newValue - this.value)) {
return;
Function _createWidget
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
_createWidget: function( options, element ) {
element = $( element || this.defaultElement || this )[ 0 ];
this.element = $( element );
this.uuid = uuid++;
this.eventNamespace = "." + this.widgetName + this.uuid;
Function processLine
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def processLine(line):
if (
line.startswith("PRAGMA") or
line.startswith("BEGIN TRANSACTION;") or
line.startswith("COMMIT;") or
- 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 compose_mail
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def compose_mail(post, opts = {})
fail ArgumentError.new('post missing') unless post.present?
fail ArgumentError.new('user missing') unless opts[:user].present? && opts[:user].is_a?(User)
fail ArgumentError.new('to missing') unless opts[:to].present?
fail ArgumentError.new('to mail format invalid') unless ValidatesEmailFormatOf.validate_email_format(opts[:to]).nil?
- 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 file_receiver
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def file_receiver
s3_uploader = S3Uploader.new(bucket: "#{Settings.s3.bucket_name}/1/#{current_user.id}")
s3_files = []
- 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 (!paramNameSlice.length) {
paramNameSlice = paramName;
}
Method watch!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def watch!(hash)
if hash[:post]
watching_posts << hash[:post] unless watching_posts.include?(hash[:post])
elsif hash[:tag]
fail 'Not Implemented.'
- 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"