Showing 1,292 of 3,313 total issues
Function buildGroupedDateLabels
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
buildGroupedDateLabels () {
let currentGroupedDate: GroupDate = GroupDate.UNKNOWN
const periods = [
{
- 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 videoModelToFormattedJSON
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function videoModelToFormattedJSON (video: MVideoFormattable, options: VideoFormattingJSONOptions = {}): Video {
const span = tracer.startSpan('peertube.VideoModel.toFormattedJSON')
const userHistory = isArray(video.UserVideoHistories)
? video.UserVideoHistories[0]
Function synchronizeChannel
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export async function synchronizeChannel (options: {
channel: MChannelAccountDefault
externalChannelUrl: string
videosCountLimit: number
channelSync?: MChannelSync
Function getVideojsOptions
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getVideojsOptions (): videojs.PlayerOptions {
const html5 = {
preloadTextTracks: false,
// Prevent a bug on iOS where the text tracks added by peertube plugin are removed on play
// See https://github.com/Chocobozzz/PeerTube/issues/6351
Function buildTranscodingStream
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private async buildTranscodingStream (
options: Pick<LiveTranscodingOptions, 'inputUrl' | 'bitrate' | 'ratio' | 'probe' | 'hasAudio' | 'splitAudioAndVideo'> & {
command: FfmpegCommand
resolution: number
fps: number
Function buildChartOptions
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private buildChartOptions (graphId: ActiveGraphId): ChartConfiguration<'line' | 'bar'> {
const dataBuilders: {
[ id in ActiveGraphId ]: (rawData: ChartIngestData) => ChartBuilderResult
} = {
retention: (rawData: VideoStatsRetention) => this.buildRetentionChartOptions(rawData),
File video-table-attributes.ts
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/**
*
* Class to build video attributes/join names we want to fetch from the database
*
*/
File video-import.ts
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { buildAspectRatio } from '@peertube/peertube-core-utils'
import {
ffprobePromise,
getChaptersFromContainer, getVideoStreamDuration
} from '@peertube/peertube-ffmpeg'
File playlists-command.ts
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { omit, pick } from '@peertube/peertube-core-utils'
import {
BooleanBothQuery,
HttpStatusCode,
ResultList,
Function up
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function up (utils: {
transaction: Sequelize.Transaction
queryInterface: Sequelize.QueryInterface
sequelize: Sequelize.Sequelize
}): Promise<void> {
Function import
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async import (importModel: MUserImport) {
const resultSummary: UserImportResultSummary = {
stats: {
blocklist: this.buildSummary(),
channels: this.buildSummary(),
Function update
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async update () {
await this.waitPendingCheck()
this.forceCheck()
if (!this.form.valid || this.isUpdatingVideo === true) return
Function buildActiveFilters
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
buildActiveFilters () {
this.activeFilters = []
this.activeFilters.push({
key: 'nsfw',
Function buildVideoActions
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private buildVideoActions (): DropdownAction<ProcessedAbuse>[] {
if (!this.isAdminView()) return []
return [
{
Function sendResumableChunks
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected async sendResumableChunks <T> (options: OverrideCommandOptions & {
pathUploadId: string
path: string
videoFilePath: string
size: number
File user-notitication-list-query-builder.ts
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { Sequelize } from 'sequelize'
import { AbstractRunQuery, ModelBuilder } from '@server/models/shared/index.js'
import { UserNotificationModelForApi } from '@server/types/models/index.js'
import { ActorImageType } from '@peertube/peertube-models'
import { getSort } from '../../shared/index.js'
VideoCaptionModel
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
Open
@Scopes(() => ({
[ScopeNames.WITH_VIDEO_UUID_AND_REMOTE]: {
include: [
{
attributes: [ 'id', 'uuid', 'remote' ],
RegisterHelpers
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class RegisterHelpers {
private readonly transcodingProfiles: {
[ npmName: string ]: {
type: 'vod' | 'live'
encoder: string
AccountsComponent
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
Open
@Component({
templateUrl: './accounts.component.html',
styleUrls: [ './accounts.component.scss' ],
standalone: true,
imports: [
VideoCommentComponent
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
Open
@Component({
selector: 'my-video-comment',
templateUrl: './video-comment.component.html',
styleUrls: [ './video-comment.component.scss' ],
standalone: true,