Showing 1,189 of 3,041 total issues
File constants.ts
has 1264 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { randomInt } from '@peertube/peertube-core-utils'
import {
AbuseState,
AbuseStateType,
ActivityPubActorType,
File video-watch.component.ts
has 779 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { forkJoin, map, Observable, of, Subscription, switchMap } from 'rxjs'
import { PlatformLocation, NgClass, NgIf, NgTemplateOutlet } from '@angular/common'
import { Component, ElementRef, Inject, LOCALE_ID, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core'
import { ActivatedRoute, Router, RouterLink } from '@angular/router'
import {
File config.ts
has 699 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import bytes from 'bytes'
import { IConfig } from 'config'
import { createRequire } from 'module'
import { dirname, join } from 'path'
import {
File video-redundancy.ts
has 691 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import sample from 'lodash-es/sample.js'
import { literal, Op, QueryTypes, Transaction, WhereOptions } from 'sequelize'
import {
AllowNull,
BeforeDestroy,
Function getHTMLServerConfig
has 250 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async getHTMLServerConfig (): Promise<HTMLServerConfig> {
if (this.serverCommit === undefined) this.serverCommit = await getServerCommit()
const serverActor = await getServerActor()
Function ngOnInit
has 244 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ngOnInit () {
this.serverConfig = this.serverService.getHTMLConfig()
const formGroupData: { [key in keyof ComponentCustomConfig ]: any } = {
instance: {
File video-comment.ts
has 573 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Op, Order, QueryTypes, Sequelize, Transaction } from 'sequelize'
import {
AllowNull,
BelongsTo,
Column,
File videos-id-list-query-builder.ts
has 571 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Sequelize, Transaction } from 'sequelize'
import validator from 'validator'
import { forceNumber } from '@peertube/peertube-core-utils'
import { VideoInclude, VideoIncludeType, VideoPrivacy, VideoPrivacyType, VideoState } from '@peertube/peertube-models'
import { exists } from '@server/helpers/custom-validators/misc.js'
File video-stats.component.ts
has 564 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { ChartConfiguration, ChartData, ChartOptions, PluginOptionsByType, Scale, TooltipItem, defaults as ChartJSDefaults } from 'chart.js'
import zoomPlugin from 'chartjs-plugin-zoom'
import { Observable, of } from 'rxjs'
import { SelectOptionsItem } from 'src/types'
import { Component, Inject, LOCALE_ID, OnInit } from '@angular/core'
Function customConfig
has 234 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function customConfig (): CustomConfig {
return {
instance: {
name: CONFIG.INSTANCE.NAME,
shortDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION,
Redis
has 59 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class Redis {
private static instance: Redis
private initialized = false
private connected = false
Function buildIdsListQuery
has a Cognitive Complexity of 53 (exceeds 5 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
- 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 videos-command.ts
has 510 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/no-floating-promises */
import validator from 'validator'
import { getAllPrivacies, omit, pick, wait } from '@peertube/peertube-core-utils'
import {
File video-edit.component.ts
has 509 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { forkJoin } from 'rxjs'
import { map } from 'rxjs/operators'
import { SelectChannelItem, SelectOptionsItem } from 'src/types/select-options-item.model'
import { ChangeDetectorRef, Component, EventEmitter, Input, NgZone, OnDestroy, OnInit, Output, ViewChild } from '@angular/core'
import { AbstractControl, FormArray, FormGroup, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms'
Function onFingerSwipe
has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring. Open
Open
onFingerSwipe (direction: 'left' | 'right' | 'up' | 'down', action: () => void, removeEventOnEnd = true) {
let touchDownClientX: number
let touchDownClientY: number
const onTouchStart = (event: TouchEvent) => {
- 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 plugin-manager.ts
has 487 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import express from 'express'
import { createReadStream, createWriteStream } from 'fs'
import { ensureDir, outputFile, readJSON } from 'fs-extra/esm'
import { Server } from 'http'
import { createRequire } from 'module'
File video.service.ts
has 481 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { SortMeta } from 'primeng/api'
import { from, Observable, of, throwError } from 'rxjs'
import { catchError, concatMap, map, switchMap, toArray } from 'rxjs/operators'
import { HttpClient, HttpParams, HttpRequest } from '@angular/common/http'
import { Injectable } from '@angular/core'
File live-manager.ts
has 463 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { pick, wait } from '@peertube/peertube-core-utils'
import {
ffprobePromise,
getVideoStreamBitrate,
getVideoStreamDimensionsInfo,
File job-queue.ts
has 451 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
FlowJob,
FlowProducer,
Job,
JobsOptions,
File videos.ts
has 446 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { arrayify } from '@peertube/peertube-core-utils'
import { HttpStatusCode, ServerErrorCode, UserRight, VideoState } from '@peertube/peertube-models'
import { Redis } from '@server/lib/redis.js'
import { buildUploadXFile, safeUploadXCleanup } from '@server/lib/uploadx.js'
import { getServerActor } from '@server/models/application/application.js'