Showing 1,292 of 3,313 total issues
Function parseBytes
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function parseBytes (value: string | number): number {
if (typeof value === 'number') return value
if (!isNaN(+value)) return +value
const tgm = /^(\d+)\s*TB\s*(\d+)\s*GB\s*(\d+)\s*MB$/
Function buildFeedMetadata
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function buildFeedMetadata (options: {
videoChannel?: MChannelBannerAccountDefault
account?: MAccountDefault
video?: MVideoFullLight
}) {
Function handleTorrentImport
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function handleTorrentImport (req: express.Request, res: express.Response, torrentfile: Express.Multer.File) {
const body: VideoImportCreate = req.body
const user = res.locals.oauth.token.User
let videoName: string
Function addLiveVideo
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function addLiveVideo (req: express.Request, res: express.Response) {
const videoInfo: LiveVideoCreate = req.body
const thumbnails = [ { type: ThumbnailType.MINIATURE, field: 'thumbnailfile' }, { type: ThumbnailType.PREVIEW, field: 'previewfile' } ]
.map(({ type, field }) => {
Function createZip
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
private createZip (options: {
exportModel: MUserExport
user: MUserDefault
output: Writable
}) {
Function generateLocalVideoMiniature
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function generateLocalVideoMiniature (options: {
video: MVideoThumbnail
videoFile: MVideoFile
types: ThumbnailType_Type[]
ffprobe: FfprobeData
Function buildTimeserieChartOptions
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
private buildTimeserieChartOptions (rawData: VideoStatsTimeserie): ChartBuilderResult {
const labels: string[] = []
const data: number[] = []
for (const d of rawData.data) {
Function checkObjectStorageConfig
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function checkObjectStorageConfig () {
if (CONFIG.OBJECT_STORAGE.ENABLED !== true) return
if (!CONFIG.OBJECT_STORAGE.WEB_VIDEOS.BUCKET_NAME) {
throw new Error('videos_bucket should be set when object storage support is enabled.')
Function ngOnInit
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
ngOnInit () {
this.initialize()
this.bulkActions = [
{
Function run
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
async function run () {
await initDatabaseModels(true)
const serverAccount = await getServerActor()
- 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 videoStudioAddEditionValidator
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
if (CONFIG.VIDEO_STUDIO.ENABLED !== true) {
res.fail({
status: HttpStatusCode.BAD_REQUEST_400,
message: 'Video studio is disabled on this instance'
- 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 muxToMergeVideoFiles
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export async function muxToMergeVideoFiles (options: {
video: MVideoThumbnail
videoFiles: MVideoFile[]
output: Writable
}) {
- 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 processCreateVideoComment
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
async function processCreateVideoComment (
activity: ActivityCreate<VideoCommentObject | string>,
commentObject: VideoCommentObject,
byActor: MActorSignature,
fromFetch: 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 processVideo
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function processVideo (videoId: number) {
const video = await VideoModel.loadWithFiles(videoId)
const hls = video.getHLSPlaylist()
if (video.isLive || !hls || hls.playlistFilename !== 'master.m3u8' || hls.VideoFiles.length === 0) {
Function isPackageJSONValid
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function isPackageJSONValid (packageJSON: PluginPackageJSON, pluginType: PluginType_Type) {
let result = true
const badFields: string[] = []
if (!isNpmPluginNameValid(packageJSON.name)) {
Function addLocalViewer
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
async addLocalViewer (options: {
video: MVideoImmutable
currentTime: number
ip: string
sessionId: string
Function sendDeleteVideoComment
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function sendDeleteVideoComment (videoComment: MCommentOwnerVideo, transaction: Transaction) {
logger.info('Creating job to send delete of comment %s.', videoComment.url)
const isVideoOrigin = videoComment.Video.isOwned()
Function processVideoStudioEdition
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function processVideoStudioEdition (job: Job) {
const payload = job.data as VideoStudioEditionPayload
const lTags = lTagsBase(payload.videoUUID)
logger.info('Process video studio edition of %s in job %s.', payload.videoUUID, job.id, lTags)
Function runStats
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
private runStats () {
this.p2pEngine.on(Events.PieceBytesDownloaded, (method: string, _segment, bytes: number) => {
const elem = method === 'p2p' ? this.statsP2PBytes : this.statsHTTPBytes
elem.pendingDownload.push(bytes)
Function buildModerationItems
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
private buildModerationItems () {
const moderationItems: TopMenuDropdownParam = {
label: $localize`Moderation`,
children: []
}