Showing 65 of 103 total issues
Method show
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def show
@tag = Tag.find_by_slug(params[:slug]) # .friendly.find is not working here
@notes = Note.publishable.listable.blurbable.tagged_with(@tag.name)
@word_count = @notes.sum(:word_count)
@map = mapify(@notes.mappable)
- Read upRead up
- Create a ticketCreate a ticket
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 createMarker
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Gmaps4RailsGoogle.prototype.createMarker = function(args) {
var defaultOptions, imageAnchorPosition, markerImage, markerLatLng, mergedOptions, shadowAnchorPosition, shadowImage;
markerLatLng = this.createLatLng(args.Lat, args.Lng);
if (args.marker_picture === "" && args.rich_marker === null) {
defaultOptions = {
- Create a ticketCreate a ticket
Function createMarker
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Gmaps4RailsOpenlayers.prototype.createMarker = function(args) {
var marker, style_mark;
style_mark = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
style_mark.fillOpacity = 1;
if (this.markersLayer === null) {
- Create a ticketCreate a ticket
Method cut_image_binary
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cut_image_binary(id, _format, aspect_x, aspect_y, width, snap, gravity, effects)
image_record = Resource.find(id)
file_name_template = image_record.template_location(aspect_x, aspect_y)
file_name_out = image_record.cut_location(aspect_x, aspect_y, width, snap, gravity, effects)
- Create a ticketCreate a ticket
Function createServiceMarkersFromMarkers
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Gmaps4Rails.prototype.createServiceMarkersFromMarkers = function() {
var Lat, LatLng, Lng, index, marker, _len, _ref;
_ref = this.markers;
for (index = 0, _len = _ref.length; index < _len; index++) {
marker = _ref[index];
- Create a ticketCreate a ticket
Function create_polyline
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Gmaps4RailsGoogle.prototype.create_polyline = function(polyline) {
var clickable, decoded_array, element, latlng, new_poly, point, polyline_coordinates, strokeColor, strokeOpacity, strokeWeight, zIndex, _i, _j, _len, _len2;
polyline_coordinates = [];
for (_i = 0, _len = polyline.length; _i < _len; _i++) {
element = polyline[_i];
- Create a ticketCreate a ticket
Function create_polyline
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Gmaps4RailsOpenlayers.prototype.create_polyline = function(polyline) {
var clickable, element, latlng, line_points, line_style, polyline_coordinates, strokeColor, strokeOpacity, strokeWeight, zIndex, _i, _len;
if (this.polylinesLayer === null) {
this.polylinesLayer = new OpenLayers.Layer.Vector("Polylines", null);
this.serviceObject.addLayer(this.polylinesLayer);
- Create a ticketCreate a ticket
Function create_circle
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Gmaps4Rails.prototype.create_circle = function(circle) {
var newCircle;
if (circle === this.circles[0]) {
if (circle.strokeColor != null) {
this.circles_conf.strokeColor = circle.strokeColor;
- Create a ticketCreate a ticket
Method blurb
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def blurb(main_title, subtitle, clean_body, introduction = nil, blurb_length = NB.blurb_length.to_i, omission: NB.blurb_omission)
headline = subtitle.blank? ? "#{ main_title }" : "<span>#{ main_title }: </span>#{ subtitle }"
# If an introduction exists, use it
# If the title is derived from the body, do not include it in the blurb
- Read upRead up
- Create a ticketCreate a ticket
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 create_direction
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Gmaps4Rails.prototype.create_direction = function() {
var directionsDisplay, directionsService, request;
directionsDisplay = new google.maps.DirectionsRenderer();
directionsService = new google.maps.DirectionsService();
directionsDisplay.setMap(this.serviceObject);
- Create a ticketCreate a ticket
Method calculate_before
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.calculate_before(current)
return first_text if current == first_text
alphabet = self.alphabet.split('')
return alphabet.first if current.blank?
- Read upRead up
- Create a ticketCreate a ticket
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 links
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def links(book)
response = []
response.push link_to 'WorldCat', "http://www.worldcat.org/isbn/#{ book.isbn_13 }" unless book.isbn_13.blank?
response.push link_to 'GoogleBooks', "http://books.google.com/books?id=#{ book.google_books_id }" unless book.google_books_id.blank?
response.push link_to 'LibraryThing', "http://www.librarything.com/work/#{ book.library_thing_id }" unless book.library_thing_id.blank?
- Read upRead up
- Create a ticketCreate a ticket
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 createMarker
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Gmaps4RailsMapquest.prototype.createMarker = function(args) {
var icon, marker;
marker = new MQA.Poi({
lat: args.Lat,
lng: args.Lng
- Create a ticketCreate a ticket
Method initialize
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(note, sequence)
versions = note.versions
if sequence == 1
version = versions.first.reify
- Create a ticketCreate a ticket
Method calculate_after
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.calculate_after(current)
return last_text if current == last_text
alphabet = self.alphabet.split('')
alphabet_without_space = alphabet - [' ']
- Create a ticketCreate a ticket
Function create_polygon
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Gmaps4Rails.prototype.create_polygon = function(polygon) {
var clickable, fillColor, fillOpacity, latlng, new_poly, point, polygon_coordinates, strokeColor, strokeOpacity, strokeWeight, _i, _len;
polygon_coordinates = [];
for (_i = 0, _len = polygon.length; _i < _len; _i++) {
point = polygon[_i];
- Create a ticketCreate a ticket
Method cut_image_binary
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def cut_image_binary(id, _format, aspect_x, aspect_y, width, snap, gravity, effects)
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
if (point === polygon[0]) {
strokeColor = point.strokeColor || this.polygons_conf.strokeColor;
strokeOpacity = point.strokeOpacity || this.polygons_conf.strokeOpacity;
strokeWeight = point.strokeWeight || this.polygons_conf.strokeWeight;
fillColor = point.fillColor || this.polygons_conf.fillColor;
- Create a ticketCreate a ticket
Method collate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def collate(source_text, target_text, source_lang)
source_dom = Nokogiri::HTML(source_text)
source_paragraphs = source_dom.css('p')
target_dom = Nokogiri::HTML(target_text)
- Read upRead up
- Create a ticketCreate a ticket
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 dir_attr
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def dir_attr(language)
if language != I18n.locale.to_s
page_direction = NB.rtl_langs.split(/, ?| /).include?(I18n.locale.to_s) ? 'rtl' : 'ltr'
this_direction = NB.rtl_langs.split(/, ?| /).include?(language) ? 'rtl' : 'ltr'
this_direction if page_direction != this_direction
- Read upRead up
- Create a ticketCreate a ticket
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"