Showing 1,292 of 3,313 total issues
VideoEditComponent
has 31 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,
File video-add-to-playlist.component.ts
has 326 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import debug from 'debug'
import { Subject, Subscription } from 'rxjs'
import { debounceTime, filter } from 'rxjs/operators'
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core'
import { AuthService, DisableForReuseHook, Notifier } from '@app/core'
Function up
has 95 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 323 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
AbortRunnerJobBody,
AcceptRunnerJobResult,
ErrorRunnerJobBody,
HttpStatusCode,
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'
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> {
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
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 thumbnail.ts
has 312 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { ThumbnailType, ThumbnailType_Type, VideoFileStream } from '@peertube/peertube-models'
import { generateThumbnailFromVideo } from '@server/helpers/ffmpeg/ffmpeg-image.js'
import { logger, loggerTagsFactory } from '@server/helpers/logger.js'
import Bluebird from 'bluebird'
import { FfprobeData } from 'fluent-ffmpeg'
File user-list.component.ts
has 312 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'
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 {
File download.ts
has 311 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { forceNumber, maxBy } from '@peertube/peertube-core-utils'
import { FileStorage, HttpStatusCode, VideoResolution, VideoStreamingPlaylistType } from '@peertube/peertube-models'
import { exists } from '@server/helpers/custom-validators/misc.js'
import { logger, loggerTagsFactory } from '@server/helpers/logger.js'
import { CONFIG } from '@server/initializers/config.js'
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)
Function createOptimizeOrMergeAudioJobs
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async createOptimizeOrMergeAudioJobs (options: {
video: MVideoFullLight
videoFile: MVideoFile
isNewVideo: boolean
user: MUserId