Showing 1,292 of 3,313 total issues
Function checkMissedConfig
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
function checkMissedConfig () {
const required = [ 'listen.port', 'listen.hostname',
'webserver.https', 'webserver.hostname', 'webserver.port',
'secrets.peertube',
'trust_proxy',
VideoActionsDropdownComponent
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
@Component({
selector: 'my-video-actions-dropdown',
templateUrl: './video-actions-dropdown.component.html',
styleUrls: [ './video-actions-dropdown.component.scss' ],
standalone: true,
Function getOverallStats
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async getOverallStats (options: {
video: MVideo
startDate?: string
endDate?: string
}): Promise<VideoStatsOverall> {
Function constructor
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor (hash: UserNotificationServer, user: AuthUser) {
this.id = hash.id
this.type = hash.type
this.read = hash.read
Function addIntroOutro
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
async addIntroOutro (options: BaseStudioOptions & {
introOutroPath: string
type: 'intro' | 'outro'
}) {
File embed.ts
has 344 lines of code (exceeds 250 allowed). Consider refactoring. Open
import './embed.scss'
import '../../assets/player/shared/dock/peertube-dock-component'
import '../../assets/player/shared/dock/peertube-dock-plugin'
import { PeerTubeServerError } from 'src/types'
import videojs from 'video.js'
Function getOverallStats
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
static async getOverallStats (options: {
video: MVideo
startDate?: string
endDate?: string
}): Promise<VideoStatsOverall> {
- 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 abstract-command.ts
has 340 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */
import { HttpStatusCode, HttpStatusCodeType } from '@peertube/peertube-models'
import { buildAbsoluteFixturePath, getFileSize } from '@peertube/peertube-node-utils'
import { expect } from 'chai'
File redis.ts
has 339 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { sha256 } from '@peertube/peertube-node-utils'
import { exists } from '@server/helpers/custom-validators/misc.js'
import { Redis as IoRedis, RedisOptions } from 'ioredis'
import { logger, loggerTagsFactory } from '../helpers/logger.js'
import { generateRandomString } from '../helpers/utils.js'
File video-playlist-element.ts
has 335 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { AggregateOptions, Op, ScopeOptions, Sequelize, Transaction } from 'sequelize'
import {
AllowNull,
BelongsTo,
Column,
VideoRedundancyModel
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
@Scopes(() => ({
[ScopeNames.WITH_VIDEO]: {
include: [
{
model: VideoFileModel,
Function buildAbuseListQuery
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildAbuseListQuery (options: BuildAbusesQueryOptions, type: 'count' | 'id') {
const whereAnd: string[] = []
const replacements: any = {}
const joins = [
File video-playlists.ts
has 331 lines of code (exceeds 250 allowed). Consider refactoring. Open
import express from 'express'
import { body, param, query, ValidationChain } from 'express-validator'
import { forceNumber } from '@peertube/peertube-core-utils'
import {
HttpStatusCode,
File video-model-builder.ts
has 330 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { VideoInclude, VideoIncludeType } from '@peertube/peertube-models'
import { AccountBlocklistModel } from '@server/models/account/account-blocklist.js'
import { AccountModel } from '@server/models/account/account.js'
import { ActorImageModel } from '@server/models/actor/actor-image.js'
import { ActorModel } from '@server/models/actor/actor.js'
Function buildWhere
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
private buildWhere () {
let where: string[] = []
if (this.options.videoId) {
this.replacements.videoId = this.options.videoId
Function create
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
async create () {
this.video = new VideoModel(
await Hooks.wrapObject(this.buildVideo(this.videoAttributes, this.channel), this.videoAttributeResultHook)
) as MVideoFullLight
Function buildVideosFromRows
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
buildVideosFromRows (options: {
rows: SQLRow[]
include?: VideoIncludeType
rowsWebVideoFiles?: SQLRow[]
rowsStreamingPlaylist?: SQLRow[]
- 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 fixCompacted
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
function fixCompacted (original: any, compacted: any) {
if (!original || !compacted) return
for (const [ k, v ] of Object.entries(original)) {
if (k === '@context' || k === 'signature') continue
- 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 buildPeerTubePlayerLoadOptions
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
private buildPeerTubePlayerLoadOptions (options: {
video: VideoDetails
liveVideo: LiveVideo
videoCaptions: VideoCaption[]
videoChapters: VideoChapter[]
- 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 waitJobs
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
async function waitJobs (
serversArg: PeerTubeServer[] | PeerTubeServer,
options: {
skipDelayed?: boolean // default false
runnerJobs?: boolean // default false
- 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"