Showing 1,292 of 3,313 total issues
Function buildAvailableUrl
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private buildAvailableUrl (obj: any) {
const urls: string[] = []
if (obj.url) urls.push(obj.url)
if (obj.urls) {
- 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 getLiveTranscodingCommand
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
async getLiveTranscodingCommand (options: LiveTranscodingOptions) {
this.commandWrapper.debugLog('Building live transcoding command', options)
const {
inputUrl,
- 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 video-pre-import.ts
has 287 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
ThumbnailType,
ThumbnailType_Type,
VideoImportCreate,
VideoImportPayload,
Function run
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
async run (configOverrideArg?: any, options: RunServerOptions = {}) {
// These actions are async so we need to be sure that they have both been done
const serverRunString = {
'HTTP server listening': false
}
Function levenshteinDistance
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function levenshteinDistance (a: string, b: string): number {
if (a === b) {
return 0
}
Function constructor
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor (player: videojs.Player, private readonly options: PeerTubePluginOptions) {
super(player)
this.menuOpened = false
this.mouseInControlBar = false
File videos-redundancy-scheduler.ts
has 285 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { move } from 'fs-extra/esm'
import { join } from 'path'
import { getServerActor } from '@server/models/application/application.js'
import { VideoModel } from '@server/models/video/video.js'
import {
Function createEl
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
createEl () {
const div = videojs.dom.createEl('div', { className: 'vjs-peertube' })
const subDivP2P = videojs.dom.createEl('div', {
className: 'vjs-peertube-hidden' // Hide the stats before we get the info
}) as HTMLDivElement
VideoModelBuilder
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
export class VideoModelBuilder {
private videosMemo: { [ id: number ]: VideoModel }
private videoStreamingPlaylistMemo: { [ id: number ]: VideoStreamingPlaylistModel }
private videoFileMemo: { [ id: number ]: VideoFileModel }
MuxingSession
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class MuxingSession extends EventEmitter {
private transcodingWrapper: AbstractTranscodingWrapper
private readonly context: any
JobQueue
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class JobQueue {
private static instance: JobQueue
private workers: { [id in JobType]?: Worker } = {}
Function videoModelToActivityPubObject
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function videoModelToActivityPubObject (video: MVideoAP): VideoObject {
const language = video.language
? { identifier: video.language, name: getLanguageLabel(video.language) }
: undefined
Function definePluginsProgram
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function definePluginsProgram () {
const program = new Command()
program
.name('plugins')
Function process
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
process () {
const job = this.options.job
const payload = job.payload
return new Promise<void>(async (res, rej) => {
File menu.component.ts
has 282 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { CommonModule, ViewportScroller } from '@angular/common'
import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core'
import { Router, RouterLink, RouterLinkActive } from '@angular/router'
import {
AuthService,
Function constructor
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor (
private userNotificationService: UserNotificationService,
private serverService: ServerService,
private notifier: Notifier
) {
Function buildPeerTubeHelpers
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
private buildPeerTubeHelpers (pluginInfo: PluginInfo): RegisterClientHelpers {
const { plugin } = pluginInfo
const npmName = pluginInfo.plugin.npmName
return {
Function waitJobs
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function waitJobs (
serversArg: PeerTubeServer[] | PeerTubeServer,
options: {
skipDelayed?: boolean // default false
runnerJobs?: boolean // default false
Function checkObjectStorageConfig
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
function checkObjectStorageConfig () {
if (CONFIG.OBJECT_STORAGE.ENABLED !== true) return
if (!CONFIG.OBJECT_STORAGE.WEB_VIDEOS.BUCKET_NAME) {
throw new Error('videos_bucket should be set when object storage support is enabled.')
- 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 checkLatestPluginsVersion
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private async checkLatestPluginsVersion () {
if (CONFIG.PLUGINS.INDEX.ENABLED === false) return
logger.info('Checking latest plugins version.')
- 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"