Chocobozzz/PeerTube

View on GitHub

Showing 3,313 of 3,313 total issues

Function updateVideo has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  updateVideo (video: VideoEdit) {
    const language = video.language || null
    const licence = video.licence || null
    const category = video.category || null
    const description = video.description || null
Severity: Minor
Found in client/src/app/shared/shared-main/video/video.service.ts - About 1 hr to fix

    Function updateSecondStep has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      async updateSecondStep () {
        if (!await this.isFormValid()) return
    
        this.isUpdatingVideo = true
    
    

      Function onUploadVideoOngoing has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        onUploadVideoOngoing (state: UploadState) {
          switch (state.status) {
            case 'error': {
              if (!this.alreadyRefreshedToken && state.responseStatus === HttpStatusCode.UNAUTHORIZED_401) {
                this.alreadyRefreshedToken = true

        Function search has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          search () {
            this.error = this.checkFieldsAndGetError()
            if (this.error) return
        
            this.isSearching = true
        Severity: Minor
        Found in client/src/app/+search/search.component.ts - About 1 hr to fix

          Function runServer has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function runServer (appInstance: number, config: any = {}) {
            const env = Object.create(process.env)
          
            env['NODE_OPTIONS'] = ''
            env['NODE_ENV'] = 'test'
          Severity: Minor
          Found in client/e2e/src/utils/server.ts - About 1 hr to fix

            Function listRedundanciesCLI has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            async function listRedundanciesCLI (options: CommonProgramOptions & { target: VideoRedundanciesTarget }) {
              const { target } = options
            
              const { url, username, password } = await getServerCredentials(options)
              const server = buildServer(url)
            Severity: Minor
            Found in apps/peertube-cli/src/peertube-redundancy.ts - About 1 hr to fix

              Function secondsToTime has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function secondsToTime (options: {
                seconds: number
                format: 'short' | 'full' | 'locale-string' // default 'short'
                symbol?: string
              } | number) {
              Severity: Minor
              Found in packages/core-utils/src/common/date.ts - About 1 hr to fix

                Function sendPendingChunks has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private async sendPendingChunks (): Promise<any> {
                    if (this.ended) return Promise.resolve()
                
                    const parallelPromises: Promise<any>[] = []
                
                
                Severity: Minor
                Found in apps/peertube-runner/src/server/process/shared/process-live.ts - About 1 hr to fix

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

                    deleteCustomConfig (options: OverrideCommandOptions = {}) {
                      const path = '/api/v1/config/custom'
                  
                      return this.deleteRequest({
                        ...options,
                  Severity: Major
                  Found in packages/server-commands/src/server/config-command.ts and 5 other locations - About 1 hr to fix
                  packages/server-commands/src/runners/runner-registration-tokens-command.ts on lines 24..34
                  packages/server-commands/src/server/jobs-command.ts on lines 17..27
                  packages/server-commands/src/server/jobs-command.ts on lines 29..39
                  packages/server-commands/src/server/plugins-command.ts on lines 210..220
                  packages/server-commands/src/users/users-command.ts on lines 259..269

                  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 61.

                  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 6 locations. Consider refactoring.
                  Open

                    getCSS (options: OverrideCommandOptions = {}) {
                      const path = '/plugins/global.css'
                  
                      return this.getRequestText({
                        ...options,
                  Severity: Major
                  Found in packages/server-commands/src/server/plugins-command.ts and 5 other locations - About 1 hr to fix
                  packages/server-commands/src/runners/runner-registration-tokens-command.ts on lines 24..34
                  packages/server-commands/src/server/config-command.ts on lines 563..573
                  packages/server-commands/src/server/jobs-command.ts on lines 17..27
                  packages/server-commands/src/server/jobs-command.ts on lines 29..39
                  packages/server-commands/src/users/users-command.ts on lines 259..269

                  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 61.

                  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 6 locations. Consider refactoring.
                  Open

                    protected includeWebVideoFiles () {
                      this.addJoin('LEFT JOIN "videoFile" AS "VideoFiles" ON "VideoFiles"."videoId" = "video"."id"')
                  
                      this.attributes = {
                        ...this.attributes,
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 104..112
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 188..198
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 226..236
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 238..248
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 250..260

                  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 61.

                  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 6 locations. Consider refactoring.
                  Open

                    protected includeBlacklisted () {
                      this.addJoin(
                        'LEFT OUTER JOIN "videoBlacklist" AS "VideoBlacklist" ON "video"."id" = "VideoBlacklist"."videoId"'
                      )
                  
                  
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 104..112
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 114..122
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 226..236
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 238..248
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 250..260

                  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 61.

                  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 6 locations. Consider refactoring.
                  Open

                    resumeJobQueue (options: OverrideCommandOptions = {}) {
                      const path = '/api/v1/jobs/resume'
                  
                      return this.postBodyRequest({
                        ...options,
                  Severity: Major
                  Found in packages/server-commands/src/server/jobs-command.ts and 5 other locations - About 1 hr to fix
                  packages/server-commands/src/runners/runner-registration-tokens-command.ts on lines 24..34
                  packages/server-commands/src/server/config-command.ts on lines 563..573
                  packages/server-commands/src/server/jobs-command.ts on lines 17..27
                  packages/server-commands/src/server/plugins-command.ts on lines 210..220
                  packages/server-commands/src/users/users-command.ts on lines 259..269

                  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 61.

                  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 6 locations. Consider refactoring.
                  Open

                    protected includeLive () {
                      this.addJoin(
                        'LEFT OUTER JOIN "videoLive" AS "VideoLive" ON "video"."id" = "VideoLive"."videoId"'
                      )
                  
                  
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 104..112
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 114..122
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 188..198
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 226..236
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 250..260

                  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 61.

                  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 6 locations. Consider refactoring.
                  Open

                    protected includeVideoSource () {
                      this.addJoin(
                        'LEFT OUTER JOIN "videoSource" AS "VideoSource" ON "video"."id" = "VideoSource"."videoId"'
                      )
                  
                  
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 104..112
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 114..122
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 188..198
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 226..236
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 238..248

                  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 61.

                  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 6 locations. Consider refactoring.
                  Open

                    protected includeThumbnails () {
                      this.addJoin('LEFT OUTER JOIN "thumbnail" AS "Thumbnails" ON "video"."id" = "Thumbnails"."videoId"')
                  
                      this.attributes = {
                        ...this.attributes,
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 114..122
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 188..198
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 226..236
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 238..248
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 250..260

                  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 61.

                  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 6 locations. Consider refactoring.
                  Open

                    deleteMe (options: OverrideCommandOptions = {}) {
                      const path = '/api/v1/users/me'
                  
                      return this.deleteRequest({
                        ...options,
                  Severity: Major
                  Found in packages/server-commands/src/users/users-command.ts and 5 other locations - About 1 hr to fix
                  packages/server-commands/src/runners/runner-registration-tokens-command.ts on lines 24..34
                  packages/server-commands/src/server/config-command.ts on lines 563..573
                  packages/server-commands/src/server/jobs-command.ts on lines 17..27
                  packages/server-commands/src/server/jobs-command.ts on lines 29..39
                  packages/server-commands/src/server/plugins-command.ts on lines 210..220

                  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 61.

                  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 6 locations. Consider refactoring.
                  Open

                    generate (options: OverrideCommandOptions = {}) {
                      const path = '/api/v1/runners/registration-tokens/generate'
                  
                      return this.postBodyRequest({
                        ...options,
                  packages/server-commands/src/server/config-command.ts on lines 563..573
                  packages/server-commands/src/server/jobs-command.ts on lines 17..27
                  packages/server-commands/src/server/jobs-command.ts on lines 29..39
                  packages/server-commands/src/server/plugins-command.ts on lines 210..220
                  packages/server-commands/src/users/users-command.ts on lines 259..269

                  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 61.

                  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 6 locations. Consider refactoring.
                  Open

                    pauseJobQueue (options: OverrideCommandOptions = {}) {
                      const path = '/api/v1/jobs/pause'
                  
                      return this.postBodyRequest({
                        ...options,
                  Severity: Major
                  Found in packages/server-commands/src/server/jobs-command.ts and 5 other locations - About 1 hr to fix
                  packages/server-commands/src/runners/runner-registration-tokens-command.ts on lines 24..34
                  packages/server-commands/src/server/config-command.ts on lines 563..573
                  packages/server-commands/src/server/jobs-command.ts on lines 29..39
                  packages/server-commands/src/server/plugins-command.ts on lines 210..220
                  packages/server-commands/src/users/users-command.ts on lines 259..269

                  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 61.

                  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 6 locations. Consider refactoring.
                  Open

                    protected includeScheduleUpdate () {
                      this.addJoin(
                        'LEFT OUTER JOIN "scheduleVideoUpdate" AS "ScheduleVideoUpdate" ON "video"."id" = "ScheduleVideoUpdate"."videoId"'
                      )
                  
                  
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 104..112
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 114..122
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 188..198
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 238..248
                  server/core/models/video/sql/video/shared/abstract-video-query-builder.ts on lines 250..260

                  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 61.

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language