Showing 12 of 12 total issues
File i18n.js
has 437 lines of code (exceeds 250 allowed). Consider refactoring. Open
// I18n.js
// =======
//
// This small library provides the Rails I18n API on the Javascript.
// You don't actually have to use Rails (or even Ruby) to use I18n.js.
Function indexOf
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
"use strict";
if (this == null) {
throw new TypeError();
}
- 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 filter
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def self.filter(translations, scopes)
scopes = scopes.split(".") if scopes.is_a?(String)
scopes = scopes.clone
scope = scopes.shift
- 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 strftime
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
I18n.strftime = function(date, format) {
var options = this.lookup("date");
if (!options) {
options = DAYS_AND_MONTHS;
Function forEach
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Array.prototype.forEach = function forEach( callback, thisArg ) {
var T, k;
if ( this == null ) {
- 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 toNumber
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
I18n.toNumber = function(number, options) {
options = this.prepareOptions(
options
, this.lookup("number.format")
, NUMBER_FORMAT
Function toHumanSize
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
I18n.toHumanSize = function(number, options) {
var kb = 1024
, size = number
, iterations = 0
, unit
Function lookup
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
I18n.lookup = function(scope, options) {
options = this.prepareOptions(options);
var locales = this.locales.get(options.locale)
, requestedLocale = locales[0]
Function indexOf
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
"use strict";
if (this == null) {
throw new TypeError();
}
Function parseDate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
I18n.parseDate = function(date) {
var matches, convertedDate;
// we have a date, so just return it.
if (typeof(date) == "object") {
Method configured_segments
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.configured_segments
config[:translations].each_with_object({}) do |options, segments|
options.reverse_merge!(:only => "*")
if options[:file] =~ ::I18n::INTERPOLATION_PATTERN
segments.merge!(segments_per_locale(options[:file], options[:only]))
- 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 translation_segments
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.translation_segments
segments = if config? && config[:translations]
configured_segments
else
{"#{export_dir}/translations.js" => translations}
- 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"