Utils
has 40 functions (exceeds 20 allowed). Consider refactoring. Open
var Utils = Ember.Namespace.create({
toDataUri: function(string) {
return "data:text/plain;charset=utf-8;base64," + window.btoa(string);
},
File utils.js
has 371 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Ember from "ember";
import Constants from "balanced-dashboard/utils/constants";
var FORMAT_NUMBER_REGEX = /\B(?=(\d{3})+(?!\d))/g,
PRETTY_LOG_URL_REGEX = /\/marketplaces\/[^\/]*\/(.+)$/,
Function applyUriFilters
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
applyUriFilters: function(uri, params) {
if (!uri) {
return uri;
}
Function formatError
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
formatError: function(error) {
if (error !== null && error !== undefined) {
if (error.message) {
// amount validation
return error.message;
- 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 applyUriFilters
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
applyUriFilters: function(uri, params) {
if (!uri) {
return uri;
}
- 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 formatFileSize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
formatFileSize: function(bytes) {
if (bytes >= 1000000000) {
bytes = (bytes / 1000000000).toFixed(2) + ' gb';
} else if (bytes >= 1000000) {
bytes = (bytes / 1000000).toFixed(2) + ' mb';
- 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"