Showing 52 of 127 total issues
File Map.js
has 555 lines of code (exceeds 250 allowed). Consider refactoring. Open
MapKnitter.Map = MapKnitter.Class.extend({
initialize: function (options) {
this._zoom = options.zoom || 0;
this._latlng = L.latLng(options.latlng);
File knitter.js
has 349 lines of code (exceeds 250 allowed). Consider refactoring. Open
// Legacy!
jQuery(document).ready(function($) {
var Knitter = {
// start storing a layer_type and layer_url in Map model, use it to switch this:
openlayers_on: false,
Class Map
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class Map < ApplicationRecord
include ActiveModel::Validations
extend FriendlyId
friendly_id :name, use: %i(slugged static)
Function initialize
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
initialize: function (options) {
this._zoom = options.zoom || 0;
this._latlng = L.latLng(options.latlng);
this.map_id = options.map_id || 0;
this.readOnly = options.readOnly;
Function start_openlayers
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
start_openlayers: function(layer,tile_url,tile_layer) {
if (layer == "none") $('map').hide()
else $('map').show()
if (!Knitter.openlayers_on) Knitter.init_openlayers(layer)
// http://isse.cr.usgs.gov/ArcGIS/services/Combined/TNM_Large_Scale_Imagery/MapServer/WMSServer?request=GetCapabilities&service=WMS
Method openid_authentication
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def openid_authentication(openid_url, back_to)
# puts openid_url
authenticate_with_open_id(openid_url, required: %i(nickname email fullname)) do |result, identity_url, registration|
dummy_identity_url = identity_url
dummy_identity_url = dummy_identity_url.split('/')
- 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 geocodeImage
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
geocodeImage: function (img, fn, id) {
EXIF.getData(img, function () {
var GPS = EXIF.getAllTags(img);
/* If the lat/lng is available. */
- 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 exports
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(grunt) {
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
Function setupCollection
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
setupCollection: function() {
map._imgGroup = L.distortableCollection({
editable: !mapknitter.readOnly,
exportOpts: {
Function synchronizeNewAddedImage
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
synchronizeNewAddedImage: function(warpable) {
var wn = warpable.nodes;
var bounds = [];
// only already-placed images:
Method collect_ways
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def self.collect_ways(features)
# collected_ways variable unused review this function
collected_ways = []
nodes = {}
features['osm']['node'].each do |node|
- 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
Map
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
MapKnitter.Map = MapKnitter.Class.extend({
initialize: function (options) {
this._zoom = options.zoom || 0;
this._latlng = L.latLng(options.latlng);
Class MapsController
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class MapsController < ApplicationController
protect_from_forgery except: :export
before_action :require_login, only: %i(update destroy)
before_action :require_login_or_anon, only: %i(edit)
File map.rb
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Map < ApplicationRecord
include ActiveModel::Validations
extend FriendlyId
friendly_id :name, use: %i(slugged static)
Method openid_authentication
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def openid_authentication(openid_url, back_to)
# puts openid_url
authenticate_with_open_id(openid_url, required: %i(nickname email fullname)) do |result, identity_url, registration|
dummy_identity_url = identity_url
dummy_identity_url = dummy_identity_url.split('/')
Method average_cm_per_pixel
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def average_cm_per_pixel
if !warpables.empty?
scales = []
count = 0
average = 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 best_cm_per_pixel
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def best_cm_per_pixel
hist = images_histogram
scores = []
(0..(hist.length - 1)).each do |i|
scores[i] = 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 setupGeocode
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
setupGeocode: function (e) {
var img = e.layer,
geo = img.geocoding;
L.DomEvent.on(img._image, 'load', function () {
Function geocodeImage
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
geocodeImage: function (img, fn, id) {
EXIF.getData(img, function () {
var GPS = EXIF.getAllTags(img);
/* If the lat/lng is available. */
Function find_map_center
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
find_map_center: function() {
if (warpables.length > 0) {
var latsum = 0, lonsum = 0, latcount = 0, loncount = 0
var maxlat = 0,maxlon = 0,minlat = 0,minlon = 0
warpables.each(function(warpable){