Showing 113 of 113 total issues
Function exports
has 246 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// http://stackoverflow.com/questions/90002/
// "What is a reasonable code coverage for unit tests (and why)?"
Function indexOf
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
var material = this.table.kind,
kind = kclv.Game.Materials.getKindOf(material),
configuration = this.cascadeHorizontalConfiguration(kind, 'Materials'),
option =
kclv.Chart.Base.prototype.buildOption.call(this, configuration);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 80.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
var material = this.table.kind,
kind = kclv.Game.Materials.getKindOf(material),
configuration = this.cascadeHorizontalConfiguration(kind, 'Materials'),
option =
kclv.Chart.Base.prototype.buildOption.call(this, configuration);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 80.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function Ships
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
kclv.Game.Ships = ( function() {
return {
/**
* Array of abbreviations for ship classification.
* Caveat: WSH's Active Script engine requires us to append
File tokenizer.js
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* @fileOverview A partical object for tokenizers.
* @author kclv@ermitejo.com (MORIYA Masaki, alias Gardejo)
* @license The MIT license (See LICENSE file)
*/
Function reduce
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Array.prototype.reduce = function reduce(accumulator){
if (this===null || this===undefined) {
throw new TypeError("Object is null or 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"
Further reading
Function Array
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
kclv.Array = ( function() {
return {
/**
* Get a subset of specified array by specified indices.
* It is similar to a slice access to array in Perl
- 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 filter
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Array.prototype.filter = function(fun /*, thisArg */)
{
if (this === void 0 || 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
Function Array
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
kclv.Array = ( function() {
return {
/**
* Get a subset of specified array by specified indices.
* It is similar to a slice access to array in Perl
Function map
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Array.prototype.map = function(fun /*, thisArg */)
{
if (this === void 0 || 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
Function buildOption
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
kclv.Chart.Line.prototype.buildOption = function() {
var material = this.table.kind,
kind = kclv.Game.Materials.getKindOf(material),
configuration = this.cascadeHorizontalConfiguration(kind, 'Materials'),
option =
Function Configuration
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
kclv.Configuration = ( function() {
/**
* The configuration structure as a Flyweight object.
* @private {Object.<string, *>}
*/
Function visualize
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
kclv.Visualizer.prototype.visualize = function(directive) {
if (! directive) {
throw new Error('Visualizer requires some directive.');
}
Function buildRows
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
kclv.Table.Ships.Base.prototype.buildRows = function() {
var indexOf = this.getClassificationDictionary_(),
attributeOf = this.relation.getAttributes(),
relation = this.canonizeRelation_(attributeOf),
mothballLevel =
Function keys
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Object.keys = (function () {
var hasOwnProperty = Object.prototype.hasOwnProperty,
hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),
dontEnums = [
'toString',
Function Materials
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
kclv.Game.Materials = ( function() {
/**
* (Reserved) The maximum value of supplies of materials.
* @private {Object.<string, number>}
* @const
Similar blocks of code found in 2 locations. Consider refactoring. Open
kclv.Formatter.prototype.quote = function(target, opt_indices) {
return this.format_(
function(string) { return '"' + string + '"'; },
target,
opt_indices
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 60.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
kclv.Formatter.prototype.parenthesize = function(target, opt_indices) {
return this.format_(
function(string) { return '(' + string + ')'; },
target,
opt_indices
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 60.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function forEach
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Array.prototype.forEach = function( 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"