Chocobozzz/PeerTube

View on GitHub

Showing 3,313 of 3,313 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  constructor (
    private notifier: Notifier,
    private authService: AuthService,
    private userService: UserService,
    private route: ActivatedRoute,
client/src/app/+my-library/my-video-playlists/my-video-playlist-elements.component.ts on lines 54..62
client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 54..62

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 71.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    Object.keys(openGraphMetaTags).forEach(tagName => {
      const tagValue = openGraphMetaTags[tagName]
      if (!tagValue) return

      tagsStr += `<meta property="${tagName}" content="${escapeAttribute(tagValue)}" />`
Severity: Major
Found in server/core/lib/html/shared/tags-html.ts and 2 other locations - About 1 hr to fix
server/core/lib/html/shared/tags-html.ts on lines 102..107
server/core/lib/html/shared/tags-html.ts on lines 110..115

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 71.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    Object.keys(standardMetaTags).forEach(tagName => {
      const tagValue = standardMetaTags[tagName]
      if (!tagValue) return

      tagsStr += `<meta property="${tagName}" content="${escapeAttribute(tagValue)}" />`
Severity: Major
Found in server/core/lib/html/shared/tags-html.ts and 2 other locations - About 1 hr to fix
server/core/lib/html/shared/tags-html.ts on lines 94..99
server/core/lib/html/shared/tags-html.ts on lines 110..115

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 71.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  constructor (
    private hooks: HooksService,
    private notifier: Notifier,
    private router: Router,
    private confirmService: ConfirmService,
client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts on lines 54..62
client/src/app/shared/shared-video-miniature/videos-list.component.ts on lines 148..158

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 71.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      this.rtmpServer = createServer(socket => {
        const session = new NodeRtmpSession(config, socket)

        session.inputOriginLocalUrl = 'rtmp://127.0.0.1:' + CONFIG.LIVE.RTMP.PORT
        session.inputOriginPublicUrl = WEBSERVER.RTMP_URL
Severity: Major
Found in server/core/lib/live/live-manager.ts and 1 other location - About 1 hr to fix
server/core/lib/live/live-manager.ts on lines 145..151

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 71.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

function getMaxTheoreticalBitrate (options: {
  resolution: number
  ratio: number
  fps: number
}) {
Severity: Major
Found in packages/core-utils/src/videos/bitrate.ts and 1 other location - About 1 hr to fix
packages/core-utils/src/videos/bitrate.ts on lines 43..52

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 71.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  rtmp: {
    port: CONFIG.LIVE.RTMP.PORT,
    chunk_size: VIDEO_LIVE.RTMP.CHUNK_SIZE,
    gop_cache: VIDEO_LIVE.RTMP.GOP_CACHE,
    ping: VIDEO_LIVE.RTMP.PING,
Severity: Major
Found in server/core/lib/live/live-manager.ts and 1 other location - About 1 hr to fix
server/core/controllers/api/accounts.ts on lines 167..173

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 71.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

function getAverageTheoreticalBitrate (options: {
  resolution: number
  ratio: number
  fps: number
}) {
Severity: Major
Found in packages/core-utils/src/videos/bitrate.ts and 1 other location - About 1 hr to fix
packages/core-utils/src/videos/bitrate.ts on lines 54..63

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 71.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    return VideoShareModel.sequelize.query<{ url: string }>(query, {
      type: QueryTypes.SELECT,
      raw: true
    }).then(rows => rows.map(r => r.url))
Severity: Major
Found in server/core/models/video/video-share.ts and 1 other location - About 1 hr to fix
server/core/models/video/video-comment.ts on lines 602..605

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 71.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    Object.keys(twitterCardMetaTags).forEach(tagName => {
      const tagValue = twitterCardMetaTags[tagName]
      if (!tagValue) return

      tagsStr += `<meta property="${tagName}" content="${escapeAttribute(tagValue)}" />`
Severity: Major
Found in server/core/lib/html/shared/tags-html.ts and 2 other locations - About 1 hr to fix
server/core/lib/html/shared/tags-html.ts on lines 94..99
server/core/lib/html/shared/tags-html.ts on lines 102..107

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 71.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      this.rtmpsServer = createServerTLS(serverOptions, socket => {
        const session = new NodeRtmpSession(config, socket)

        session.inputOriginLocalUrl = 'rtmps://127.0.0.1:' + CONFIG.LIVE.RTMPS.PORT
        session.inputOriginPublicUrl = WEBSERVER.RTMPS_URL
Severity: Major
Found in server/core/lib/live/live-manager.ts and 1 other location - About 1 hr to fix
server/core/lib/live/live-manager.ts on lines 121..127

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 71.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function run has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

async function run () {
  await initDatabaseModels(true)

  displayPeerTubeMustBeStoppedWarning()

Severity: Minor
Found in server/scripts/update-object-storage-url.ts - About 1 hr to fix

    Function getTimeserieStats has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      static async getTimeserieStats (options: {
        video: MVideo
        metric: VideoStatsTimeserieMetric
        startDate: string
        endDate: string
    Severity: Minor
    Found in server/core/models/view/local-video-viewer.ts - About 1 hr to fix

      Function reportAbuse has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      async function reportAbuse (req: express.Request, res: express.Response) {
        const videoInstance = res.locals.videoAll
        const commentInstance = res.locals.videoCommentFull
        const accountInstance = res.locals.account
      
      
      Severity: Minor
      Found in server/core/controllers/api/abuse.ts - About 1 hr to fix

        Function moveToJob has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export async function moveToJob (options: {
          jobId: string
          videoUUID: string
          loggerTags: (number | string)[]
        
        
        Severity: Minor
        Found in server/core/lib/job-queue/handlers/shared/move-video.ts - About 1 hr to fix

          Function install has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async install (options: {
              toInstall: string
              version?: string
              fromDisk?: boolean // default false
              register?: boolean // default true
          Severity: Minor
          Found in server/core/lib/plugins/plugin-manager.ts - About 1 hr to fix

            Function addVideoJobsAfterCreation has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export async function addVideoJobsAfterCreation (options: {
              video: MVideo
              videoFile: MVideoFile
              generateTranscription: boolean
            }) {
            Severity: Minor
            Found in server/core/lib/video-jobs.ts - About 1 hr to fix

              Function create has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                async create (options: CreateOptions) {
                  const { video, priority, tasks } = options
              
                  const jobUUID = buildUUID()
                  const { separatedAudioFile } = video.getMaxQualityAudioAndVideoFiles()

                Function buildOverallStatCard has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private buildOverallStatCard (overallStats: VideoStatsOverall) {
                    this.globalStatsCards = [
                      {
                        label: $localize`Views`,
                        value: this.numberFormatter.transform(this.video.views),
                Severity: Minor
                Found in client/src/app/+stats/video/video-stats.component.ts - About 1 hr to fix

                  Function processWebVideoTranscoding has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export async function processWebVideoTranscoding (options: ProcessOptions<RunnerJobVODWebVideoTranscodingPayload>) {
                    const { server, job, runnerToken } = options
                  
                    const payload = job.payload
                  
                  
                  Severity: Minor
                  Found in apps/peertube-runner/src/server/process/shared/process-vod.ts - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language