Showing 8 of 10 total issues
File framescript.js
has 299 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*jslint browser: true, devel: true */
/*globals chrome, addEventHandlerCalledOnce, weightedEditDistance */
// -------------------------- Step-by-step procedure ---------------------------
// 1. Request a random dictionary entry from the background page;
Function parseLine
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function parseLine(line, options) {
var grade, // placeholder for kanji grade
meanings, // placeholder for a list of meanings of a given term
readings, // placeholder for a list of readings of a given term
Function weightedEditDistance
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
function weightedEditDistance(a, b) {
'use strict';
var matrix = [], cost, i, j;
- 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 assemble
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function assemble(settings, callback) {
var pending = 0, // keeps track of how many sources are being worked on
errors = [], // container for errors
assembly = []; // final assembly of dictionaries
Function parseLine
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
function parseLine(line, options) {
var grade, // placeholder for kanji grade
meanings, // placeholder for a list of meanings of a given term
readings, // placeholder for a list of readings of a given term
- 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 addQuestion
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function addQuestion(question, callback) {
var isFirstQuestion = !questions.length,
nodes;
// The question must be an object:
Function stealFocus
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function stealFocus(callback) {
// Callback might be an event object:
if (typeof callback !== 'function') {
callback = noop;
}
Function weightedEditDistance
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function weightedEditDistance(a, b) {
'use strict';
var matrix = [], cost, i, j;