Showing 1,292 of 3,313 total issues
Function get
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async get (options: OverrideCommandOptions & {
url: string
videoFileToken?: string
reinjectVideoFileToken?: 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 upload
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async upload (options: OverrideCommandOptions & {
attributes?: VideoEdit
mode?: 'legacy' | 'resumable' // default legacy
waitTorrentGeneration?: boolean // default true
completedExpectedStatus?: HttpStatusCodeType
- 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 timeToInt
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function timeToInt (time: number | string) {
if (!time) return 0
if (typeof time === 'number') return Math.floor(time)
// Try with 00h00m00s format first
- 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 parseChapters
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function parseChapters (text: string, maxTitleLength: number) {
if (!text) return []
const lines = text.split(/\r?\n|\r|\n/g)
let foundChapters = 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
Consider simplifying this complex logical expression. Open
if (
(compacted.type === 'Create' && (compacted?.object?.type === 'WatchAction' || compacted?.object?.type === 'CacheFile')) ||
(compacted.type === 'Undo' && compacted?.object?.type === 'Create' && compacted?.object?.object.type === 'CacheFile')
) {
safe = false
Function auditLoggerWrapper
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function auditLoggerWrapper (domain: string, user: string, action: AUDIT_TYPE, entity: EntityAuditView, oldEntity: EntityAuditView = null) {
Function checkUserCanManageVideo
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export function checkUserCanManageVideo (user: MUser, video: MVideoAccountLight, right: UserRightType, res: Response, onlyOwned = true) {
Function updateCacheFile
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
cacheFileObject: CacheFileObject,
redundancyModel: MVideoRedundancy,
video: MVideoWithAllFiles,
byActor: MActorId,
t: Transaction
Function sendVideoRateChangeToOrigin
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
account: MAccountActor,
video: MVideoAccountLight,
likes: number,
dislikes: number,
t: Transaction
Function sendVideoRateChange
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
account: MAccountActor,
video: MVideoFullLight,
likes: number,
dislikes: number,
t: Transaction
Function defaultRender
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
const defaultRender = markdownIt.renderer.rules.link_open || function (tokens, idx, options, env, self) {
Function link_open
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
markdownIt.renderer.rules.link_open = function (tokens, index, options, env, self) {
Function min
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function min (d0: number, d1: number, d2: number, bx: number, ay: number) {
Function containsTags
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function containsTags (loggerTags: string[], optionsTags: string[]) {
if (!loggerTags) return false
for (const lt of loggerTags) {
for (const ot of optionsTags) {
- 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 toActivityPubObject
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
toActivityPubObject (this: MCommentAP, threadParentComments: MCommentOwner[]): VideoCommentObject | ActivityTombstoneObject {
const inReplyTo = this.inReplyToCommentId === null
? this.Video.url // New thread, so we reply to the video
: this.InReplyToVideoComment.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 buildMainQuery
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private buildMainQuery (options: BuildVideosListQueryOptions, serverActor: MActorAccount) {
this.attributes = {
'"video".*': ''
}
- 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 migrate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function migrate () {
const tables = await sequelizeTypescript.getQueryInterface().showAllTables()
// No tables, we don't need to migrate anything
// The installer will do that
- 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 checkEmailConfig
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function checkEmailConfig () {
if (!isEmailEnabled()) {
if (CONFIG.SIGNUP.ENABLED && CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION) {
throw new Error('SMTP is not configured but you require signup email verification.')
}
- 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 run
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function run () {
console.log('Moving private video files in dedicated folders.')
await ensureDir(DIRECTORIES.HLS_STREAMING_PLAYLIST.PRIVATE)
await ensureDir(DIRECTORIES.WEB_VIDEOS.PRIVATE)
- 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 buildVideoExtMimetype
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function buildVideoExtMimetype (obj: { [ id: string ]: string | string[] }) {
const result: { [id: string]: string } = {}
for (const mimetype of Object.keys(obj)) {
const value = obj[mimetype]
- 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"