Showing 1,292 of 3,313 total issues
Function prepare
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function prepare () {
const config = {
rates_limit: {
api: {
max: 5_000_000
File checker-after-init.ts
has 296 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { uniqify } from '@peertube/peertube-core-utils'
import { getFFmpegVersion } from '@peertube/peertube-ffmpeg'
import { VideoRedundancyConfigFilter } from '@peertube/peertube-models'
import { isProdInstance } from '@peertube/peertube-node-utils'
import config from 'config'
Function createModel
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
private createModel (json: any, modelName: string, keyPath: string) {
if (!json.id) return { created: false, model: null }
const { created, model } = this.createOrFindModel(json, modelName, keyPath)
- 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 focus
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
focus (item = 0): void {
const children = this.children().slice()
const haveTitle = children.length && children[0].hasClass('vjs-menu-title')
if (haveTitle) {
- 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 parseQueryStringFilter
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
parseQueryStringFilter <T extends QueryStringFilterPrefixes> (q: string, prefixes: T): ParseQueryStringFiltersResult<keyof T> {
if (!q) return {}
const tokens = this.tokenizeString(q)
- 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 getCommonVideoEditAttributes
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getCommonVideoEditAttributes () {
return [
body('thumbnailfile')
.custom((value, { req }) => isVideoImageValid(req.files, 'thumbnailfile')).withMessage(
'This thumbnail file is not supported or too large. Please, make sure it is of the following type: ' +
File app.component.ts
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { delay, forkJoin } from 'rxjs'
import { filter, first, map } from 'rxjs/operators'
import { DOCUMENT, getLocaleDirection, PlatformLocation, NgIf, NgClass } from '@angular/common'
import { AfterViewInit, Component, Inject, LOCALE_ID, OnInit, ViewChild } from '@angular/core'
import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
Function buildVideoPlayer
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async buildVideoPlayer (options: {
videoResponse: Response
storyboardsPromise: Promise<Response>
captionsPromise: Promise<Response>
chaptersPromise: Promise<Response>
File search.component.ts
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { NgFor, NgIf, NgTemplateOutlet } from '@angular/common'
import { Component, OnDestroy, OnInit } from '@angular/core'
import { ActivatedRoute, Router, RouterLink } from '@angular/router'
import { AuthService, HooksService, MetaService, Notifier, ServerService, User, UserService } from '@app/core'
import { immutableAssign, SimpleMemoize } from '@app/helpers'
File video-live-ending.ts
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { ffprobePromise, getAudioStream, getVideoStreamDimensionsInfo, getVideoStreamFPS } from '@peertube/peertube-ffmpeg'
import { ThumbnailType, VideoFileStream, VideoLiveEndingPayload, VideoState } from '@peertube/peertube-models'
import { peertubeTruncate } from '@server/helpers/core-utils.js'
import { CONSTRAINTS_FIELDS } from '@server/initializers/constants.js'
import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url.js'
File server-config.model.ts
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { ActorImage, VideoCommentPolicyType } from '../index.js'
import { ClientScriptJSON } from '../plugins/plugin-package-json.model.js'
import { NSFWPolicyType } from '../videos/nsfw-policy.type.js'
import { VideoPrivacyType } from '../videos/video-privacy.enum.js'
import { BroadcastMessageLevel } from './broadcast-message-level.type.js'
Function buildHandlers
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
private buildHandlers () {
const handlers: KeyHandler[] = [
// Play
{
accept: e => (e.key === ' ' || e.key === 'MediaPlayPause'),
File emailer.ts
has 293 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { arrayify } from '@peertube/peertube-core-utils'
import { EmailPayload, SendEmailDefaultOptions, UserExportState, UserRegistrationState } from '@peertube/peertube-models'
import { isTestOrDevInstance, root } from '@peertube/peertube-node-utils'
import { UserModel } from '@server/models/user/user.js'
import { readFileSync } from 'fs'
AbstractVideoQueryBuilder
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
export class AbstractVideoQueryBuilder extends AbstractRunQuery {
protected attributes: { [key: string]: string } = {}
protected joins = ''
protected where: string
VideoTableAttributes
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
export class VideoTableAttributes {
constructor (private readonly mode: 'get' | 'list') {
}
PeerTubePlugin
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class PeerTubePlugin extends Plugin {
declare private readonly videoViewUrl: () => string
declare private readonly authorizationHeader: () => string
declare private readonly initialInactivityTimeout: number
VideoMiniatureComponent
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
@Component({
selector: 'my-video-miniature',
styleUrls: [ './video-miniature.component.scss' ],
templateUrl: './video-miniature.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
PlayerOptionsBuilder
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
export class PlayerOptionsBuilder {
private autoplay: boolean
private controls: boolean
private controlBar: boolean
AbuseListTableComponent
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
@Component({
selector: 'my-abuse-list-table',
templateUrl: './abuse-list-table.component.html',
styleUrls: [ '../shared-moderation/moderation.scss', './abuse-list-table.component.scss' ],
standalone: true,
VideoWatchPage
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
export class VideoWatchPage {
constructor (private isMobileDevice: boolean, private isSafari: boolean) {
}