Showing 1,292 of 3,313 total issues
File constants.ts
has 1175 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { maxBy, minBy, randomInt } from '@peertube/peertube-core-utils'
import {
AbuseState,
AbuseStateType,
ActivityPubActorType,
File video-watch.component.ts
has 797 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { NgClass, NgIf, NgTemplateOutlet, PlatformLocation } from '@angular/common'
import { Component, ElementRef, Inject, LOCALE_ID, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core'
import { ActivatedRoute, Router, RouterLink } from '@angular/router'
import {
AuthService,
File config.ts
has 731 lines of code (exceeds 250 allowed). Consider refactoring. Open
import bytes from 'bytes'
import { IConfig } from 'config'
import { createRequire } from 'module'
import { dirname, join } from 'path'
import {
File video-redundancy.ts
has 690 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
ActivityVideoUrlObject,
CacheFileObject,
FileRedundancyInformation,
StreamingPlaylistRedundancyInformation,
File video-comment.ts
has 666 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { pick } from '@peertube/peertube-core-utils'
import {
ActivityTagObject,
ActivityTombstoneObject,
UserRight,
Function getHTMLServerConfig
has 260 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getHTMLServerConfig (): Promise<HTMLServerConfig> {
if (this.serverCommit === undefined) this.serverCommit = await getServerCommit()
const serverActor = await getServerActor()
File videos-id-list-query-builder.ts
has 592 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Sequelize, Transaction } from 'sequelize'
import validator from 'validator'
import { forceNumber } from '@peertube/peertube-core-utils'
import { VideoInclude, VideoIncludeType, VideoPrivacy, VideoPrivacyType, VideoState } from '@peertube/peertube-models'
import { exists } from '@server/helpers/custom-validators/misc.js'
Function ngOnInit
has 255 lines of code (exceeds 25 allowed). Consider refactoring. Open
ngOnInit () {
this.serverConfig = this.serverService.getHTMLConfig()
const formGroupData: { [key in keyof ComponentCustomConfig ]: any } = {
instance: {
Function customConfig
has 248 lines of code (exceeds 25 allowed). Consider refactoring. Open
function customConfig (): CustomConfig {
return {
instance: {
name: CONFIG.INSTANCE.NAME,
shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION,
File video-stats.component.ts
has 564 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { ChartConfiguration, ChartData, ChartOptions, PluginOptionsByType, Scale, TooltipItem, defaults as ChartJSDefaults } from 'chart.js'
import zoomPlugin from 'chartjs-plugin-zoom'
import { Observable, of } from 'rxjs'
import { SelectOptionsItem } from 'src/types'
import { Component, Inject, LOCALE_ID, OnInit } from '@angular/core'
File video-edit.component.ts
has 554 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { DatePipe, NgClass, NgFor, NgIf, NgTemplateOutlet } from '@angular/common'
import {
ChangeDetectorRef,
Component,
EventEmitter,
File videos-command.ts
has 538 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */
import validator from 'validator'
import { getAllPrivacies, omit, pick, wait } from '@peertube/peertube-core-utils'
import {
Redis
has 59 functions (exceeds 20 allowed). Consider refactoring. Open
class Redis {
private static instance: Redis
private initialized = false
private connected = false
Function buildIdsListQuery
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
private buildIdsListQuery (options: BuildVideosListQueryOptions) {
this.attributes = options.attributes || [ '"video"."id"' ]
if (options.group) this.group = options.group
if (options.having) this.having = options.having
- 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 live-manager.ts
has 510 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { pick, wait } from '@peertube/peertube-core-utils'
import {
ffprobePromise,
getVideoStreamBitrate,
getVideoStreamDimensionsInfo,
Function onFingerSwipe
has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring. Open
onFingerSwipe (direction: 'left' | 'right' | 'up' | 'down', action: () => void, removeEventOnEnd = true) {
let touchDownClientX: number
let touchDownClientY: number
const onTouchStart = (event: TouchEvent) => {
- 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 plugin-manager.ts
has 487 lines of code (exceeds 250 allowed). Consider refactoring. Open
import express from 'express'
import { createReadStream, createWriteStream } from 'fs'
import { ensureDir, outputFile, readJSON } from 'fs-extra/esm'
import { Server } from 'http'
import { createRequire } from 'module'
File video.service.ts
has 487 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { HttpClient, HttpParams, HttpRequest } from '@angular/common/http'
import { Injectable } from '@angular/core'
import { AuthService, ComponentPaginationLight, ConfirmService, RestExtractor, RestService, ServerService, UserService } from '@app/core'
import { objectToFormData } from '@app/helpers'
import { arrayify } from '@peertube/peertube-core-utils'
File video-actions-dropdown.component.ts
has 484 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { NgIf } from '@angular/common'
import { Component, EventEmitter, Input, OnChanges, Output, ViewChild, booleanAttribute } from '@angular/core'
import { AuthService, ConfirmService, Notifier, ScreenService, ServerService } from '@app/core'
import { NgbDropdown, NgbDropdownAnchor, NgbDropdownMenu } from '@ng-bootstrap/ng-bootstrap'
import { VideoCaption } from '@peertube/peertube-models'
Function sanitize
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
protected sanitize (o: ImportObject) {
if (!isVideoNameValid(o.name)) return undefined
if (!isVideoDurationValid(o.duration + '')) return undefined
if (!isVideoChannelUsernameValid(o.channel?.name)) return undefined
if (!isVideoPrivacyValid(o.privacy)) return 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"