Showing 18 of 180 total issues
File js-to-html.ts
has 1821 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
var SCRIPT_IS_VOID = true;
export function setScriptIsVoid(is:boolean){
html
has 120 functions (exceeds 20 allowed). Consider refactoring. Open
export var html={
defaultTitle:"",
insecureModeEnabled:true,
mandatoryTitle:true,
optimizingArrange:true,
Function toHtmlDoc
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
toHtmlDoc(opts:PrintOpts,recurseOpts:PrintRecurseOpts){
opts = opts||{};
var target:Html=this;
if(!opts.incomplete){
var source:Html=this;
- 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
File tagInterface.js
has 283 lines of code (exceeds 250 allowed). Consider refactoring. Open
var fs=require('fs').promises;
// https://html.spec.whatwg.org/multipage/indices.html#element-interfaces
Function indirect
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
function indirect(tagName:string,contentOrAttributes?:Content|object,contentIfThereAreAttributes?:Content){
var attributes:object={};
var content:Content=[];
if(typeof contentOrAttributes=="object" && !(contentOrAttributes instanceof Array) ){
if(contentOrAttributes!=null){
- 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 arrange
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function arrange(element:HTMLElement|SVGElement, listOfObjects:HtmlBase|HtmlBase[]):void{
if(!(listOfObjects instanceof Array)){
return arrange(element, [listOfObjects]);
}
// @ts-ignore
Function assignAttr
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
assignAttr(element:HTMLElement|SVGElement, attributesMap:any, testFirst:boolean){
let esto = this;
let attributes = attributesMap || this.attributes;
var tagInfo=htmlTags[this.tagName];
Object.keys(attributes).map(function(attr){
Function toHtmlDoc
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
toHtmlDoc(opts:PrintOpts,recurseOpts:PrintRecurseOpts){
opts = opts||{};
var target:Html=this;
if(!opts.incomplete){
var source:Html=this;
Function toHtmlText
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
toHtmlText(opts?:PrintOpts, recurseOpts?:PrintRecurseOpts):string{
opts=opts||{};
recurseOpts=recurseOpts||{};
recurseOpts.margin=recurseOpts.margin||0;
var tagInfo=htmlTags[this.tagName];
- 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 exports
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
Function constructor
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
constructor(directObject:DirectObject, validProperties?:ValidPropertydProperty){
/*jshint forin:false */
for(var property in validProperties){
/*jshint forin:true */
var propertyDef=validProperties[property];
- 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
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
{check:function(attributes){
/*jshint forin:false */
for(var attrName in attributes){
/*jshint forin:true */
var attrValue=attributes[attrName];
- 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 indirect
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function indirect(tagName:string,contentOrAttributes?:Content|object,contentIfThereAreAttributes?:Content){
var attributes:object={};
var content:Content=[];
if(typeof contentOrAttributes=="object" && !(contentOrAttributes instanceof Array) ){
if(contentOrAttributes!=null){
Function check
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
{check:function(attributes, o){
/*jshint forin:false */
for(var attrName in attributes){
/*jshint forin:true */
var attrInfo=htmlAttributes[attrName];
- 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 deeply nested control flow statements. Open
if(!testFirst || element[defAttr.idl] != value){
html.auditArrange?.('attr.set', true);
// @ts-ignore // no le gusta indexar HTML
element[defAttr.idl] = value;
}
Avoid deeply nested control flow statements. Open
if(!testFirst || $on[eventName] != value[eventName]){
html.auditArrange?.('attr.on', true);
if(eventName in $on){
element.removeEventListener(eventName, $on[eventName])
}
Consider simplifying this complex logical expression. Open
if(!domElement || !(
domElement instanceof Text && htmlElement instanceof HtmlTextNode ||
'tagName' in domElement && 'tagName' in htmlElement && domElement.tagName.toLowerCase() == htmlElement.tagName
) ){
var newElement;
Function setOrResetAttribute
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
setOrResetAttribute(element:HTMLElement|SVGElement, attr:string, valueOrNull:null|string, testFirst:boolean){
html.auditArrange?.('attr.mod', false);
if(!testFirst || valueOrNull == null && element.hasAttribute(attr) || valueOrNull != element.getAttribute(attr)){
html.auditArrange?.('attr.mod', true);
if(valueOrNull!=null){
- 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"