Showing 1,230 of 3,155 total issues
Function create
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async create () {
this.video = new VideoModel(
await Hooks.wrapObject(this.buildVideo(this.videoAttributes, this.channel), this.videoAttributeResultHook)
) as MVideoFullLight
Function defineAuthProgram
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function defineAuthProgram () {
const program = new Command()
.name('auth')
.description('Register your accounts on remote instances to use them with other commands')
File video-comment-list-query-builder.ts
has 321 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { ActorImageType, VideoPrivacy } from '@peertube/peertube-models'
import { AbstractRunQuery, ModelBuilder } from '@server/models/shared/index.js'
import { Model, Sequelize, Transaction } from 'sequelize'
import { createSafeIn, getSort, parseRowCountResult } from '../../../shared/index.js'
import { VideoCommentTableAttributes } from './video-comment-table-attributes.js'
File thumbnail.ts
has 321 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { join } from 'path'
import { ThumbnailType, ThumbnailType_Type } from '@peertube/peertube-models'
import { generateImageFilename } from '../helpers/image-utils.js'
import { CONFIG } from '../initializers/config.js'
import { ASSETS_PATH, PREVIEWS_SIZE, THUMBNAILS_SIZE } from '../initializers/constants.js'
VideoStatsComponent
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
Open
@Component({
templateUrl: './video-stats.component.html',
styleUrls: [ './video-stats.component.scss' ],
providers: [ NumberFormatterPipe ],
standalone: true,
Function buildAbuseListQuery
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
Open
function buildAbuseListQuery (options: BuildAbusesQueryOptions, type: 'count' | 'id') {
const whereAnd: string[] = []
const replacements: any = {}
const joins = [
- 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 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function up (utils: {
transaction: Sequelize.Transaction
queryInterface: Sequelize.QueryInterface
sequelize: Sequelize.Sequelize
}): Promise<void> {
File jobs.ts
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import express, { UploadFiles } from 'express'
import { retryTransactionWrapper } from '@server/helpers/database-utils.js'
import { createReqFiles } from '@server/helpers/express-utils.js'
import { logger, loggerTagsFactory } from '@server/helpers/logger.js'
import { generateRunnerJobToken } from '@server/helpers/token-generator.js'
Function up
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function up (utils: {
transaction: Sequelize.Transaction
queryInterface: Sequelize.QueryInterface
sequelize: Sequelize.Sequelize
db: any
File video-list.component.ts
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { DatePipe, NgClass, NgFor, NgIf } from '@angular/common'
import { Component, OnInit, ViewChild } from '@angular/core'
import { ActivatedRoute, Router, RouterLink } from '@angular/router'
import { AuthService, ConfirmService, Notifier, RestPagination, RestTable } from '@app/core'
import { formatICU, getAbsoluteAPIUrl } from '@app/helpers'
VideoAddToPlaylistComponent
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
Open
@Component({
selector: 'my-video-add-to-playlist',
styleUrls: [ './video-add-to-playlist.component.scss' ],
templateUrl: './video-add-to-playlist.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
File local-video-viewer.ts
has 312 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { QueryTypes } from 'sequelize'
import { AllowNull, BelongsTo, Column, CreatedAt, DataType, Default, ForeignKey, HasMany, IsUUID, Table } from 'sequelize-typescript'
import { getActivityStreamDuration } from '@server/lib/activitypub/activity.js'
import { buildGroupByAndBoundaries } from '@server/lib/timeserie.js'
import { MLocalVideoViewer, MLocalVideoViewerWithWatchSections, MVideo } from '@server/types/models/index.js'
File video-update.component.ts
has 312 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import debug from 'debug'
import { UploadState, UploadxService } from 'ngx-uploadx'
import { of, Subject, Subscription } from 'rxjs'
import { catchError, map, switchMap } from 'rxjs/operators'
import { SelectChannelItem } from 'src/types/select-options-item.model'
File signup.e2e-spec.ts
has 312 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { AdminConfigPage } from '../po/admin-config.po'
import { AdminRegistrationPage } from '../po/admin-registration.po'
import { LoginPage } from '../po/login.po'
import { SignupPage } from '../po/signup.po'
import {
Function listForApi
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static listForApi (options: {
start: number
count: number
sort: string
target: VideoRedundanciesTarget
Function processGenerateStoryboard
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function processGenerateStoryboard (job: Job): Promise<void> {
const payload = job.data as GenerateStoryboardPayload
const lTags = lTagsBase(payload.videoUUID)
logger.info('Processing generate storyboard of %s in job %s.', payload.videoUUID, job.id, lTags)
File user-list.component.ts
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { DatePipe, NgClass, NgIf } from '@angular/common'
import { Component, OnInit, ViewChild } from '@angular/core'
import { FormsModule } from '@angular/forms'
import { ActivatedRoute, Router, RouterLink } from '@angular/router'
import { AuthService, ConfirmService, LocalStorageService, Notifier, RestPagination, RestTable } from '@app/core'
Function buildVideosFromRows
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
Open
buildVideosFromRows (options: {
rows: SQLRow[]
include?: VideoIncludeType
rowsWebVideoFiles?: SQLRow[]
rowsStreamingPlaylist?: SQLRow[]
- 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 users-command.ts
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { omit, pick } from '@peertube/peertube-core-utils'
import {
HttpStatusCode,
MyUser,
ResultList,
VideoEditComponent
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
Open
@Component({
selector: 'my-video-edit',
styleUrls: [ './video-edit.component.scss' ],
templateUrl: './video-edit.component.html',
standalone: true,