Showing 1,230 of 3,155 total issues
File config-command.ts
has 389 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { About, ActorImageType, ActorImageType_Type, CustomConfig, HttpStatusCode, ServerConfig } from '@peertube/peertube-models'
import { DeepPartial } from '@peertube/peertube-typescript-utils'
import merge from 'lodash-es/merge.js'
import { AbstractCommand, OverrideCommandOptions } from '../shared/abstract-command.js'
File server.ts
has 389 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { randomInt } from '@peertube/peertube-core-utils'
import { Video, VideoChannel, VideoChannelSync, VideoCreateResult, VideoDetails } from '@peertube/peertube-models'
import { parallelTests, root } from '@peertube/peertube-node-utils'
import { ChildProcess, fork } from 'child_process'
import { copy } from 'fs-extra/esm'
VideoCommentModel
has 40 functions (exceeds 20 allowed). Consider refactoring. Open
Open
@Scopes(() => ({
[ScopeNames.WITH_ACCOUNT]: {
include: [
{
model: AccountModel
PluginManager
has 40 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class PluginManager implements ServerHook {
private static instance: PluginManager
private registeredPlugins: { [name: string]: RegisteredPlugin } = {}
ConfigCommand
has 39 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class ConfigCommand extends AbstractCommand {
static getCustomConfigResolutions (enabled: boolean, with0p = false) {
return {
'0p': enabled && with0p,
File server-config-manager.ts
has 374 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
HTMLServerConfig,
RegisteredExternalAuthConfig,
RegisteredIdAndPassAuthConfig,
ServerConfig,
Function buildActions
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private buildActions () {
this.videoActions = [
[
{
label: $localize`Save to playlist`,
File video-playlist.ts
has 368 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { forceNumber } from '@peertube/peertube-core-utils'
import {
HttpStatusCode,
VideoPlaylistCreate,
VideoPlaylistCreateResult,
File videos-list.component.ts
has 366 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import * as debug from 'debug'
import { fromEvent, Observable, Subject, Subscription } from 'rxjs'
import { concatMap, debounceTime, map, switchMap } from 'rxjs/operators'
import { Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges } from '@angular/core'
import { ActivatedRoute, RouterLinkActive, RouterLink } from '@angular/router'
File video-channel.ts
has 365 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import express from 'express'
import {
ActorImageType,
HttpStatusCode,
VideoChannelCreate,
Function getZanataContributors
has 119 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getZanataContributors () {
return [
{ username: 'abdhessuk', name: 'Abd Hessuk' },
{ username: 'abidin24', name: 'abidin toumi' },
{ username: 'aditoo', name: 'Lorem Ipsum' },
Function buildPeerTubePlayerLoadOptions
has 118 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private buildPeerTubePlayerLoadOptions (options: {
video: VideoDetails
liveVideo: LiveVideo
videoCaptions: VideoCaption[]
videoChapters: VideoChapter[]
File player-options-builder.ts
has 362 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { peertubeTranslate } from '@peertube/peertube-core-utils'
import {
HTMLServerConfig,
LiveVideo,
Storyboard,
Function getSelect
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private getSelect () {
return `SELECT
"UserNotificationModel"."id",
"UserNotificationModel"."type",
"UserNotificationModel"."read",
VideoService
has 35 functions (exceeds 20 allowed). Consider refactoring. Open
Open
@Injectable()
export class VideoService {
static BASE_VIDEO_URL = environment.apiUrl + '/api/v1/videos'
static BASE_FEEDS_URL = environment.apiUrl + '/feeds/videos.'
static PODCAST_FEEDS_URL = environment.apiUrl + '/feeds/podcast/videos.xml'
File user-moderation-dropdown.component.ts
has 352 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, ViewChild } from '@angular/core'
import { AuthService, ConfirmService, Notifier, ServerService } from '@app/core'
import { BulkRemoveCommentsOfBody, User, UserRight } from '@peertube/peertube-models'
import { BlocklistService } from './blocklist.service'
import { BulkService } from './bulk.service'
Function reloadDataInternal
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
Open
protected reloadDataInternal () {
debugLogger('Loading data.')
const options = {
pagination: this.pagination,
- 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 updateVideo
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function updateVideo (req: express.Request, res: express.Response) {
const videoFromReq = res.locals.videoAll
const oldVideoAuditView = new VideoAuditView(videoFromReq.toFormattedDetailsJSON())
const videoInfoToUpdate: VideoUpdate = req.body
AccountModel
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
Open
@DefaultScope(() => ({
include: [
{
model: ActorModel, // Default scope includes avatar and server
required: true
Function getOverallStats
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async getOverallStats (options: {
video: MVideo
startDate?: string
endDate?: string
}): Promise<VideoStatsOverall> {