Chocobozzz/PeerTube

View on GitHub

Showing 3,313 of 3,313 total issues

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

async function run () {
  const excludeList = getContributorsExcludeList()

  {
    let contributors = await getGitContributors()
Severity: Minor
Found in scripts/generate-code-contributors.ts - About 1 hr to fix

    Function onVideoFetched has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private async onVideoFetched (options: {
        video: VideoDetails
        live: LiveVideo
        videoCaptions: VideoCaption[]
        videoChapters: VideoChapter[]
    Severity: Minor
    Found in client/src/app/+videos/+video-watch/video-watch.component.ts - About 1 hr to fix

      Function buildPlaylistOptions has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private buildPlaylistOptions (options?: {
          playlistTracker: PlaylistTracker
          playNext: () => any
          playPrevious: () => any
          onVideoUpdate: (uuid: string) => any
      Severity: Minor
      Found in client/src/standalone/videos/shared/player-options-builder.ts - About 1 hr to fix

        Function buildLibraryLinks has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          buildLibraryLinks (userCanSeeVideosLink: boolean): MenuSection {
            let links: MenuLink[] = []
        
            if (userCanSeeVideosLink) {
              links.push({
        Severity: Minor
        Found in client/src/app/core/menu/menu.service.ts - About 1 hr to fix

          Function buildConfig has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function buildConfig (suiteFile: string = undefined) {
            const filename = basename(suiteFile)
          
            if (filename === 'custom-server-defaults.e2e-spec.ts') {
              return {
          Severity: Minor
          Found in client/e2e/src/utils/hooks.ts - About 1 hr to fix

            Function buildAdditionalAttributes has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function buildAdditionalAttributes (video: MVideoFormattable, options: VideoFormattingJSONOptions) {
              const add = options.additionalAttributes
            
              const result: Partial<VideoAdditionalAttributes> = {}
            
            
            Severity: Minor
            Found in server/core/models/video/formatter/video-api-format.ts - About 1 hr to fix

              Function addVideoJobsAfterUpdate has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export async function addVideoJobsAfterUpdate (options: {
                video: MVideoFullLight
                isNewVideoForFederation: boolean
              
                nameChanged: boolean
              Severity: Minor
              Found in server/core/lib/video-jobs.ts - About 1 hr to fix

                Function buildSystemItems has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  private buildSystemItems () {
                    const systemItems: TopMenuDropdownParam = {
                      label: $localize`System`,
                      children: []
                    }
                Severity: Minor
                Found in client/src/app/+admin/admin.component.ts - About 1 hr to fix

                  Function resolveRemoteParentComment has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  async function resolveRemoteParentComment (params: ResolveThreadParams) {
                    const { url, comments } = params
                  
                    if (comments.length > ACTIVITY_PUB.MAX_RECURSION_COMMENTS) {
                      throw new Error('Recursion limit reached when resolving a thread')
                  Severity: Minor
                  Found in server/core/lib/activitypub/video-comments.ts - About 1 hr to fix

                    Function getP2PMediaLoaderOptions has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      private getP2PMediaLoaderOptions (options: {
                        redundancyUrlManager: RedundancyUrlManager | null
                        segmentValidator: SegmentValidator | null
                      }): HlsJsEngineSettings {
                        const { redundancyUrlManager, segmentValidator } = options

                      Function constructor has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        constructor (player: videojs.Player, options?: SettingsMenuItemOptions) {
                          super(player, options)
                      
                          this.settingsButton = options.menuButton
                          this.dialog = this.settingsButton.dialog
                      Severity: Minor
                      Found in client/src/assets/player/shared/settings/settings-menu-item.ts - About 1 hr to fix

                        Function tryToResolveThreadFromVideo has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        async function tryToResolveThreadFromVideo (params: ResolveThreadParams) {
                          const { url, comments, commentCreated } = params
                        
                          // Maybe it's a reply to a video?
                          // If yes, it's done: we resolved all the thread
                        Severity: Minor
                        Found in server/core/lib/activitypub/video-comments.ts - About 1 hr to fix

                          Function fetchPage has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            private fetchPage (currentVideo: VideoDetails, totalItems: number): Observable<Video[]> {
                              const pagination = { currentPage: 1, itemsPerPage: totalItems }
                          
                              return this.userService.getAnonymousOrLoggedUser()
                                .pipe(

                            Function goLive has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              goLive () {
                                if (this.isOrHasGoingLive) return
                                this.isOrHasGoingLive = true
                            
                                const name = 'Live'

                              Function buildCommonLinks has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                buildCommonLinks (config: HTMLServerConfig): MenuSection {
                                  let links: MenuLink[] = []
                              
                                  if (config.homepage.enabled) {
                                    links.push({
                              Severity: Minor
                              Found in client/src/app/core/menu/menu.service.ts - About 1 hr to fix

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

                                  getInstanceHomepage (options: OverrideCommandOptions = {}) {
                                    const path = '/api/v1/custom-pages/homepage/instance'
                                
                                    return this.getRequestBody<CustomPage>({
                                      ...options,
                                packages/server-commands/src/moderation/automatic-tags-command.ts on lines 57..67
                                packages/server-commands/src/server/debug-command.ts on lines 6..16
                                packages/server-commands/src/users/users-command.ts on lines 232..242

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

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

                                    this.meter.createObservableGauge('peertube_users_total', {
                                      description: 'Total users on the instance'
                                    }).addCallback(async observableResult => {
                                      const stats = await this.getInstanceStats()
                                
                                
                                server/core/lib/opentelemetry/metric-helpers/stats-observers-builder.ts on lines 116..122
                                server/core/lib/opentelemetry/metric-helpers/stats-observers-builder.ts on lines 124..130
                                server/core/lib/opentelemetry/metric-helpers/stats-observers-builder.ts on lines 178..184

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

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

                                  getMyQuotaUsed (options: OverrideCommandOptions = {}) {
                                    const path = '/api/v1/users/me/video-quota-used'
                                
                                    return this.getRequestBody<UserVideoQuota>({
                                      ...options,
                                Severity: Major
                                Found in packages/server-commands/src/users/users-command.ts and 3 other locations - About 1 hr to fix
                                packages/server-commands/src/custom-pages/custom-pages-command.ts on lines 6..16
                                packages/server-commands/src/moderation/automatic-tags-command.ts on lines 57..67
                                packages/server-commands/src/server/debug-command.ts on lines 6..16

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

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

                                    this.meter.createObservableGauge('peertube_instance_followers_total', {
                                      description: 'Total followers of the instance'
                                    }).addCallback(async observableResult => {
                                      const stats = await this.getInstanceStats()
                                
                                
                                server/core/lib/opentelemetry/metric-helpers/stats-observers-builder.ts on lines 29..35
                                server/core/lib/opentelemetry/metric-helpers/stats-observers-builder.ts on lines 124..130
                                server/core/lib/opentelemetry/metric-helpers/stats-observers-builder.ts on lines 178..184

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

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

                                  getServerAvailable (options: OverrideCommandOptions = {}) {
                                    const path = '/api/v1/automatic-tags/server/available'
                                
                                    return this.getRequestBody<AutomaticTagAvailable>({
                                      ...options,
                                packages/server-commands/src/custom-pages/custom-pages-command.ts on lines 6..16
                                packages/server-commands/src/server/debug-command.ts on lines 6..16
                                packages/server-commands/src/users/users-command.ts on lines 232..242

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

                                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