Showing 1,292 of 3,313 total issues
Function buildLowerResolutionJobPayloads
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async buildLowerResolutionJobPayloads (options: {
video: MVideoFullLight
inputVideoResolution: number
inputVideoFPS: number
hasAudio: boolean
Function init
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async init () {
// Before HTML rendering restore line feed for markdown list compatibility
const commentText = this.comment.text.replace(/<br.?\/?>/g, '\r\n')
const html = await this.markdownService.textMarkdownToHTML({ markdown: commentText, withHtml: true, withEmoji: true })
this.sanitizedCommentHTML = this.markdownService.processVideoTimestamps(this.video.shortUUID, html)
Function ngOnInit
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
ngOnInit () {
this.video = this.route.snapshot.data.video
this.availableCharts = [
{
Function run
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function run () {
await initDatabaseModels(true)
displayPeerTubeMustBeStoppedWarning()
Function getTimeserieStats
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async getTimeserieStats (options: {
video: MVideo
metric: VideoStatsTimeserieMetric
startDate: string
endDate: string
Function reportAbuse
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function reportAbuse (req: express.Request, res: express.Response) {
const videoInstance = res.locals.videoAll
const commentInstance = res.locals.videoCommentFull
const accountInstance = res.locals.account
Function moveToJob
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function moveToJob (options: {
jobId: string
videoUUID: string
loggerTags: (number | string)[]
Function install
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
async install (options: {
toInstall: string
version?: string
fromDisk?: boolean // default false
register?: boolean // default true
Function addVideoJobsAfterCreation
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function addVideoJobsAfterCreation (options: {
video: MVideo
videoFile: MVideoFile
generateTranscription: boolean
}) {
Function create
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
async create (options: CreateOptions) {
const { video, priority, tasks } = options
const jobUUID = buildUUID()
const { separatedAudioFile } = video.getMaxQualityAudioAndVideoFiles()
Function buildOverallStatCard
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
private buildOverallStatCard (overallStats: VideoStatsOverall) {
this.globalStatsCards = [
{
label: $localize`Views`,
value: this.numberFormatter.transform(this.video.views),
Function processWebVideoTranscoding
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function processWebVideoTranscoding (options: ProcessOptions<RunnerJobVODWebVideoTranscodingPayload>) {
const { server, job, runnerToken } = options
const payload = job.payload
Function checkLocalRedundancyConfig
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function checkLocalRedundancyConfig () {
const redundancyVideos = CONFIG.REDUNDANCY.VIDEOS.STRATEGIES
if (isArray(redundancyVideos)) {
const available = [ 'most-views', 'trending', 'recently-added' ]
- 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 buildModerationHelpers
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function buildModerationHelpers () {
return {
blockServer: async (options: { byAccountId: number, hostToBlock: string }) => {
const serverToBlock = await ServerModel.loadOrCreateByHost(options.hostToBlock)
const user = await UserModel.loadByAccountId(options.byAccountId)
- 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 sanitize
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected sanitize (o: ImportObject) {
if (!isVideoPlaylistTypeValid(o.type)) return undefined
if (!isVideoPlaylistNameValid(o.displayName)) return undefined
if (!isVideoPlaylistPrivacyValid(o.privacy)) return undefined
if (!isArray(o.elements)) return undefined
- 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 importObject
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected async importObject (videoImportData: SanitizedObject) {
const videoFilePath = !videoImportData.isLive
? this.getSafeArchivePathOrThrow(videoImportData.archiveFiles.videoFile)
: null
- 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 processActivities
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
export async function processActivities (
activities: Activity[],
options: {
signatureActor?: MActorSignature
inboxActor?: MActorDefault
- 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 getOrCreateAPVideo
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
export async function getOrCreateAPVideo (
options: GetVideoParamAll | GetVideoParamImmutable | GetVideoParamOther
): GetVideoResult<MVideoAccountLightBlacklistAllFiles | MVideoThumbnailBlacklist | MVideoImmutable> {
// Default params
const syncParam = options.syncParam || { rates: true, shares: true, comments: true, refreshVideo: false }
- 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 buildActions
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private buildActions () {
this.videoActions = [
[
{
label: $localize`Save to playlist`,
- 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 buildTitle
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private buildTitle (scope: VideoFilterScope = this.defaultScope, sort: VideoSortField = this.defaultSort) {
const sanitizedSort = this.getSanitizedSort(sort)
if (scope === 'local') {
this.title = $localize`Local videos`
- 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"