File encoding.js
has 1859 lines of code (exceeds 250 allowed). Consider refactoring. Open
(function(global) {
'use strict';
//
// Utilities
Function ISO2022JPDecoder
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ISO2022JPDecoder(options) {
var fatal = options.fatal;
/** @enum */
var state = {
ASCII: 0,
Function decode
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.decode = function(byte_pointer) {
var bite = byte_pointer.get();
if (bite !== EOF_byte) {
byte_pointer.offset(1);
}
Function ISO2022KRDecoder
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ISO2022KRDecoder(options) {
var fatal = options.fatal;
/** @enum */
var state = {
ASCII: 0,
Function decode
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.decode = function(byte_pointer) {
var bite = byte_pointer.get();
if (bite !== EOF_byte) {
byte_pointer.offset(1);
}
Function GBKDecoder
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
function GBKDecoder(gb18030, options) {
var fatal = options.fatal;
var /** @type {number} */ gbk_first = 0x00,
/** @type {number} */ gbk_second = 0x00,
/** @type {number} */ gbk_third = 0x00;
Function decode
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.decode = function(byte_pointer) {
var bite = byte_pointer.get();
if (bite === EOF_byte && gbk_first === 0x00 &&
gbk_second === 0x00 && gbk_third === 0x00) {
return EOF_code_point;
Function HZGB2312Decoder
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
function HZGB2312Decoder(options) {
var fatal = options.fatal;
var /** @type {boolean} */ hzgb2312 = false,
/** @type {number} */ hzgb2312_lead = 0x00;
/**
Function EUCJPDecoder
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
function EUCJPDecoder(options) {
var fatal = options.fatal;
var /** @type {number} */ eucjp_first = 0x00,
/** @type {number} */ eucjp_second = 0x00;
/**
Function decode
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.decode = function(byte_pointer) {
var bite = byte_pointer.get();
if (bite === EOF_byte && hzgb2312_lead === 0x00) {
return EOF_code_point;
}
Function decode
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.decode = function(byte_pointer) {
var bite = byte_pointer.get();
if (bite === EOF_byte) {
if (eucjp_first === 0x00 && eucjp_second === 0x00) {
return EOF_code_point;
Function Big5Decoder
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Big5Decoder(options) {
var fatal = options.fatal;
var /** @type {number} */ big5_lead = 0x00,
/** @type {?number} */ big5_pending = null;
Function UTF8Decoder
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function UTF8Decoder(options) {
var fatal = options.fatal;
var /** @type {number} */ utf8_code_point = 0,
/** @type {number} */ utf8_bytes_needed = 0,
/** @type {number} */ utf8_bytes_seen = 0,
Function decode
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.decode = function(byte_pointer) {
// NOTE: Hack to support emitting two code points
if (big5_pending !== null) {
var pending = big5_pending;
big5_pending = null;
Function decode
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.decode = function(byte_pointer) {
var bite = byte_pointer.get();
if (bite === EOF_byte) {
if (utf8_bytes_needed !== 0) {
return decoderError(fatal);
Function ISO2022KREncoder
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ISO2022KREncoder(options) {
var fatal = options.fatal;
/** @enum */
var state = {
ASCII: 0,
Function ISO2022JPEncoder
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ISO2022JPEncoder(options) {
var fatal = options.fatal;
/** @enum */
var state = {
ASCII: 0,
Function EUCKRDecoder
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function EUCKRDecoder(options) {
var fatal = options.fatal;
var /** @type {number} */ euckr_lead = 0x00;
/**
* @param {ByteInputStream} byte_pointer
Function decode
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.decode = function(byte_pointer) {
var bite = byte_pointer.get();
if (bite === EOF_byte && euckr_lead === 0) {
return EOF_code_point;
}
Function CodePointInputStream
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function CodePointInputStream(string) {
/** @type {number} */
var pos = 0;
/** @type {Array.<number>} */
var cps = (/** @return {Array.<number>} Code points. */function() {
Function encode
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.encode = function(output_byte_stream, code_point_pointer) {
var code_point = code_point_pointer.get();
if (code_point === EOF_code_point) {
return EOF_byte;
}
Function encode
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.encode = function(output_byte_stream, code_point_pointer) {
var code_point = code_point_pointer.get();
if (code_point === EOF_code_point) {
return EOF_byte;
}
Function UTF16Decoder
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function UTF16Decoder(utf16_be, options) {
var fatal = options.fatal;
var /** @type {?number} */ utf16_lead_byte = null,
/** @type {?number} */ utf16_lead_surrogate = null;
/**
Function ShiftJISDecoder
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ShiftJISDecoder(options) {
var fatal = options.fatal;
var /** @type {number} */ shiftjis_lead = 0x00;
/**
* @param {ByteInputStream} byte_pointer
Function decode
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.decode = function(byte_pointer) {
var bite = byte_pointer.get();
if (bite === EOF_byte && utf16_lead_byte === null &&
utf16_lead_surrogate === null) {
return EOF_code_point;
Function decode
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
decode: function decode(opt_view, options) {
if (opt_view && !('buffer' in opt_view && 'byteOffset' in opt_view &&
'byteLength' in opt_view)) {
throw new TypeError('Expected ArrayBufferView');
} else if (!opt_view) {
Function decode
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.decode = function(byte_pointer) {
var bite = byte_pointer.get();
if (bite === EOF_byte && shiftjis_lead === 0x00) {
return EOF_code_point;
}
Function HZGB2312Encoder
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function HZGB2312Encoder(options) {
var fatal = options.fatal;
var hzgb2312 = false;
/**
* @param {ByteOutputStream} output_byte_stream Output byte stream.
Function UTF8Encoder
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function UTF8Encoder(options) {
var fatal = options.fatal;
/**
* @param {ByteOutputStream} output_byte_stream Output byte stream.
* @param {CodePointInputStream} code_point_pointer Input stream.
Function GBKEncoder
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function GBKEncoder(gb18030, options) {
var fatal = options.fatal;
/**
* @param {ByteOutputStream} output_byte_stream Output byte stream.
* @param {CodePointInputStream} code_point_pointer Input stream.
Function encode
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.encode = function(output_byte_stream, code_point_pointer) {
var code_point = code_point_pointer.get();
if (code_point === EOF_code_point) {
return EOF_byte;
}
Function encode
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.encode = function(output_byte_stream, code_point_pointer) {
var code_point = code_point_pointer.get();
if (code_point === EOF_code_point) {
return EOF_byte;
}
Function encode
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.encode = function(output_byte_stream, code_point_pointer) {
var code_point = code_point_pointer.get();
if (code_point === EOF_code_point) {
return EOF_byte;
}
Function ShiftJISEncoder
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ShiftJISEncoder(options) {
var fatal = options.fatal;
/**
* @param {ByteOutputStream} output_byte_stream Output byte stream.
* @param {CodePointInputStream} code_point_pointer Input stream.
Function EUCJPEncoder
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function EUCJPEncoder(options) {
var fatal = options.fatal;
/**
* @param {ByteOutputStream} output_byte_stream Output byte stream.
* @param {CodePointInputStream} code_point_pointer Input stream.
Function cps
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
var cps = (/** @return {Array.<number>} Code points. */function() {
/** @type {Array.<number>} */
var cps = [];
// Based on http://www.w3.org/TR/WebIDL/#idl-DOMString
var i = 0, n = string.length;
Function EUCKREncoder
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function EUCKREncoder(options) {
var fatal = options.fatal;
/**
* @param {ByteOutputStream} output_byte_stream Output byte stream.
* @param {CodePointInputStream} code_point_pointer Input stream.
Function UTF16Encoder
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function UTF16Encoder(utf16_be, options) {
var fatal = options.fatal;
/**
* @param {ByteOutputStream} output_byte_stream Output byte stream.
* @param {CodePointInputStream} code_point_pointer Input stream.
Function encode
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.encode = function(output_byte_stream, code_point_pointer) {
var code_point = code_point_pointer.get();
if (code_point === EOF_code_point) {
return EOF_byte;
}
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return output_byte_stream.emit(0x8E, code_point - 0xFF61 + 0xA1);
Avoid too many return
statements within this function. Open
return code_point;
Avoid too many return
statements within this function. Open
return 0x20AC;
Avoid too many return
statements within this function. Open
return bite;
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return encoderError(code_point);
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return bite;
Avoid too many return
statements within this function. Open
return 0x00CA;
Avoid too many return
statements within this function. Open
return code_point;
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return bite;
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return code_point;
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return bite;
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return 0x00EA;
Avoid too many return
statements within this function. Open
return code_point;
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return code_point;
Avoid too many return
statements within this function. Open
return 0xFF61 + bite - 0xA1;
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return output_byte_stream.emit(byte1 + 0x81,
byte2 + 0x30,
byte3 + 0x81,
byte4 + 0x30);
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return output_byte_stream.emit(0x7E, 0x7B);
Avoid too many return
statements within this function. Open
return output_byte_stream.emit(lead, trail);
Avoid too many return
statements within this function. Open
return 0x007E;
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return encoderError(code_point);
Avoid too many return
statements within this function. Open
return 0x00EA;
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return code_point;
Avoid too many return
statements within this function. Open
return output_byte_stream.emit(code_point - 0xFF61 + 0xA1);
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return output_byte_stream.emit(0x1B, 0x24, 0x42);
Avoid too many return
statements within this function. Open
return EOF_code_point;
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return encoderError(code_point);
Avoid too many return
statements within this function. Open
return output_byte_stream.emit(lead, trail);
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return output_byte_stream.emit(code_point - 0xFF61 - 0x21);
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return output_byte_stream.emit(lead, trail);
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return encoderError(code_point);
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return output_byte_stream.emit(0x7E);
Avoid too many return
statements within this function. Open
return output_byte_stream.emit(lead, trail);
Avoid too many return
statements within this function. Open
return bite;
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return output_byte_stream.emit(lead, trail);
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return code_point;
Avoid too many return
statements within this function. Open
return 0xFF61 + bite - 0x21;
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return bite;
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return EOF_code_point;
Avoid too many return
statements within this function. Open
return code_point;
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return output_byte_stream.emit(0x1B, 0x28, 0x49);
Avoid too many return
statements within this function. Open
return decoderError(fatal, 0x000A);
Avoid too many return
statements within this function. Open
return 0xFF61 + bite - 0xA1;
Avoid too many return
statements within this function. Open
return encoderError(code_point);
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return encoderError(code_point);
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return decoderError(fatal, 0x000A);
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return output_byte_stream.emit(lead, trail);
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return EOF_code_point;
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return encoderError(code_point);
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return EOF_code_point;
Avoid too many return
statements within this function. Open
return output_byte_stream.emit(lead + lead_offset, trail + offset);
Avoid too many return
statements within this function. Open
return decoderError(fatal);
Avoid too many return
statements within this function. Open
return encoderError(code_point);
Similar blocks of code found in 2 locations. Consider refactoring. Open
function TextDecoder(opt_encoding, options) {
if (!this || this === global) {
return new TextDecoder(opt_encoding, options);
}
opt_encoding = opt_encoding ? String(opt_encoding) : DEFAULT_ENCODING;
- 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 209.
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
function TextEncoder(opt_encoding, options) {
if (!this || this === global) {
return new TextEncoder(opt_encoding, options);
}
opt_encoding = opt_encoding ? String(opt_encoding) : DEFAULT_ENCODING;
- 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 209.
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
if (eucjp_second !== 0x00) {
lead = eucjp_second;
eucjp_second = 0x00;
code_point = null;
if (inRange(lead, 0xA1, 0xFE) && inRange(bite, 0xA1, 0xFE)) {
- 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 136.
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
if (eucjp_first !== 0x00) {
lead = eucjp_first;
eucjp_first = 0x00;
code_point = null;
if (inRange(lead, 0xA1, 0xFE) && inRange(bite, 0xA1, 0xFE)) {
- 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 136.
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
case state.escape_middle:
if (bite === 0x29) {
iso2022kr_state = state.escape_end;
return null;
}
- 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 92.
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
case state.escape_end:
if (bite === 0x43) {
iso2022kr_state = state.ASCII;
return null;
}
- 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 92.
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
for (i = 0; i < index.length; ++i) {
var entry = index[i];
if (entry[0] <= pointer) {
offset = entry[0];
code_point_offset = entry[1];
- 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 78.
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
for (i = 0; i < index.length; ++i) {
var entry = index[i];
if (entry[1] <= code_point) {
offset = entry[1];
pointer_offset = entry[0];
- 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 78.
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
this.offset = function(n) {
pos += n;
if (pos < 0) {
throw new Error('Seeking past start of the buffer');
}
- 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 68.
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
this.offset = function(n) {
pos += n;
if (pos < 0) {
throw new Error('Seeking past start of the buffer');
}
- 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 68.
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
do {
code_point = this._decoder.decode(input_stream);
if (code_point !== null && code_point !== EOF_code_point) {
output_stream.emit(code_point);
}
- 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 53.
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
while (input_stream.get() !== EOF_byte) {
code_point = this._decoder.decode(input_stream);
if (code_point !== null && code_point !== EOF_code_point) {
output_stream.emit(code_point);
}
- 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 53.
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
if (inRange(bite, 0x40, 0x7E) || inRange(bite, 0x80, 0xFE)) {
pointer = (lead - 0x81) * 190 + (bite - offset);
}
- 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 46.
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
if (inRange(bite, 0x40, 0x7E) || inRange(bite, 0xA1, 0xFE)) {
pointer = (lead - 0x81) * 157 + (bite - offset);
}
- 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 46.
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