Showing 1,292 of 3,313 total issues
Function update
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
async update () {
await this.waitPendingCheck()
this.forceCheck()
if (!this.form.valid || this.isUpdatingVideo === true) return
- 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 objectToFormData
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function objectToFormData (obj: any, form?: FormData, namespace?: string) {
const fd = form || new FormData()
let formKey
for (const key of Object.keys(obj)) {
- 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 getEncoderBuilderResult
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
async getEncoderBuilderResult (options: EncoderOptionsBuilderParams & {
streamType: 'video' | 'audio'
input: string
videoType: 'vod' | 'live'
- 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 buildFields
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function buildFields (req: request.Test, fields: { [ fieldName: string ]: any }, namespace?: string) {
if (!fields) return
let formKey: string
- 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 toFormattedJSONStatic
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
static toFormattedJSONStatic (video: MVideoForRedundancyAPI): VideoRedundancy {
const filesRedundancies: FileRedundancyInformation[] = []
const streamingPlaylistsRedundancies: StreamingPlaylistRedundancyInformation[] = []
for (const file of video.VideoFiles) {
Function run
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function run () {
console.log('Generate avatar miniatures from existing avatars.')
await initDatabaseModels(true)
JobQueue.Instance.init()
Function buildVideoFileUrls
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildVideoFileUrls (options: {
video: MVideo
files: MVideoFile[]
user?: MUserId
}): ActivityUrlObject[] {
Function buildOEmbed
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildOEmbed (options: {
req: express.Request
title: string
channel: MChannelSummary
previewPath: string | null
Function createVideoPlaylist
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function createVideoPlaylist (req: express.Request, res: express.Response) {
const videoPlaylistInfo: VideoPlaylistCreate = req.body
const user = res.locals.oauth.token.User
const videoPlaylist = new VideoPlaylistModel({
Function usersCommonRegistrationValidatorFactory
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function usersCommonRegistrationValidatorFactory (additionalValidationChain: ValidationChain[] = []) {
return [
body('username')
.custom(isUserUsernameValid),
body('password')
Function generateVideoCaptionValidator
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
if (areValidationErrors(req, res)) return
if (CONFIG.VIDEO_TRANSCRIPTION.ENABLED !== true) {
return res.fail({
Function getAccountOrChannelHTMLPage
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static async getAccountOrChannelHTMLPage (
loader: () => Promise<MAccountHost | MChannelHost>,
req: express.Request,
res: express.Response
) {
Function handleOAuthToken
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function handleOAuthToken (req: express.Request, options: { refreshTokenAuthName?: string, bypassLogin?: BypassLogin }) {
const request = new Request(req)
const { refreshTokenAuthName, bypassLogin } = options
if (request.method !== 'POST') {
Function buildMuxInput
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function buildMuxInput (
video: MVideo,
videoFile: MVideoFile
): Promise<{ input: Readable, isTmpDestination: false } | { input: string, isTmpDestination: boolean }> {
Function mergeAudioVideofile
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function mergeAudioVideofile (options: {
video: MVideoFullLight
resolution: number
fps: number
job: Job
Function processCreateVideoComment
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function processCreateVideoComment (
activity: ActivityCreate<VideoCommentObject | string>,
commentObject: VideoCommentObject,
byActor: MActorSignature,
fromFetch: false
Function getFileAttributesFromUrl
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getFileAttributesFromUrl (
videoOrPlaylist: MVideo | MStreamingPlaylistVideo,
urls: (ActivityTagObject | ActivityUrlObject)[]
) {
const fileUrls = urls.filter(u => isAPVideoUrlObject(u))
Function getTranscodingResolutions
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
getTranscodingResolutions () {
return [
{
id: '0p',
label: $localize`Audio-only`,
Function ngOnInit
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
ngOnInit () {
this.routeSub = this.route.params
.pipe(
map(params => params['videoChannelName']),
distinctUntilChanged(),
Function buildMyAccountModerationActions
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private buildMyAccountModerationActions () {
if (!this.account || !this.displayOptions.myAccount || !this.authService.isLoggedIn()) return []
const myAccountActions: DropdownAction<{ user: User, account: AccountMutedStatus }>[] = [
{