Showing 1,188 of 3,041 total issues
PluginManager
has 40 functions (exceeds 20 allowed). Consider refactoring. Open
export class PluginManager implements ServerHook {
private static instance: PluginManager
private registeredPlugins: { [name: string]: RegisteredPlugin } = {}
File server.ts
has 385 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { ChildProcess, fork } from 'child_process'
import { copy } from 'fs-extra/esm'
import { join } from 'path'
import { randomInt } from '@peertube/peertube-core-utils'
import { Video, VideoChannel, VideoChannelSync, VideoCreateResult, VideoDetails } from '@peertube/peertube-models'
ConfigCommand
has 39 functions (exceeds 20 allowed). Consider refactoring. Open
export class ConfigCommand extends AbstractCommand {
static getCustomConfigResolutions (enabled: boolean, with0p = false) {
return {
'0p': enabled && with0p,
File server-config-manager.ts
has 372 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
HTMLServerConfig,
RegisteredExternalAuthConfig,
RegisteredIdAndPassAuthConfig,
ServerConfig,
Function buildActions
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
private buildActions () {
this.videoActions = [
[
{
label: $localize`Save to playlist`,
VideoCommentModel
has 37 functions (exceeds 20 allowed). Consider refactoring. Open
@Scopes(() => ({
[ScopeNames.WITH_ACCOUNT]: {
include: [
{
model: AccountModel
File video-playlist.ts
has 368 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { forceNumber } from '@peertube/peertube-core-utils'
import {
HttpStatusCode,
VideoPlaylistCreate,
VideoPlaylistCreateResult,
File videos-list.component.ts
has 366 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as debug from 'debug'
import { fromEvent, Observable, Subject, Subscription } from 'rxjs'
import { concatMap, debounceTime, map, switchMap } from 'rxjs/operators'
import { Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges } from '@angular/core'
import { ActivatedRoute, RouterLinkActive, RouterLink } from '@angular/router'
File video-channel.ts
has 365 lines of code (exceeds 250 allowed). Consider refactoring. Open
import express from 'express'
import {
ActorImageType,
HttpStatusCode,
VideoChannelCreate,
Function getZanataContributors
has 119 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getZanataContributors () {
return [
{ username: 'abdhessuk', name: 'Abd Hessuk' },
{ username: 'abidin24', name: 'abidin toumi' },
{ username: 'aditoo', name: 'Lorem Ipsum' },
Function buildPeerTubePlayerLoadOptions
has 118 lines of code (exceeds 25 allowed). Consider refactoring. Open
private buildPeerTubePlayerLoadOptions (options: {
video: VideoDetails
liveVideo: LiveVideo
videoCaptions: VideoCaption[]
videoChapters: VideoChapter[]
File player-options-builder.ts
has 362 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { peertubeTranslate } from '@peertube/peertube-core-utils'
import {
HTMLServerConfig,
LiveVideo,
Storyboard,
Function sanitizeAndCheckVideoTorrentObject
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
function sanitizeAndCheckVideoTorrentObject (video: VideoObject) {
if (!video || video.type !== 'Video') return false
if (!setValidRemoteTags(video)) {
logger.debug('Video has invalid tags', { video })
- 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
VideoService
has 35 functions (exceeds 20 allowed). Consider refactoring. Open
@Injectable()
export class VideoService {
static BASE_VIDEO_URL = environment.apiUrl + '/api/v1/videos'
static BASE_FEEDS_URL = environment.apiUrl + '/feeds/videos.'
static PODCAST_FEEDS_URL = environment.apiUrl + '/feeds/podcast/videos.xml'
Function getSelect
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
private getSelect () {
return `SELECT
"UserNotificationModel"."id",
"UserNotificationModel"."type",
"UserNotificationModel"."read",
File user-moderation-dropdown.component.ts
has 352 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, ViewChild } from '@angular/core'
import { AuthService, ConfirmService, Notifier, ServerService } from '@app/core'
import { BulkRemoveCommentsOfBody, User, UserRight } from '@peertube/peertube-models'
import { BlocklistService } from './blocklist.service'
import { BulkService } from './bulk.service'
Function reloadDataInternal
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
protected reloadDataInternal () {
debugLogger('Loading data.')
const options = {
pagination: this.pagination,
- 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 checkMissedConfig
has 107 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',
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 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"