Showing 30 of 49 total issues
Function promptForSpecifics
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
async function promptForSpecifics(options) {
const questions = [];
if (options.type === 'decode' && !options.barcode) {
questions.push({
- 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 promptForSpecifics
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function promptForSpecifics(options) {
const questions = [];
if (options.type === 'decode' && !options.barcode) {
questions.push({
Function decodeCharacters
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
function decodeCharacters(chars) {
// decode characters to codewords.
// this is the core of the barcode processing.
let fcs = 0;
- 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 check_encode_input
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
function check_encode_input(encode_input, callback) {
_.mapObject(encode_input, cleanString);
// Zip Code is optional, but must be 5 | 9 digits
if (encode_input.zip) {
- 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 decode_barcode
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
function decode_barcode(barcode, callback) {
let chars, decoded_imb;
barcode = cleanString(barcode);
- 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 decodeCharacters
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function decodeCharacters(chars) {
// decode characters to codewords.
// this is the core of the barcode processing.
let fcs = 0;
Function encode_fields
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function encode_fields(imb_fields, callback) {
let n;
let num = [0,0,0,0,0,0,0,0,0,0];
let marker = 0;
Function repairCharacters
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function repairCharacters(chars) {
let prod = 1;
let possible = new Array(10);
for (let n = 0; n < 10; n++) {
- 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 showBarCode
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
showBarCode: function showBarCode(barcode) {
const top = document.getElementById('row0').cells;
const mid = document.getElementById('row1').cells;
const btm = document.getElementById('row2').cells;
Function repairBarcode
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function repairBarcode(barcode) {
let longer;
if (barcode.length === 64) {
longer = true;
- 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 tryRepair
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function tryRepair(possible, chars, pos) {
let inf = null, newinf;
for (let n = 0; n < possible[pos].length; n++) {
chars[pos] = possible[pos][n];
- 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 check_encode_input
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function check_encode_input(encode_input, callback) {
_.mapObject(encode_input, cleanString);
// Zip Code is optional, but must be 5 | 9 digits
if (encode_input.zip) {
Function decode_barcode
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function decode_barcode(barcode, callback) {
let chars, decoded_imb;
barcode = cleanString(barcode);
Function build_codewords
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildCodeWords: function build_codewords(bits, low, hi) {
// loop through all possible 13-bit codewords
for (let fwd = 0; fwd < 8192; fwd++) {
// build reversed codeword and count population of 1-bits
Function encode_fields
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function encode_fields(imb_fields, callback) {
let n;
let num = [0,0,0,0,0,0,0,0,0,0];
let marker = 0;
- 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 charactersToText
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
charactersToText: function charactersToText(chars) {
let barcode = "";
for (let n = 0; n < 65; n++) {
if (chars[desc_char[n]] & desc_bit[n]) {
- 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 repairBarcode
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function repairBarcode(barcode) {
let longer;
if (barcode.length === 64) {
longer = true;
Function build_codewords
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
buildCodeWords: function build_codewords(bits, low, hi) {
// loop through all possible 13-bit codewords
for (let fwd = 0; fwd < 8192; fwd++) {
// build reversed codeword and count population of 1-bits
- 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
Avoid too many return
statements within this function. Open
return "Mailer ID must be 6 or 9 digits";
Avoid too many return
statements within this function. Open
if (callback) return callback("Invalid barcode");