Showing 1,292 of 3,313 total issues
Function buildTranscodingStream
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private async buildTranscodingStream (
options: Pick<LiveTranscodingOptions, 'inputUrl' | 'bitrate' | 'ratio' | 'probe' | 'hasAudio' | 'splitAudioAndVideo'> & {
command: FfmpegCommand
resolution: number
fps: number
- 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 buildVideoPlayer
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private async buildVideoPlayer (options: {
videoResponse: Response
storyboardsPromise: Promise<Response>
captionsPromise: Promise<Response>
chaptersPromise: Promise<Response>
- 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 levenshteinDistance
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
export function levenshteinDistance (a: string, b: string): number {
if (a === b) {
return 0
}
- 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 getQuery
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getQuery = (forCount: boolean) => {
const query: FindOptions = {
offset: start,
limit: count,
order: getSort(sort),
Function up
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function up (utils: {
transaction: Sequelize.Transaction
queryInterface: Sequelize.QueryInterface
sequelize: Sequelize.Sequelize
}): Promise<void> {
Function updateMe
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function updateMe (req: express.Request, res: express.Response) {
const body: UserUpdateMe = req.body
let sendVerificationEmail = false
const user = res.locals.oauth.token.user
Function export
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
async export () {
const playlistsJSON: VideoPlaylistsExportJSON['videoPlaylists'] = []
const staticFiles: ExportResult<VideoPlaylistsExportJSON>['staticFiles'] = []
const playlists = await VideoPlaylistModel.listPlaylistForExport(this.user.Account.id)
Function export
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
async export (exportModel: MUserExport) {
try {
exportModel.state = UserExportState.PROCESSING
await saveInTransactionWithRetries(exportModel)
Function muxToMergeVideoFiles
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function muxToMergeVideoFiles (options: {
video: MVideoThumbnail
videoFiles: MVideoFile[]
output: Writable
}) {
Function metricsInterval
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.metricsInterval = setInterval(() => {
let resolution: number
let fps: number
if (this.player.usingPlugin('p2pMediaLoader')) {
Function prepare
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function prepare () {
pool = new Piscina({
filename: join(dirname(fileURLToPath(import.meta.url)), 'simulate-many-viewers-worker.js'),
minThreads: 20,
maxThreads: 20
Function ngOnInit
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
ngOnInit () {
this.initialize()
this.bulkActions = [
[
Function getVideoAttributesFromObject
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getVideoAttributesFromObject (videoChannel: MChannelId, videoObject: VideoObject, to: string[] = []) {
const privacy = hasAPPublic(to)
? VideoPrivacy.PUBLIC
: VideoPrivacy.UNLISTED
Function buildGroupedDateLabels
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildGroupedDateLabels () {
let currentGroupedDate: GroupDate = GroupDate.UNKNOWN
const periods = [
{
Function onFingerSwipe
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
onFingerSwipe (direction: 'left' | 'right' | 'up' | 'down', action: () => void, removeEventOnEnd = true) {
let touchDownClientX: number
let touchDownClientY: number
const onTouchStart = (event: TouchEvent) => {
Function reloadDataInternal
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected reloadDataInternal () {
debugLogger('Loading data.')
const options = {
pagination: this.pagination,
Function defineUploadProgram
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function defineUploadProgram () {
const program = new Command('upload')
.description('Upload a video on a PeerTube instance')
.alias('up')
Function buildConfigOverride
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
private buildConfigOverride (options: RunServerOptions) {
const base = options.autoEnableImportProxy !== false && process.env.YOUTUBE_DL_PROXY
? { import: { videos: { http: { proxies: [ process.env.YOUTUBE_DL_PROXY ] } } } }
: {}
Function enableTranscoding
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
async enableTranscoding (options: {
webVideo?: boolean
hls?: boolean
keepOriginal?: boolean
splitAudioAndVideo?: boolean
Function up
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function up (utils: {
transaction: Sequelize.Transaction
queryInterface: Sequelize.QueryInterface
sequelize: Sequelize.Sequelize
db: any