Showing 1,292 of 3,313 total issues
Function sendMail
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async sendMail (options: EmailPayload) {
if (!isEmailEnabled()) {
logger.info('Cannot send mail because SMTP is not configured.')
return
}
File object-to-model-attributes.ts
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { arrayify, maxBy, minBy } from '@peertube/peertube-core-utils'
import {
ActivityHashTagObject,
ActivityMagnetUrlObject,
ActivityPlaylistSegmentHashesObject,
Function buildMenu
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private buildMenu () {
const clientRoutes = this.pluginService.getAllRegisteredClientRoutesForParent('/my-account') || {}
this.menuEntries = [
{
Function constructor
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor (private config: PrimeNGConfig) {
this.config.setTranslation({
dayNames: [
$localize`Sunday`,
$localize`Monday`,
Function constructor
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor (hash: VideoServerModel, translations: { [ id: string ]: string } = {}) {
const absoluteAPIUrl = getAbsoluteAPIUrl()
this.createdAt = new Date(hash.createdAt.toString())
this.publishedAt = new Date(hash.publishedAt.toString())
VideosListComponent
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
Open
@Component({
selector: 'my-videos-list',
templateUrl: './videos-list.component.html',
styleUrls: [ './videos-list.component.scss' ],
standalone: true,
VideoUploadComponent
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
Open
@Component({
selector: 'my-video-upload',
templateUrl: './video-upload.component.html',
styleUrls: [
'../shared/video-edit.component.scss',
VideoCaptionEditModalContentComponent
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
Open
@Component({
styleUrls: [ './video-caption-edit-modal-content.component.scss' ],
templateUrl: './video-caption-edit-modal-content.component.html',
standalone: true,
imports: [
PluginService
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
Open
@Injectable()
export class PluginService implements ClientHook {
private static BASE_PLUGIN_API_URL = environment.apiUrl + '/api/v1/plugins'
private static BASE_PLUGIN_URL = environment.apiUrl + '/plugins'
Function listLocalOfServer
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async listLocalOfServer (serverId: number) {
const actor = await getServerActor()
const buildVideoInclude = () => ({
model: VideoModel,
required: true,
Function constructor
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor (player: videojs.Player, options?: P2PMediaLoaderPluginOptions) {
super(player)
this.options = options
Function ngOnInit
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ngOnInit () {
this.initialize()
this.inputFilters = this.videoAdminService.buildAdminInputFilter()
Function getLiveTranscodingCommand
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async getLiveTranscodingCommand (options: LiveTranscodingOptions) {
this.commandWrapper.debugLog('Building live transcoding command', options)
const {
inputUrl,
Function presetVOD
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export async function presetVOD (options: {
commandWrapper: FFmpegCommandWrapper
videoInputPath: string
separatedAudioInputPath?: string
File index.ts
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import express from 'express'
import { tokensRouter } from '@server/controllers/api/users/token.js'
import { Hooks } from '@server/lib/plugins/hooks.js'
import { OAuthTokenModel } from '@server/models/oauth/oauth-token.js'
import { MUserAccountDefault } from '@server/types/models/index.js'
File live-command.ts
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import { readdir } from 'fs/promises'
import { join } from 'path'
import { omit, wait } from '@peertube/peertube-core-utils'
File notifier.ts
has 262 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { UserNotificationSettingValue, UserNotificationSettingValueType } from '@peertube/peertube-models'
import { MRegistration, MUser, MUserDefault } from '@server/types/models/user/index.js'
import { MVideoBlacklistLightVideo, MVideoBlacklistVideo } from '@server/types/models/video/video-blacklist.js'
import { logger, loggerTagsFactory } from '../../helpers/logger.js'
import { CONFIG } from '../../initializers/config.js'
Function replaceVideoSourceResumable
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function replaceVideoSourceResumable (req: express.Request, res: express.Response) {
const videoPhysicalFile = res.locals.updateVideoFileResumable
const user = res.locals.oauth.token.User
const videoFile = await buildNewFile({ path: videoPhysicalFile.path, mode: 'web-video', ffprobe: res.locals.ffprobe })
File video-live.ts
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import express from 'express'
import { body } from 'express-validator'
import { isLiveLatencyModeValid } from '@server/helpers/custom-validators/video-lives.js'
import { CONSTRAINTS_FIELDS } from '@server/initializers/constants.js'
import { isLocalLiveVideoAccepted } from '@server/lib/moderation.js'
Function getUser
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
async function getUser (usernameOrEmail?: string, password?: string, bypassLogin?: BypassLogin) {
// Special treatment coming from a plugin
if (bypassLogin && bypassLogin.bypass === true) {
logger.info('Bypassing oauth login by plugin %s.', bypassLogin.pluginName)
- 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"