Showing 1,292 of 3,313 total issues
Function addVideoJobsAfterUpdate
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function addVideoJobsAfterUpdate (options: {
video: MVideoFullLight
isNewVideoForFederation: boolean
nameChanged: boolean
Function buildSystemItems
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private buildSystemItems () {
const systemItems: TopMenuDropdownParam = {
label: $localize`System`,
children: []
}
Function resolveRemoteParentComment
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function resolveRemoteParentComment (params: ResolveThreadParams) {
const { url, comments } = params
if (comments.length > ACTIVITY_PUB.MAX_RECURSION_COMMENTS) {
throw new Error('Recursion limit reached when resolving a thread')
Function getP2PMediaLoaderOptions
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private getP2PMediaLoaderOptions (options: {
redundancyUrlManager: RedundancyUrlManager | null
segmentValidator: SegmentValidator | null
}): HlsJsEngineSettings {
const { redundancyUrlManager, segmentValidator } = options
Function constructor
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor (player: videojs.Player, options?: SettingsMenuItemOptions) {
super(player, options)
this.settingsButton = options.menuButton
this.dialog = this.settingsButton.dialog
Function tryToResolveThreadFromVideo
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function tryToResolveThreadFromVideo (params: ResolveThreadParams) {
const { url, comments, commentCreated } = params
// Maybe it's a reply to a video?
// If yes, it's done: we resolved all the thread
Function fetchPage
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private fetchPage (currentVideo: VideoDetails, totalItems: number): Observable<Video[]> {
const pagination = { currentPage: 1, itemsPerPage: totalItems }
return this.userService.getAnonymousOrLoggedUser()
.pipe(
Function goLive
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
goLive () {
if (this.isOrHasGoingLive) return
this.isOrHasGoingLive = true
const name = 'Live'
Function buildCommonLinks
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildCommonLinks (config: HTMLServerConfig): MenuSection {
let links: MenuLink[] = []
if (config.homepage.enabled) {
links.push({
Function checkLiveConfig
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function checkLiveConfig () {
if (CONFIG.LIVE.ENABLED === true) {
if (CONFIG.LIVE.ALLOW_REPLAY === true && CONFIG.TRANSCODING.ENABLED === false) {
throw new Error('Live allow replay cannot be enabled if transcoding is not enabled.')
}
- 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 videoLiveAddValidator
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
if (areValidationErrors(req, res)) return cleanUpReqFiles(req)
if (!isValidPasswordProtectedPrivacy(req, res)) return cleanUpReqFiles(req)
- 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 install
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
async install (options: {
toInstall: string
version?: string
fromDisk?: boolean // default false
register?: boolean // default true
- 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 buildVideosHelpers
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function buildVideosHelpers () {
return {
loadByUrl: (url: string) => {
return VideoModel.loadByUrl(url)
},
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
protected sanitize (o: UserSettingsExportJSON) {
if (!isUserNSFWPolicyValid(o.nsfwPolicy)) o.nsfwPolicy = undefined
if (!isUserAutoPlayVideoValid(o.autoPlayVideo)) o.autoPlayVideo = undefined
if (!isUserAutoPlayNextVideoValid(o.autoPlayNextVideo)) o.autoPlayNextVideo = undefined
if (!isUserAutoPlayNextVideoPlaylistValid(o.autoPlayNextVideoPlaylist)) o.autoPlayNextVideoPlaylist = 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 cleanupImportedStaticFilePaths
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected async cleanupImportedStaticFilePaths (archiveFiles: Record<string, string | Record<string, string>>) {
if (!archiveFiles || typeof archiveFiles !== 'object') return
for (const file of Object.values(archiveFiles)) {
if (!file) continue
- 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 buildMuxInput
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
async function buildMuxInput (
video: MVideo,
videoFile: MVideoFile
): Promise<{ input: Readable, isTmpDestination: false } | { input: string, isTmpDestination: boolean }> {
- 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 processVideosViewsStats
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
async function processVideosViewsStats () {
const lastHour = new Date()
// In test mode, we run this function multiple times per hour, so we don't want the values of the previous hour
if (!isTestOrDevInstance()) lastHour.setHours(lastHour.getHours() - 1)
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
protected async importObject (channelImportData: SanitizedObject) {
const account = this.user.Account
const existingChannel = await VideoChannelModel.loadLocalByNameAndPopulateAccount(channelImportData.name)
if (existingChannel) {
- 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 createTranscodingJobs
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
async createTranscodingJobs (options: {
transcodingType: 'hls' | 'webtorrent' | 'web-video' // TODO: remove webtorrent in v7
video: MVideoFullLight
resolutions: number[]
isNewVideo: boolean
- 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 disposeDynamicPluginsIfNeeded
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private disposeDynamicPluginsIfNeeded () {
if (!this.player) return
if (this.player.usingPlugin('peertubeMobile')) this.player.peertubeMobile().dispose()
if (this.player.usingPlugin('peerTubeHotkeysPlugin')) this.player.peerTubeHotkeysPlugin().dispose()
- 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"