Showing 258 of 12,136 total issues
Function createElementTemplate
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function createElementTemplate<TSource = any, TParent = any>(
tagName: string,
options?: ElementCreateOptions
): ViewTemplate<TSource, TParent> {
const markup: Array<string> = [];
- 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 merge
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
function merge(splice: Splice, splices: Splice[]): void {
let inserted = false;
let insertionOffset = 0;
for (let i = 0; i < splices.length; i++) {
Function convertDocFiles
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function convertDocFiles(dir, docFiles, package, exportPath) {
for (const docFile of docFiles) {
try {
const { name: id, ext } = path.parse(docFile);
if (ext !== ".md") {
DefaultRouter
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
export class DefaultRouter implements Router {
private parentRouter: Router | null | undefined = void 0;
private contributors = new Set<NavigationContributor>();
private navigationQueue: NavigationQueue | null = null;
Function Updates
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Updates: UpdateQueue = FAST.getById(KernelServiceId.updateQueue, () => {
const tasks: Callable[] = [];
const pendingErrors: any[] = [];
const rAF = globalThis.requestAnimationFrame;
let updateAsync = true;
Function getAsync
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public async getAsync<K extends Key>(key: K): Promise<Resolved<K>> {
validateKey(key);
if ((key as Resolver).$isResolver) {
return (key as Resolver).resolveAsync(this, 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
Function getResolver
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public getResolver<K extends Key, T = K>(
key: K | Key,
autoRegister: boolean = true
): Resolver<T> | null {
validateKey(key);
- 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 updateViews
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
private updateViews(splices: Splice[]): void {
const views = this.views;
const bindView = this.bindView;
const items = this.items!;
const template = this.template;
Function connect
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public connect() {
// Initialize needsHydration on first connect
if (this.needsHydration === undefined) {
this.needsHydration =
this.source.getAttribute(needsHydrationAttribute) !== null;
Function targetComment
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function targetComment(
node: Comment,
walker: TreeWalker,
factories: CompiledViewBehaviorFactory[],
targets: ViewBehaviorTargets,
Function updateContent
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateContent(
this: HTMLBindingDirective,
target: ContentTarget,
aspect: string,
value: any,
Function create
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
create<TSource = any, TParent = any>(
source: TSource
): ViewBehaviorOrchestrator<TSource, TParent> {
const behaviors: ViewBehavior[] = [];
const targets: ViewBehaviorTargets = {};
Function createComplexObject
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createComplexObject() {
return {
a: {
b: {
c: 1,
Function map
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public map(...routes: MappableRouteDefinition<TSettings>[]) {
for (const route of routes) {
if ("children" in route) {
const titleBuilder = this.owner.createTitleBuilder();
const childRoutes = route.children.map(x => {
Function getDependencies
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
getDependencies(Type: Constructable | Injectable): Key[] {
// Note: Every detail of this getDependencies method is pretty deliberate at the moment,
// and probably not yet 100% tested from every possible angle,
// so be careful with making changes here as it can have a huge impact on complex end user apps.
// Preferably, only make changes to the dependency resolution process via a RFC.
Function fixture
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function fixture<TElement = HTMLElement>(
templateNameOrType: ViewTemplate | string | Constructable<TElement>,
options: FixtureOptions = {}
): Promise<Fixture<TElement>> {
const document = options.document || globalThis.document;
Function createContext
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createContext<K extends Key>(
nameConfigOrCallback?:
| string
| ((builder: ResolverBuilder<K>) => Resolver<K>)
| InterfaceConfiguration,
Function from
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
from<TBase extends typeof HTMLElement>(
BaseType: TBase
): { new (): InstanceType<TBase> & RouterElement } {
class RouterBase extends (BaseType as any) {
public readonly [routerProperty]!: Router;
Function run
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async run(router: Router, message: NavigationMessage) {
const events = router.config!.createEventSink();
const match = await router.config!.recognizeRoute(message.path);
if (match === null) {
Function spliceOperationsFromEditDistances
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function spliceOperationsFromEditDistances(distances: number[][]): number[] {
let i = distances.length - 1;
let j = distances[0].length - 1;
let current = distances[i][j];
const edits: number[] = [];