Showing 47 of 47 total issues
Function getCharCode
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getCharCode(bytes, byteOffset, charLength) {
var charCode = 0,
mask = '';
byteOffset = byteOffset || 0;
// validate that the array has at least one byte in it
Function getStringFromBytes
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getStringFromBytes(bytes, byteOffset, byteLength, strict) {
var charLength,
chars = [];
byteOffset = byteOffset | 0;
byteLength =
Function getCharCode
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function getCharCode(bytes, byteOffset, charLength) {
var charCode = 0,
mask = '';
byteOffset = byteOffset || 0;
// validate that the array has at least one byte in it
- 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 setBytesFromString
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setBytesFromString(string, bytes, byteOffset, byteLength, strict) {
string = string || '';
bytes = bytes || [];
byteOffset = byteOffset | 0;
byteLength =
Function getStringFromBytes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function getStringFromBytes(bytes, byteOffset, byteLength, strict) {
var charLength,
chars = [];
byteOffset = byteOffset | 0;
byteLength =
- 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 setBytesFromString
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function setBytesFromString(string, bytes, byteOffset, byteLength, strict) {
Avoid too many return
statements within this function. Open
return 0;
Replace '·cannot·encode·the·'
with "·cannot·encode·the·"
Open
' cannot encode the ' +
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace 'tests/*.mocha.js'
with "tests/*.mocha.js"
Open
'tests/*.mocha.js',
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace 'tests/*.mocha.js':·['browserify'],
with "tests/*.mocha.js":·["browserify"]
Open
'tests/*.mocha.js': ['browserify'],
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ':·Next·bytes·of·encoded·char'
with ":·Next·bytes·of·encoded·char"
Open
': Next bytes of encoded char' +
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace '00000000'.slice(0,·charLength)·+·1·+·'00000000'
with "00000000".slice(0,·charLength)·+·1·+·"00000000"
Open
mask = '00000000'.slice(0, charLength) + 1 + '00000000'.slice(charLength + 1);
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ··
Open
: bytes.byteLength || bytes.length;
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace 'Expected·at·least·'·+·charLength·+·'·bytes·remaining·in·array.'
with "Expected·at·least·"·+·charLength·+·"·bytes·remaining·in·array."
Open
'Expected at least ' + charLength + ' bytes remaining in array.'
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace '·encoded·char'
with "·encoded·char"
Open
' encoded char' +
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ').'
with ")."
Open
').'
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ⏎····'number'
with ·"number"
Open
byteLength =
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ⏎···
Open
var charLength,
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ······
with ····
Open
? byteLength
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace 'CharCode·'·+·charCode·+·'·cannot·be·encoded·with·UTF8.'
with "CharCode·"·+·charCode·+·"·cannot·be·encoded·with·UTF8."
Open
throw new Error('CharCode ' + charCode + ' cannot be encoded with UTF8.');
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/