Chocobozzz/PeerTube

View on GitHub

Showing 3,313 of 3,313 total issues

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

  async create (options: CreateOptions) {
    const { video, rtmpUrl, toTranscode, playlist, segmentDuration, segmentListSize, outputDirectory, sessionId } = options

    const jobUUID = buildUUID()
    const payload: RunnerJobLiveRTMPHLSTranscodingPayload = {

    Function extendsLocalExpiration has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private async extendsLocalExpiration () {
        const expired = await VideoRedundancyModel.listLocalExpired()
    
        for (const redundancyModel of expired) {
          try {
    Severity: Minor
    Found in server/core/lib/schedulers/videos-redundancy-scheduler.ts - About 1 hr to fix

      Function update has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        update (event?: any) {
          // Playback rate menu button doesn't get a vjs-selected class
          // or sets options_['selected'] on the selected playback rate.
          // Thus we get the submenu value based on the labelEl of playbackRateMenuButton
          if (this.subMenu.name() === 'PlaybackRateMenuButton') {
      Severity: Minor
      Found in client/src/assets/player/shared/settings/settings-menu-item.ts - About 1 hr to fix

        Function formValidated has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          formValidated () {
            this.error = undefined
        
            const body = this.form.value
            const videoChannelCreate: VideoChannelCreate = {

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

            constructor (
              protected route: ActivatedRoute,
              protected router: Router,
              private server: ServerService,
              private notifier: Notifier,

            Function buildImportVideoObject has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private buildImportVideoObject (video: VideoUpdate): VideoImportCreate {
                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-import.service.ts - About 1 hr to fix

              Function buildCommonVideosParams has 26 lines of code (exceeds 25 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 1 hr to fix

                Function updateDetails has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  updateDetails (onlyKeys?: string[]) {
                    const nsfwPolicy = this.form.value['nsfwPolicy']
                    const p2pEnabled = this.form.value['p2pEnabled']
                    const autoPlayVideo = this.form.value['autoPlayVideo']
                    const autoPlayNextVideo = this.form.value['autoPlayNextVideo']

                  Function getPlayerConstructorOptions has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    getPlayerConstructorOptions (options: {
                      serverConfig: HTMLServerConfig
                      authorizationHeader: () => string
                    }): PeerTubePlayerContructorOptions {
                      const { serverConfig, authorizationHeader } = options
                  Severity: Minor
                  Found in client/src/standalone/videos/shared/player-options-builder.ts - About 1 hr to fix

                    Function refreshAccessToken has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      refreshAccessToken () {
                        if (this.refreshingTokenObservable) return this.refreshingTokenObservable
                        if (!this.getAccessToken()) return throwError(() => new Error($localize`You need to reconnect`))
                    
                        logger.info('Refreshing token...')
                    Severity: Minor
                    Found in client/src/app/core/auth/auth.service.ts - About 1 hr to fix

                      Function computeTypeahead has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        computeTypeahead () {
                          const searchIndexConfig = this.serverConfig.search.searchIndex
                      
                          if (!this.activeSearch) {
                            if (searchIndexConfig.enabled && (searchIndexConfig.isDefaultSearch || searchIndexConfig.disableLocalSearch)) {
                      Severity: Minor
                      Found in client/src/app/header/search-typeahead.component.ts - About 1 hr to fix

                        Function setUserInfo has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          setUserInfo (profile: UserUpdateMe) {
                            const localStorageKeys = {
                              nsfwPolicy: UserLocalStorageKeys.NSFW_POLICY,
                              p2pEnabled: UserLocalStorageKeys.P2P_ENABLED,
                              autoPlayVideo: UserLocalStorageKeys.AUTO_PLAY_VIDEO,
                        Severity: Minor
                        Found in client/src/app/core/users/user-local-storage.service.ts - About 1 hr to fix

                          Function ngOnInit has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            ngOnInit () {
                              this.serverConfig = this.serverService.getHTMLConfig()
                          
                              this.subActivatedRoute = this.route.queryParams
                                .subscribe({
                          Severity: Minor
                          Found in client/src/app/+search/search.component.ts - About 1 hr to fix

                            Function makeUploadRequest has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function makeUploadRequest (options: CommonRequestParams & {
                              method?: 'POST' | 'PUT'
                            
                              fields: { [ fieldName: string ]: any }
                              attaches?: { [ attachName: string ]: any | any[] }
                            Severity: Minor
                            Found in packages/server-commands/src/requests/requests.ts - About 1 hr to fix

                              Function processJob has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export async function processJob (options: ProcessOptions) {
                                const { server, job } = options
                              
                                logger.info(`[${server.url}] Processing job of type ${job.type}: ${job.uuid}`, { payload: job.payload })
                              
                              
                              Severity: Minor
                              Found in apps/peertube-runner/src/server/process/process.ts - About 1 hr to fix

                                Function onStdout has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                      this.app.stdout.on('data', function onStdout (data) {
                                        let dontContinue = false
                                
                                        const log: string = data.toString()
                                        aggregatedLogs += log
                                Severity: Minor
                                Found in packages/server-commands/src/server/server.ts - About 1 hr to fix

                                  Consider simplifying this complex logical expression.
                                  Open

                                      if (this.user && this.displayOptions.instanceUser && authUser.hasRight(UserRight.MANAGE_USERS) && authUser.canManage(this.user)) {
                                        instanceActions = instanceActions.concat([
                                          {
                                            label: $localize`Edit user`,
                                            description: $localize`Change quota, role, and more.`,

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

                                      static deleteByVideoId (videoId: number, t: Transaction) {
                                        const query = {
                                          where: {
                                            videoId
                                          },
                                    Severity: Major
                                    Found in server/core/models/video/schedule-video-update.ts and 3 other locations - About 1 hr to fix
                                    server/core/models/video/video-chapter.ts on lines 46..55
                                    server/core/models/video/video-password.ts on lines 52..61
                                    server/core/models/video/video-playlist-element.ts on lines 110..119

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

                                    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

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

                                        playlist?: {
                                          playlistTracker: PlaylistTracker
                                          playNext: () => any
                                          playPrevious: () => any
                                          onVideoUpdate: (uuid: string) => any
                                    client/src/standalone/videos/shared/player-options-builder.ts on lines 351..356

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

                                    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

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

                                          {
                                            model: AccountModel.unscoped(),
                                            required: true,
                                            include: [
                                              {
                                    Severity: Major
                                    Found in server/scripts/update-host.ts and 1 other location - About 1 hr to fix
                                    server/scripts/update-host.ts on lines 107..119

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

                                    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