Showing 8 of 12 total issues
Function routeButton
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function routeButton() {
mixpanel.track("routeButton");
if(markers[0] != undefined && markers[1] != undefined) {
getAndShowRoute();
- 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 initializeMap
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initializeMap() {
if (document.getElementById('map') === null) return;
map = L.map('map',{
// TODO change
maxBounds: coordsToLeafletBounds(maxBounds),
Function addRouteToMap
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addRouteToMap(decodedResponse) {
elev = L.control.elevation({
position: "bottomleft",
theme: "steelblue-theme", //default: lime-theme
width: 600,
Function setMarker
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setMarker(source, address, zoomIn) {
var coords = [address.lat, address.lon];
var zoom = 17;
var element = $('#'+source+'-address');
if (element.val() != address.display_name) {
Function setMarker
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function setMarker(source, address, zoomIn) {
var coords = [address.lat, address.lon];
var zoom = 17;
var element = $('#'+source+'-address');
if (element.val() != address.display_name) {
- 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 createBrokenRouteObject
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function createBrokenRouteObject(text, origin, destination, origin_point, destination_point, route) {
Function showAddressList
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function showAddressList(addresses, source) {
// if user writes something and exits the edit box, do not show the address list
var activeElement = getSelectedAddressElement();
if (source != activeElement) {
spinner.stop();
- 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 removeRoute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function removeRoute() {
if (routeLine) {
if (map.hasLayer(routeLine)) {
map.removeLayer(routeLine);
routeLine = undefined;
- 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"