Chocobozzz/PeerTube

View on GitHub

Showing 3,313 of 3,313 total issues

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

  removeAllWebVideoFiles (options: OverrideCommandOptions & {
    videoId: number | string
  }) {
    const path = '/api/v1/videos/' + options.videoId + '/web-videos'

Severity: Major
Found in packages/server-commands/src/videos/videos-command.ts and 1 other location - About 2 hrs to fix
packages/server-commands/src/videos/videos-command.ts on lines 187..199

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

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

  {
    const data = {
      type: Sequelize.BOOLEAN,
      defaultValue: null,
      allowNull: true
server/core/initializers/migrations/0720-session-ending-processed.ts on lines 38..46

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

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

  constructor (
    protected router: Router,
    protected serverService: ServerService,
    protected route: ActivatedRoute,
    protected authService: AuthService,
Severity: Major
Found in client/src/app/+my-library/my-videos/my-videos.component.ts and 1 other location - About 2 hrs to fix
client/src/app/+search/search.component.ts on lines 86..96

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

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

  constructor (
    private route: ActivatedRoute,
    private router: Router,
    private metaService: MetaService,
    private notifier: Notifier,
Severity: Major
Found in client/src/app/+search/search.component.ts and 1 other location - About 2 hrs to fix
client/src/app/+my-library/my-videos/my-videos.component.ts on lines 101..113

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

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

async function accountPlaylistsController (req: express.Request, res: express.Response) {
  const account = res.locals.account
  const activityPubResult = await actorPlaylists(req, { account })

  return activityPubResponse(activityPubContextify(activityPubResult, 'Collection', getContextFilter()), res)
Severity: Major
Found in server/core/controllers/activitypub/client.ts and 1 other location - About 2 hrs to fix
server/core/controllers/activitypub/client.ts on lines 296..301

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

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

  videoActionsOptions: VideoActionsDisplayType = {
    playlist: false,
    download: false,
    update: true,
    blacklist: true,
client/src/app/+videos/+video-watch/shared/action-buttons/action-buttons.component.ts on lines 67..82

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

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

  deleteSource (options: OverrideCommandOptions & {
    id: number | string
  }) {
    const path = '/api/v1/videos/' + options.id + '/source/file'

Severity: Major
Found in packages/server-commands/src/videos/videos-command.ts and 1 other location - About 2 hrs to fix
packages/server-commands/src/videos/videos-command.ts on lines 574..586

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

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

  private buildCommentStatsObserver () {
    this.meter.createObservableGauge('peertube_comments_total', {
      description: 'Total comments on the instance'
    }).addCallback(async observableResult => {
      const stats = await this.getInstanceStats()
server/core/lib/opentelemetry/metric-helpers/stats-observers-builder.ts on lines 105..113

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

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

  addPasswordResetEmailJob (username: string, to: string, resetPasswordUrl: string) {
    const emailPayload: EmailPayload = {
      template: 'password-reset',
      to: [ to ],
      subject: 'Reset your account password',
Severity: Major
Found in server/core/lib/emailer.ts and 1 other location - About 2 hrs to fix
server/core/lib/emailer.ts on lines 74..88

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

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

  addPasswordCreateEmailJob (username: string, to: string, createPasswordUrl: string) {
    const emailPayload: EmailPayload = {
      template: 'password-create',
      to: [ to ],
      subject: 'Create your account password',
Severity: Major
Found in server/core/lib/emailer.ts and 1 other location - About 2 hrs to fix
server/core/lib/emailer.ts on lines 58..72

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

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

VideosListComponent has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

@Component({
  selector: 'my-videos-list',
  templateUrl: './videos-list.component.html',
  styleUrls: [ './videos-list.component.scss' ],
  standalone: true,
Severity: Minor
Found in client/src/app/shared/shared-video-miniature/videos-list.component.ts - About 2 hrs to fix

    VideoUploadComponent has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    @Component({
      selector: 'my-video-upload',
      templateUrl: './video-upload.component.html',
      styleUrls: [
        '../shared/video-edit.component.scss',

      VideoCaptionEditModalContentComponent has 22 functions (exceeds 20 allowed). Consider refactoring.
      Open

      @Component({
        styleUrls: [ './video-caption-edit-modal-content.component.scss' ],
        templateUrl: './video-caption-edit-modal-content.component.html',
        standalone: true,
        imports: [

        PluginService has 22 functions (exceeds 20 allowed). Consider refactoring.
        Open

        @Injectable()
        export class PluginService implements ClientHook {
          private static BASE_PLUGIN_API_URL = environment.apiUrl + '/api/v1/plugins'
          private static BASE_PLUGIN_URL = environment.apiUrl + '/plugins'
        
        
        Severity: Minor
        Found in client/src/app/core/plugins/plugin.service.ts - About 2 hrs to fix

          Function listLocalOfServer has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            static async listLocalOfServer (serverId: number) {
              const actor = await getServerActor()
              const buildVideoInclude = () => ({
                model: VideoModel,
                required: true,
          Severity: Major
          Found in server/core/models/redundancy/video-redundancy.ts - About 2 hrs to fix

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

              constructor (player: videojs.Player, options?: P2PMediaLoaderPluginOptions) {
                super(player)
            
                this.options = options
            
            

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

                ngOnInit () {
                  this.initialize()
              
                  this.inputFilters = this.videoAdminService.buildAdminInputFilter()
              
              
              Severity: Major
              Found in client/src/app/+admin/overview/videos/video-list.component.ts - About 2 hrs to fix

                Function getLiveTranscodingCommand has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  async getLiveTranscodingCommand (options: LiveTranscodingOptions) {
                    this.commandWrapper.debugLog('Building live transcoding command', options)
                
                    const {
                      inputUrl,
                Severity: Major
                Found in packages/ffmpeg/src/ffmpeg-live.ts - About 2 hrs to fix

                  Function presetVOD has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export async function presetVOD (options: {
                    commandWrapper: FFmpegCommandWrapper
                  
                    videoInputPath: string
                    separatedAudioInputPath?: string
                  Severity: Major
                  Found in packages/ffmpeg/src/shared/presets.ts - About 2 hrs to fix

                    File index.ts has 263 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import express from 'express'
                    import { tokensRouter } from '@server/controllers/api/users/token.js'
                    import { Hooks } from '@server/lib/plugins/hooks.js'
                    import { OAuthTokenModel } from '@server/models/oauth/oauth-token.js'
                    import { MUserAccountDefault } from '@server/types/models/index.js'
                    Severity: Minor
                    Found in server/core/controllers/api/users/index.ts - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language