Chocobozzz/PeerTube

View on GitHub

Showing 1,292 of 3,313 total issues

Function addLocalViewer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  async addLocalViewer (options: {
    video: MVideoImmutable
    currentTime: number
    ip: string
    sessionId: string
Severity: Minor
Found in server/core/lib/views/shared/video-viewer-stats.ts - About 55 mins to fix

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 isAuthResultValid has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function isAuthResultValid (npmName: string, authName: string, result: RegisterServerAuthenticatedResult) {
  const returnError = (field: string) => {
    logger.error('Auth method %s of plugin %s did not provide a valid %s.', authName, npmName, field, { [field]: result[field] })
    return false
  }
Severity: Minor
Found in server/core/lib/auth/external-auth.ts - About 55 mins to fix

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 getAccessToken has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

async function getAccessToken (bearerToken: string) {
  logger.debug('Getting access token.')

  if (!bearerToken) return undefined

Severity: Minor
Found in server/core/lib/auth/oauth-model.ts - About 55 mins to fix

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 sendCreateVideoCommentIfNeeded has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export async function sendCreateVideoCommentIfNeeded (comment: MCommentOwnerVideoReply, transaction: Transaction) {
  const isOrigin = comment.Video.isOwned()

  if (isOrigin) {
    const videoWithBlacklist = await VideoModel.loadWithBlacklist(comment.Video.id)
Severity: Minor
Found in server/core/lib/activitypub/send/send-create.ts - About 55 mins to fix

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 broadcastTo has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function broadcastTo (options: {
  uris: string[]
  data: any
  byActor: MActorId
  contextType: ContextType
Severity: Minor
Found in server/core/lib/activitypub/send/shared/send-utils.ts - About 55 mins to fix

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 shouldCommentBeHeldForReview has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export async function shouldCommentBeHeldForReview (options: {
  user: MUserAccountId
  video: MVideoAccountLight
  automaticTags: { name: string, accountId: number }[]
  transaction?: Transaction
Severity: Minor
Found in server/core/lib/video-comment.ts - About 55 mins to fix

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 cacheFileActivityObjectToDBAttributes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function cacheFileActivityObjectToDBAttributes (cacheFileObject: CacheFileObject, video: MVideoWithAllFiles, byActor: MActorId) {

  if (cacheFileObject.url.mediaType === 'application/x-mpegURL') {
    const url = cacheFileObject.url

Severity: Minor
Found in server/core/lib/activitypub/cache-file.ts - About 55 mins to fix

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 buildLowerResolutionJobPayloads has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  private async buildLowerResolutionJobPayloads (options: {
    video: MVideoFullLight
    inputVideoResolution: number
    inputVideoFPS: number
    hasAudio: boolean
Severity: Minor
Found in server/core/lib/transcoding/shared/job-builders/abstract-job-builder.ts - About 55 mins to fix

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 buildGroupInterval has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function buildGroupInterval (startDate: Date, endDate: Date): string {
  const aYear = 31536000
  const aMonth = 2678400
  const aDay = 86400
  const anHour = 3600
Severity: Minor
Found in server/core/lib/timeserie.ts - About 55 mins to fix

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 resolveThread has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export async function resolveThread (params: ResolveThreadParams): ResolveThreadResult {
  const { url, isVideo } = params

  if (params.commentCreated === undefined) params.commentCreated = false
  if (params.comments === undefined) params.comments = []
Severity: Minor
Found in server/core/lib/activitypub/video-comments.ts - About 55 mins to fix

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 buildVODHandlers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  private buildVODHandlers () {
    const handlers: KeyHandler[] = [
      // Rewind
      {
        accept: e => this.isNaked(e, 'ArrowLeft') || this.isNaked(e, 'MediaRewind'),
Severity: Minor
Found in client/src/assets/player/shared/hotkeys/peertube-hotkeys-plugin.ts - About 55 mins to fix

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 buildFileStreams has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function buildFileStreams (fileUrl: ActivityVideoUrlObject, resolution: number) {
  const attachment = fileUrl.attachment || []

  const formatHints = attachment.filter(a => a.type === 'PropertyValue' && a.name === 'ffprobe_codec_type')

Severity: Minor
Found in server/core/lib/activitypub/videos/shared/object-to-model-attributes.ts - About 55 mins to fix

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 initTouchStartEvents has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  private initTouchStartEvents () {
    const handleTouchStart = (event: TouchEvent, onlyDetectDoubleTap = false) => {
      debugLogger('Handle touch start')

      if (this.tapTimeout) {
Severity: Minor
Found in client/src/assets/player/shared/mobile/peertube-mobile-plugin.ts - About 55 mins to fix

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 select has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  select (options: {
    id: number
    fireCallback: boolean
    autoResolutionChosenId?: number
  }) {

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 registerSourceHandler has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const registerSourceHandler = function (vjs: typeof videojs) {
  if (!Hlsjs.isSupported()) {
    logger.info('Hls.js is not supported in this browser.')
    return
  }
Severity: Minor
Found in client/src/assets/player/shared/p2p-media-loader/hls-plugin.ts - About 55 mins to fix

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 doRefresh has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

async function doRefresh <T extends MActorFull | MActorAccountChannelId> (options: RefreshOptions<T>): RefreshResult <MActorFull> {
  const { actor: actorArg, fetchedType } = options

  // We need more attributes
  const actor = fetchedType === 'all'
Severity: Minor
Found in server/core/lib/activitypub/actors/refresh.ts - About 55 mins to fix

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 buildFileFormatFlags has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function buildFileFormatFlags (fileUrl: ActivityVideoUrlObject, isStreamingPlaylist: boolean) {
  const attachment = fileUrl.attachment || []

  const formatHints = attachment.filter(a => a.type === 'PropertyValue' && a.name === 'peertube_format_flag')
  if (formatHints.length === 0) {
Severity: Minor
Found in server/core/lib/activitypub/videos/shared/object-to-model-attributes.ts - About 55 mins to fix

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 buildCommonVideosParams has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  buildCommonVideosParams (options: CommonVideoParams & { params: HttpParams }) {
    const {
      params,
      videoPagination,
      sort,
Severity: Minor
Found in client/src/app/shared/shared-main/video/video.service.ts - About 55 mins to fix

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 buildTasks has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  private buildTasks () {
    const tasks: VideoStudioTask[] = []
    const value = this.form.value

    const cut = value['cut']
Severity: Minor
Found in client/src/app/+video-studio/edit/video-studio-edit.component.ts - About 55 mins to fix

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 ngOnChanges has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  ngOnChanges (changes: SimpleChanges) {
    if (changes['displayOptions'] || !this.displayOptions) {
      this.displayOptions = {
        ...this.defaultDisplayOptions,
        avatar: this.serverService.getHTMLConfig().client.videos.miniature.displayAuthorAvatar,
Severity: Minor
Found in client/src/app/shared/shared-video-miniature/videos-list.component.ts - About 55 mins to fix

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

Severity
Category
Status
Source
Language