Showing 1,230 of 3,155 total issues
File job-queue.ts
has 451 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
FlowJob,
FlowProducer,
Job,
JobsOptions,
VideosIdListQueryBuilder
has 48 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class VideosIdListQueryBuilder extends AbstractRunQuery {
protected replacements: any = {}
private attributes: string[]
private joins: string[] = []
File client.ts
has 442 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
HttpStatusCode,
VideoChaptersObject,
VideoCommentObject,
VideoPlaylistPrivacy,
File peertube-plugin.ts
has 437 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { timeToInt } from '@peertube/peertube-core-utils'
import { VideoView, VideoViewEvent } from '@peertube/peertube-models'
import { logger } from '@root-helpers/logger'
import { isIOS, isMobile, isSafari } from '@root-helpers/web-browser'
import debug from 'debug'
Function exports
has 159 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function () {
const configuration = {
entry: {
'video-embed': './src/standalone/videos/embed.ts',
'player': './src/standalone/embed-player-api/player.ts',
File abuse-list-table.component.ts
has 423 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import * as debug from 'debug'
import { SortMeta, SharedModule } from 'primeng/api'
import { Component, Input, OnInit, ViewChild } from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router'
import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } from '@app/core'
File edit-custom-config.component.ts
has 422 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import omit from 'lodash-es/omit'
import { forkJoin } from 'rxjs'
import { SelectOptionsItem } from 'src/types/select-options-item.model'
import { Component, OnInit } from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router'
File account.ts
has 418 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Account, AccountSummary } from '@peertube/peertube-models'
import { ModelCache } from '@server/models/shared/model-cache.js'
import { FindOptions, IncludeOptions, Includeable, Op, Transaction, WhereOptions } from 'sequelize'
import {
AllowNull,
File config.ts
has 418 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import express from 'express'
import { remove, writeJSON } from 'fs-extra/esm'
import snakeCase from 'lodash-es/snakeCase.js'
import validator from 'validator'
import { ServerConfigManager } from '@server/lib/server-config-manager.js'
Function sanitizeAndCheckVideoTorrentObject
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
Open
export function sanitizeAndCheckVideoTorrentObject (video: VideoObject) {
if (!video || video.type !== 'Video') return false
const fail = (field: string) => {
logger.debug(`Video field is not valid to PeerTube: ${field}`, { 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
File video-actions-dropdown.component.ts
has 412 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { NgIf } from '@angular/common'
import { Component, EventEmitter, Input, OnChanges, Output, ViewChild, booleanAttribute } from '@angular/core'
import { AuthService, ConfirmService, Notifier, ScreenService, ServerService } from '@app/core'
import { NgbDropdown, NgbDropdownAnchor, NgbDropdownMenu } from '@ng-bootstrap/ng-bootstrap'
import { VideoCaption } from '@peertube/peertube-models'
File peertube-player.ts
has 410 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import '@peertube/videojs-contextmenu'
import './shared/upnext/end-card'
import './shared/upnext/upnext-plugin'
import './shared/stats/stats-card'
import './shared/stats/stats-plugin'
Function buildIdsListQuery
has 143 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private buildIdsListQuery (options: BuildVideosListQueryOptions) {
this.attributes = options.attributes || [ '"video"."id"' ]
if (options.group) this.group = options.group
if (options.having) this.having = options.having
VideoWatchComponent
has 42 functions (exceeds 20 allowed). Consider refactoring. Open
Open
@Component({
selector: 'my-video-watch',
templateUrl: './video-watch.component.html',
styleUrls: [ './video-watch.component.scss' ],
standalone: true,
VideosCommand
has 42 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class VideosCommand extends AbstractCommand {
getCategories (options: OverrideCommandOptions = {}) {
const path = '/api/v1/videos/categories'
Function run
has 141 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function run () {
console.log('Preparing server...')
await prepare()
Function generateNodeinfo
has 139 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function generateNodeinfo (req: express.Request, res: express.Response) {
const { totalVideos } = await VideoModel.getStats()
const { totalLocalVideoComments } = await VideoCommentModel.getStats()
const { totalUsers, totalMonthlyActiveUsers, totalHalfYearActiveUsers } = await UserModel.getStats()
File muxing-session.ts
has 397 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { wait } from '@peertube/peertube-core-utils'
import { FileStorage, LiveVideoError, VideoStreamingPlaylistType } from '@peertube/peertube-models'
import { computeOutputFPS } from '@server/helpers/ffmpeg/index.js'
import { LoggerTagsFn, logger, loggerTagsFactory } from '@server/helpers/logger.js'
import { CONFIG } from '@server/initializers/config.js'
File users.ts
has 396 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import express from 'express'
import { body, param, query } from 'express-validator'
import { forceNumber } from '@peertube/peertube-core-utils'
import { HttpStatusCode, UserRight, UserRole } from '@peertube/peertube-models'
import { exists, isBooleanValid, isIdValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc.js'
Function run
has 134 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function run () {
await initDatabaseModels(true)
const serverAccount = await getServerActor()