Showing 13 of 27 total issues
File compiler.ts
has 391 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/// <reference path="../typings/index.d.ts" />
import escape from './escape'
import objectKeys from './object-keys'
import regexEscape from './regex-escape'
Compiler
has 39 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export default class Compiler implements Templata.ICompiler {
public static settings: Templata.ICompilerSettings = {
DELIMITER: {
CLOSING: '/',
CLOSING_BLOCK: '}}',
Function htmlUnescape
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function htmlUnescape(input: string): string {
// ampersand
return input.replace(/\&\;/g, '\u0026')
// less-than sign
.replace(/\<\;/g, '\u003C')
Function htmlEscape
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function htmlEscape(input: string): string {
// ampersand
return input.replace(/\u0026/g, '&')
// number sign (hashtag)
.replace(/\u0023/g, '#')
Function default
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
export default function(
operator: string,
parameter: string,
_selfClosing: boolean,
closingTag: boolean,
- 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 print
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
_operator: string,
parameter: string,
_selfClosing: boolean,
_closingTag: boolean,
buffer: Templata.IBuffer,
Function comment
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
_operator: string,
_parameter: string,
_selfClosing: boolean,
_closingTag: boolean,
_buffer: Templata.IBuffer,
Function default
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
operator: string,
parameter: string,
_selfClosing: boolean,
closingTag: boolean,
buffer: Templata.IBuffer,
Function default
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
_operator: string,
parameter: string,
_selfClosing: boolean,
_closingTag: boolean,
buffer: Templata.IBuffer,
Function javascript
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
_operator: string,
parameter: string,
_selfClosing: boolean,
_closingTag: boolean,
buffer: Templata.IBuffer,
Function iterate
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
_operator: string,
parameter: string,
_selfClosing: boolean,
closingTag: boolean,
buffer: Templata.IBuffer,
Function iterate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
function iterate(
_operator: string,
parameter: string,
_selfClosing: boolean,
closingTag: boolean,
- 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
Open
return buffer.END + '}else{' + buffer.START