Showing 112 of 188 total issues
Function replicateMany
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function replicateMany<Si extends any>(
sinks: Si,
sinkProxies: SinkProxies<Si>
): DisposeFunction {
const scheduleMicrotask = quicktask();
Function _n
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public _n(inst: InternalInstances<Si>): void {
this.inst = inst;
const arrSinks = inst.arr;
const ils = this.ils;
const out = this.out;
Function makePeriodic
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function makePeriodic(createOperator: () => OperatorArgs<any>) {
const {schedule, currentTime} = createOperator();
return function periodic(period: number): Stream<number> {
let stopped = false;
Function makeClickListener
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function makeClickListener(push: (p: string) => void) {
return function clickListener(event: MouseEvent) {
if (which(event) !== 1) {
return;
}
Function runUpdateChangelogs
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function runUpdateChangelogs() {
packagesWithChangelog
.filter(function (package) {
if (typeof argPackage === 'string' && argPackage.length > 0) {
return argPackage === package;
Function main
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function main(sources: Sources): Sinks {
const firstName$ = sources.DOM
.select('.first')
.events('input')
.map(ev => (ev.target as HTMLInputElement).value)
Function preventDefaultConditional
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
export function preventDefaultConditional(
event: any,
preventDefault: PreventDefaultOpt
): void {
if (preventDefault) {
- 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 createTagFunction
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
function createTagFunction(tagName: string): Function {
return function hyperscript(a: any, b?: any, c?: any): VNode {
const hasA = typeof a !== 'undefined';
const hasB = typeof b !== 'undefined';
const hasC = typeof c !== 'undefined';
- 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 createResponse$
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function createResponse$(reqInput: RequestInput): Stream<Response> {
let request: any;
return xs.create<Response>({
start: function startResponseStream(listener) {
try {
Function clickListener
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
return function clickListener(event: MouseEvent) {
if (which(event) !== 1) {
return;
}
Function model
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function model(action$, itemFn) {
function createRandomItemProps() {
let hexColor = Math.floor(Math.random() * 16777215).toString(16);
while (hexColor.length < 6) {
hexColor = '0' + hexColor;
Function periodic
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
return function periodic(period: number): Stream<number> {
let stopped = false;
let lastEmitTime = 0;
function scheduleNextEvent(
Function makeChartDriver
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function makeChartDriver(selector, settings) {
let instance = null // lazy initialize chart on first stream event
const el = document.querySelector(selector)
if (!el) {
throw new Error(`No element '${selector}' found`)
Function main
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function main(sources) {
const changeWeight$ = sources.DOM.select('#weight').events('input')
.map(ev => ev.target.value);
const changeHeight$ = sources.DOM.select('#height').events('input')
.map(ev => ev.target.value);
Function calculateAnimationSteps
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function calculateAnimationSteps(point$) {
function incorporateNewPoint(oldPoints, newPoint) {
const index = oldPoints.findIndex(point => point.key === newPoint.key)
let points
if (index === -1 && newPoint.target === 1) {
Function setup
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function setup<
D extends MatchingDrivers<D, M>,
M extends MatchingMain<D, M>
>(main: M, drivers: D): CycleProgram<D, M> {
if (typeof main !== `function`) {
Function makeAssertEqual
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function makeAssertEqual(
timeSource: any,
schedule: any,
currentTime: () => number,
interval: number,
Function main
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function main(sources) {
// Requests for Github repositories happen when the input field changes,
// debounced by 500ms, ignoring empty input field.
const searchRequest$ = sources.DOM.select('.field').events('input')
.compose(sources.Time.debounce(500))
Function makeAnimationFrames
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function makeAnimationFrames(addFrameCallback: any, currentTime: () => number) {
return function animationFrames(): Stream<Frame> {
const frame = {
time: 0,
delta: 16,
Function instanceLens
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function instanceLens(
itemKey: ItemKeyFn<any>,
key: string
): Lens<Array<any>, any> {
return {