Showing 1,292 of 3,313 total issues
Function runMetricsInterval
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private runMetricsInterval () {
if (this.metricsInterval) clearInterval(this.metricsInterval)
if (!this.options_.metricsUrl()) return
this.metricsInterval = setInterval(() => {
- 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 processDeleteActivity
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
async function processDeleteActivity (options: APProcessorOptions<ActivityDelete>) {
const { activity, byActor } = options
const objectUrl = typeof activity.object === 'string' ? activity.object : activity.object.id
- 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 initDatabaseModels
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function initDatabaseModels (silent: boolean) {
sequelizeTypescript.addModels([
ApplicationModel,
ActorModel,
ActorFollowModel,
File abstract-video-query-builder.ts
has 280 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Sequelize } from 'sequelize'
import validator from 'validator'
import { MUserAccountId } from '@server/types/models/index.js'
import { ActorImageType } from '@peertube/peertube-models'
import { AbstractRunQuery } from '../../../../shared/abstract-run-query.js'
Function sanitize
has 68 lines of code (exceeds 25 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
Function run
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function run () {
const typesPath = currentDir(import.meta.url)
const typesDistTMPPath = join(typesPath, 'dist-tmp')
await remove(typesDistTMPPath)
EditBasicConfigurationComponent
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
@Component({
selector: 'my-edit-basic-configuration',
templateUrl: './edit-basic-configuration.component.html',
styleUrls: [ './edit-custom-config.component.scss' ],
standalone: true,
MenuComponent
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
@Component({
selector: 'my-menu',
templateUrl: './menu.component.html',
styleUrls: [ './menu.component.scss' ],
standalone: true,
File process-live.ts
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { wait } from '@peertube/peertube-core-utils'
import {
ffprobePromise,
getVideoStreamBitrate,
getVideoStreamDimensionsInfo,
Function runMuxingSession
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async runMuxingSession (options: {
sessionId: string
videoLive: MVideoLiveVideoWithSetting
user: MUser
File video-comments.ts
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { arrayify } from '@peertube/peertube-core-utils'
import { HttpStatusCode, UserRight, VideoCommentPolicy } from '@peertube/peertube-models'
import { isStringArray } from '@server/helpers/custom-validators/search.js'
import { canVideoBeFederated } from '@server/lib/activitypub/videos/federate.js'
import { MUserAccountUrl } from '@server/types/models/index.js'
File video-miniature.component.ts
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { switchMap } from 'rxjs/operators'
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
Function plainTextPlugin
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
function plainTextPlugin (markdownIt: any) {
function plainTextRule (state: any) {
const text = scan(state.tokens)
markdownIt.plainText = text
- 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 videoPlaylistsGetValidator
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
const videoPlaylistsGetValidator = (fetchType: VideoPlaylistFetchType) => {
return [
isValidPlaylistIdParam('playlistId'),
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
- 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 presetVOD
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
export async function presetVOD (options: {
commandWrapper: FFmpegCommandWrapper
videoInputPath: string
separatedAudioInputPath?: string
- 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 secondsToTime
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
export function secondsToTime (options: {
seconds: number
format: 'short' | 'full' | 'locale-string' // default 'short'
symbol?: string
} | number) {
- 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 up
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function up (utils: {
transaction: Sequelize.Transaction
queryInterface: Sequelize.QueryInterface
sequelize: Sequelize.Sequelize
}): Promise<void> {
Function buildVideosHelpers
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildVideosHelpers () {
return {
loadByUrl: (url: string) => {
return VideoModel.loadByUrl(url)
},
File audit-logger.ts
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
AdminAbuse,
CustomConfig,
User,
VideoChannel,
Function defineRedundancyProgram
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function defineRedundancyProgram () {
const program = new Command()
.name('redundancy')
.description('Manage instance redundancies')
.alias('r')