glitch-soc/mastodon

View on GitHub
app/javascript/mastodon/features/video/index.jsx

Summary

Maintainability
F
3 wks
Test Coverage

File index.jsx has 538 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import PropTypes from 'prop-types';
import { PureComponent } from 'react';

import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';

Severity: Major
Found in app/javascript/mastodon/features/video/index.jsx - About 1 day to fix

    Video has 40 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Video extends PureComponent {
    
      static propTypes = {
        preview: PropTypes.string,
        frameRate: PropTypes.string,
    Severity: Minor
    Found in app/javascript/mastodon/features/video/index.jsx - About 5 hrs to fix

      Function render has 107 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render () {
          const { preview, src, aspectRatio, onOpenVideo, onCloseVideo, intl, alt, lang, detailed, sensitive, editable, blurhash, autoFocus } = this.props;
          const { currentTime, duration, volume, buffer, dragging, paused, fullscreen, hovered, revealed } = this.state;
          const progress = Math.min((currentTime / duration) * 100, 100);
          const muted = this.state.muted || volume === 0;
      Severity: Major
      Found in app/javascript/mastodon/features/video/index.jsx - About 4 hrs to fix

        Function render has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

          render () {
            const { preview, src, aspectRatio, onOpenVideo, onCloseVideo, intl, alt, lang, detailed, sensitive, editable, blurhash, autoFocus } = this.props;
            const { currentTime, duration, volume, buffer, dragging, paused, fullscreen, hovered, revealed } = this.state;
            const progress = Math.min((currentTime / duration) * 100, 100);
            const muted = this.state.muted || volume === 0;
        Severity: Minor
        Found in app/javascript/mastodon/features/video/index.jsx - About 3 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

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

                  <div className={classNames('video-player__controls', { active: paused || hovered })}>
                    <div className='video-player__seek' onMouseDown={this.handleMouseDown} ref={this.setSeekRef}>
                      <div className='video-player__seek__buffer' style={{ width: `${buffer}%` }} />
                      <div className='video-player__seek__progress' style={{ width: `${progress}%` }} />
        
        
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 1 other location - About 1 wk to fix
        app/javascript/flavours/glitch/features/video/index.jsx on lines 622..666

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

        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

          handleKeyDown = e => {
            const frameTime = 1 / this.getFrameRate();
        
            switch(e.key) {
            case 'k':
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 1 other location - About 1 day to fix
        app/javascript/flavours/glitch/features/video/index.jsx on lines 295..347

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

        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

        export const findElementPosition = el => {
          let box;
        
          if (el.getBoundingClientRect && el.parentNode) {
            box = el.getBoundingClientRect();
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 1 other location - About 1 day to fix
        app/javascript/flavours/glitch/features/video/index.jsx on lines 51..80

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

        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

          handleScroll = throttle(() => {
            if (!this.video) {
              return;
            }
        
        
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 1 other location - About 1 day to fix
        app/javascript/flavours/glitch/features/video/index.jsx on lines 406..428

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

        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

        export const getPointerPosition = (el, event) => {
          const position = {};
          const box = findElementPosition(el);
          const boxW = el.offsetWidth;
          const boxH = el.offsetHeight;
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 1 other location - About 1 day to fix
        app/javascript/flavours/glitch/features/video/index.jsx on lines 82..102

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

        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

          componentWillUnmount () {
            window.removeEventListener('scroll', this.handleScroll);
        
            document.removeEventListener('fullscreenchange', this.handleFullscreenChange, true);
            document.removeEventListener('webkitfullscreenchange', this.handleFullscreenChange, true);
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 1 other location - About 1 day to fix
        app/javascript/flavours/glitch/features/video/index.jsx on lines 376..392

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

        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

        export const formatTime = secondsNum => {
          let hours   = Math.floor(secondsNum / 3600);
          let minutes = Math.floor((secondsNum - (hours * 3600)) / 60);
          let seconds = secondsNum - (hours * 3600) - (minutes * 60);
        
        
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 1 other location - About 7 hrs to fix
        app/javascript/flavours/glitch/features/video/index.jsx on lines 39..49

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

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

        const messages = defineMessages({
          play: { id: 'video.play', defaultMessage: 'Play' },
          pause: { id: 'video.pause', defaultMessage: 'Pause' },
          mute: { id: 'video.mute', defaultMessage: 'Mute sound' },
          unmute: { id: 'video.unmute', defaultMessage: 'Unmute sound' },
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 9 other locations - About 6 hrs to fix
        app/javascript/flavours/glitch/components/account.jsx on lines 23..33
        app/javascript/flavours/glitch/components/status_icons.jsx on lines 22..32
        app/javascript/flavours/glitch/features/direct_timeline/components/conversation.jsx on lines 32..42
        app/javascript/flavours/glitch/features/getting_started_misc/index.jsx on lines 21..31
        app/javascript/flavours/glitch/features/video/index.jsx on lines 27..37
        app/javascript/mastodon/components/account.jsx on lines 23..33
        app/javascript/mastodon/containers/status_container.jsx on lines 53..63
        app/javascript/mastodon/features/direct_timeline/components/conversation.jsx on lines 31..41
        app/javascript/mastodon/features/directory/components/account_card.jsx on lines 26..36

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

        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

          handleMouseDown = e => {
            document.addEventListener('mousemove', this.handleMouseMove, true);
            document.addEventListener('mouseup', this.handleMouseUp, true);
            document.addEventListener('touchmove', this.handleMouseMove, true);
            document.addEventListener('touchend', this.handleMouseUp, true);
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 3 other locations - About 5 hrs to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 256..268
        app/javascript/flavours/glitch/features/video/index.jsx on lines 239..251
        app/javascript/mastodon/features/audio/index.jsx on lines 250..262

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

        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

          handleLoadedData = () => {
            const { currentTime, volume, muted, autoPlay } = this.props;
        
            if (currentTime) {
              this.video.currentTime = currentTime;
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 1 other location - About 5 hrs to fix
        app/javascript/flavours/glitch/features/video/index.jsx on lines 483..501

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

        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

          handleMouseVolSlide = throttle(e => {
            const { x } = getPointerPosition(this.volume, e);
        
            if(!isNaN(x)) {
              this.setState((state) => ({ volume: x, muted: state.muted && x === 0 }), () => {
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 1 other location - About 4 hrs to fix
        app/javascript/flavours/glitch/features/video/index.jsx on lines 228..237

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

        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

          toggleMute = () => {
            const muted = !(this.video.muted || this.state.volume === 0);
        
            this.setState((state) => ({ muted, volume: Math.max(state.volume || 0.5, 0.05) }), () => {
              this._syncVideoToVolumeState();
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 1 other location - About 3 hrs to fix
        app/javascript/flavours/glitch/features/video/index.jsx on lines 442..449

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

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

          handleVolumeMouseDown = e => {
            document.addEventListener('mousemove', this.handleMouseVolSlide, true);
            document.addEventListener('mouseup', this.handleVolumeMouseUp, true);
            document.addEventListener('touchmove', this.handleMouseVolSlide, true);
            document.addEventListener('touchend', this.handleVolumeMouseUp, true);
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 3 other locations - About 3 hrs to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 237..247
        app/javascript/flavours/glitch/features/video/index.jsx on lines 209..219
        app/javascript/mastodon/features/audio/index.jsx on lines 231..241

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

        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

          handleMouseUp = () => {
            document.removeEventListener('mousemove', this.handleMouseMove, true);
            document.removeEventListener('mouseup', this.handleMouseUp, true);
            document.removeEventListener('touchmove', this.handleMouseMove, true);
            document.removeEventListener('touchend', this.handleMouseUp, true);
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 3 other locations - About 3 hrs to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 270..278
        app/javascript/flavours/glitch/features/video/index.jsx on lines 253..261
        app/javascript/mastodon/features/audio/index.jsx on lines 264..272

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

        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

          handleMouseMove = throttle(e => {
            const { x } = getPointerPosition(this.seek, e);
            const currentTime = this.video.duration * x;
        
            if (!isNaN(currentTime)) {
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 3 other locations - About 3 hrs to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 280..289
        app/javascript/flavours/glitch/features/video/index.jsx on lines 263..272
        app/javascript/mastodon/features/audio/index.jsx on lines 274..283

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

        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

          handleProgress = () => {
            const lastTimeRange = this.video.buffered.length - 1;
        
            if (lastTimeRange > -1) {
              this.setState({ buffer: Math.ceil(this.video.buffered.end(lastTimeRange) / this.video.duration * 100) });
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 3 other locations - About 3 hrs to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 211..217
        app/javascript/flavours/glitch/features/video/index.jsx on lines 503..509
        app/javascript/mastodon/features/audio/index.jsx on lines 205..211

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

        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

          handleOpenVideo = () => {
            this.video.pause();
        
            this.props.onOpenVideo(this.props.lang, {
              startTime: this.video.currentTime,
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 1 other location - About 3 hrs to fix
        app/javascript/flavours/glitch/features/video/index.jsx on lines 516..525

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

        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

          state = {
            currentTime: 0,
            duration: 0,
            volume: 0.5,
            paused: true,
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 1 other location - About 3 hrs to fix
        app/javascript/flavours/glitch/features/video/index.jsx on lines 147..157

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

        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

          componentDidMount () {
            document.addEventListener('fullscreenchange', this.handleFullscreenChange, true);
            document.addEventListener('webkitfullscreenchange', this.handleFullscreenChange, true);
            document.addEventListener('mozfullscreenchange', this.handleFullscreenChange, true);
            document.addEventListener('MSFullscreenChange', this.handleFullscreenChange, true);
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 1 other location - About 3 hrs to fix
        app/javascript/flavours/glitch/features/video/index.jsx on lines 365..374

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

        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

          togglePlay = () => {
            if (this.state.paused) {
              this.setState({ paused: false }, () => this.video.play());
            } else {
              this.setState({ paused: true }, () => this.video.pause());
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 1 other location - About 2 hrs to fix
        app/javascript/flavours/glitch/features/video/index.jsx on lines 349..355

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

        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

          getFrameRate () {
            if (this.props.frameRate && isNaN(this.props.frameRate)) {
              // The frame rate is returned as a fraction string so we
              // need to convert it to a number
        
        
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 1 other location - About 2 hrs to fix
        app/javascript/flavours/glitch/features/video/index.jsx on lines 532..541

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

        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

          _syncVideoToVolumeState = (volume = null, muted = null) => {
            if (!this.video) {
              return;
            }
        
        
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 1 other location - About 2 hrs to fix
        app/javascript/flavours/glitch/features/video/index.jsx on lines 451..458

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

        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

          seekBy (time) {
            const currentTime = this.video.currentTime + time;
        
            if (!isNaN(currentTime)) {
              this.setState({ currentTime }, () => {
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 3 other locations - About 2 hrs to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 433..441
        app/javascript/flavours/glitch/features/video/index.jsx on lines 274..282
        app/javascript/mastodon/features/audio/index.jsx on lines 427..435

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

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

          handleVolumeMouseUp = () => {
            document.removeEventListener('mousemove', this.handleMouseVolSlide, true);
            document.removeEventListener('mouseup', this.handleVolumeMouseUp, true);
            document.removeEventListener('touchmove', this.handleMouseVolSlide, true);
            document.removeEventListener('touchend', this.handleVolumeMouseUp, true);
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 3 other locations - About 2 hrs to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 249..254
        app/javascript/flavours/glitch/features/video/index.jsx on lines 221..226
        app/javascript/mastodon/features/audio/index.jsx on lines 243..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 78.

        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

          handleVolumeChange = () => {
            this.setState({ volume: this.video.volume, muted: this.video.muted });
            this._saveVolumeState(this.video.volume, this.video.muted);
          };
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 1 other location - About 2 hrs to fix
        app/javascript/flavours/glitch/features/video/index.jsx on lines 511..514

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

        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

          _syncVideoFromLocalStorage = () => {
            this.setState({ volume: playerSettings.get('volume') ?? 0.5, muted: playerSettings.get('muted') ?? false }, () => {
              this._syncVideoToVolumeState();
            });
          };
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 1 other location - About 1 hr to fix
        app/javascript/flavours/glitch/features/video/index.jsx on lines 465..469

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

        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

          setVideoRef = c => {
            this.video = c;
        
            if (this.video) {
              this.setState({ volume: this.video.volume, muted: this.video.muted });
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 1 other location - About 1 hr to fix
        app/javascript/flavours/glitch/features/video/index.jsx on lines 163..169

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

          toggleReveal = () => {
            if (this.props.onToggleVisibility) {
              this.props.onToggleVisibility();
            } else {
              this.setState({ revealed: !this.state.revealed });
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 4 other locations - About 1 hr to fix
        app/javascript/flavours/glitch/components/media_gallery.jsx on lines 271..277
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 229..235
        app/javascript/mastodon/components/media_gallery.jsx on lines 255..261
        app/javascript/mastodon/features/audio/index.jsx on lines 223..229

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

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

          UNSAFE_componentWillReceiveProps (nextProps) {
            if (!is(nextProps.visible, this.props.visible) && nextProps.visible !== undefined) {
              this.setState({ revealed: nextProps.visible });
            }
          }
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 3 other locations - About 1 hr to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 158..162
        app/javascript/flavours/glitch/features/video/index.jsx on lines 394..398
        app/javascript/mastodon/features/audio/index.jsx on lines 152..156

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

        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

          _updateTime () {
            requestAnimationFrame(() => {
              if (!this.video) return;
        
              this.handleTimeUpdate();
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 1 other location - About 1 hr to fix
        app/javascript/flavours/glitch/features/video/index.jsx on lines 190..200

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

        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

        export const fileNameFromURL = str => {
          const url      = new URL(str);
          const pathname = url.pathname;
          const index    = pathname.lastIndexOf('/');
        
        
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 1 other location - About 1 hr to fix
        app/javascript/flavours/glitch/features/video/index.jsx on lines 104..110

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

        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

          _saveVolumeState = (volume = null, muted = null) => {
            playerSettings.set('volume', volume ?? this.state.volume);
            playerSettings.set('muted', muted ?? this.state.muted);
          };
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 1 other location - About 1 hr to fix
        app/javascript/flavours/glitch/features/video/index.jsx on lines 460..463

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

        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

          handleVideoKeyDown = e => {
            // On the video element or the seek bar, we can safely use the space bar
            // for playback control because there are no buttons to press
        
            if (e.key === ' ') {
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 3 other locations - About 1 hr to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 443..452
        app/javascript/flavours/glitch/features/video/index.jsx on lines 284..293
        app/javascript/mastodon/features/audio/index.jsx on lines 437..446

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

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

            const { currentTime, duration, volume, buffer, dragging, paused, fullscreen, hovered, revealed } = this.state;
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 4 other locations - About 1 hr to fix
        app/javascript/flavours/glitch/features/notifications/components/column_settings.jsx on lines 56..56
        app/javascript/flavours/glitch/features/status/index.jsx on lines 681..681
        app/javascript/flavours/glitch/features/video/index.jsx on lines 545..545
        app/javascript/mastodon/features/notifications/components/column_settings.jsx on lines 55..55

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

        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

            if (this.props.currentTime || fullscreen || dragging) {
              preload = 'auto';
            } else if (detailed) {
              preload = 'metadata';
            } else {
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 1 other location - About 1 hr to fix
        app/javascript/flavours/glitch/features/video/index.jsx on lines 557..563

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

        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

          handleTimeUpdate = () => {
            this.setState({
              currentTime: this.video.currentTime,
              duration:this.video.duration,
            });
        Severity: Major
        Found in app/javascript/mastodon/features/video/index.jsx and 3 other locations - About 40 mins to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 291..296
        app/javascript/flavours/glitch/features/video/index.jsx on lines 202..207
        app/javascript/mastodon/features/audio/index.jsx on lines 285..290

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

        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

        There are no issues that match your filters.

        Category
        Status