glitch-soc/mastodon

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

Summary

Maintainability
F
1 mo
Test Coverage

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

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

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

Severity: Minor
Found in app/javascript/mastodon/features/audio/index.jsx - About 7 hrs to fix

    Audio has 46 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Audio extends PureComponent {
    
      static propTypes = {
        src: PropTypes.string.isRequired,
        alt: PropTypes.string,
    Severity: Minor
    Found in app/javascript/mastodon/features/audio/index.jsx - About 6 hrs to fix

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

        render () {
          const { src, intl, alt, lang, editable, autoPlay, sensitive, blurhash } = this.props;
          const { paused, volume, currentTime, duration, buffer, dragging, 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/audio/index.jsx - About 4 hrs to fix

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

          render () {
            const { src, intl, alt, lang, editable, autoPlay, sensitive, blurhash } = this.props;
            const { paused, volume, currentTime, duration, buffer, dragging, 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/audio/index.jsx - About 2 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

          render () {
            const { src, intl, alt, lang, editable, autoPlay, sensitive, blurhash } = this.props;
            const { paused, volume, currentTime, duration, buffer, dragging, 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/audio/index.jsx and 1 other location - About 1 wk to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 479..599

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

        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

          static propTypes = {
            src: PropTypes.string.isRequired,
            alt: PropTypes.string,
            lang: PropTypes.string,
            poster: PropTypes.string,
        Severity: Major
        Found in app/javascript/mastodon/features/audio/index.jsx and 1 other location - About 1 day to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 40..64

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

        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.canvas || !this.audio) {
              return;
            }
        
        
        Severity: Major
        Found in app/javascript/mastodon/features/audio/index.jsx and 1 other location - About 1 day to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 310..327

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

        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

          handleDownload = () => {
            fetch(this.props.src).then(res => res.blob()).then(blob => {
              const element   = document.createElement('a');
              const objectURL = URL.createObjectURL(blob);
        
        
        Severity: Major
        Found in app/javascript/mastodon/features/audio/index.jsx and 1 other location - About 1 day to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 365..381

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

        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

          _initAudioContext () {
            const AudioContext = window.AudioContext || window.webkitAudioContext;
            const context      = new AudioContext();
            const source       = context.createMediaElementSource(this.audio);
            const gainNode     = context.createGain();
        Severity: Major
        Found in app/javascript/mastodon/features/audio/index.jsx and 1 other location - About 6 hrs to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 349..363

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

        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 => {
            switch(e.key) {
            case 'k':
              e.preventDefault();
              e.stopPropagation();
        Severity: Major
        Found in app/javascript/mastodon/features/audio/index.jsx and 1 other location - About 6 hrs to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 454..477

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

        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.state.muted || this.state.volume === 0);
        
            this.setState((state) => ({ muted, volume: Math.max(state.volume || 0.5, 0.05) }), () => {
              if (this.gainNode) {
        Severity: Major
        Found in app/javascript/mastodon/features/audio/index.jsx and 1 other location - About 5 hrs to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 219..227

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

        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

          _pack() {
            return {
              src: this.props.src,
              volume: this.state.volume,
              muted: this.state.muted,
        Severity: Major
        Found in app/javascript/mastodon/features/audio/index.jsx and 1 other location - About 5 hrs to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 91..104

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

        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/audio/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/video/index.jsx on lines 236..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 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

        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/audio/index.jsx and 1 other location - About 5 hrs to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 298..308

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

        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.audioContext) {
              this._initAudioContext();
            }
        
        
        Severity: Major
        Found in app/javascript/mastodon/features/audio/index.jsx and 1 other location - About 4 hrs to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 173..183

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

        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 = {
            width: this.props.width,
            currentTime: 0,
            buffer: 0,
            duration: null,
        Severity: Major
        Found in app/javascript/mastodon/features/audio/index.jsx and 1 other location - About 3 hrs to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 66..76

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

        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/audio/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/video/index.jsx on lines 206..216

        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/audio/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/video/index.jsx on lines 250..258

        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 6 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/audio/index.jsx and 5 other locations - About 3 hrs to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 26..33
        app/javascript/flavours/glitch/features/notifications/components/filter_bar.jsx on lines 14..21
        app/javascript/flavours/glitch/features/status/containers/detailed_status_container.js on lines 33..40
        app/javascript/mastodon/features/notifications/components/filter_bar.jsx on lines 14..21
        app/javascript/mastodon/features/status/containers/detailed_status_container.js on lines 35..42

        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

          handleMouseMove = throttle(e => {
            const { x } = getPointerPosition(this.seek, e);
            const currentTime = this.audio.duration * x;
        
            if (!isNaN(currentTime)) {
        Severity: Major
        Found in app/javascript/mastodon/features/audio/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/video/index.jsx on lines 260..269

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 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

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

            if (prevProps.src !== this.props.src || this.state.width !== prevState.width || this.state.height !== prevState.height || prevProps.accentColor !== this.props.accentColor) {
              this._clear();
              this._draw();
            }
        Severity: Major
        Found in app/javascript/mastodon/features/audio/index.jsx and 1 other location - About 3 hrs to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 152..155

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

          handleProgress = () => {
            const lastTimeRange = this.audio.buffered.length - 1;
        
            if (lastTimeRange > -1) {
              this.setState({ buffer: Math.ceil(this.audio.buffered.end(lastTimeRange) / this.audio.duration * 100) });
        Severity: Major
        Found in app/javascript/mastodon/features/audio/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/video/index.jsx on lines 496..502

        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

          componentWillUnmount () {
            window.removeEventListener('scroll', this.handleScroll);
            window.removeEventListener('resize', this.handleResize);
        
            if (!this.state.paused && this.audio && this.props.deployPictureInPicture) {
        Severity: Major
        Found in app/javascript/mastodon/features/audio/index.jsx and 1 other location - About 3 hrs to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 164..171

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

        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

          _renderCanvas () {
            requestAnimationFrame(() => {
              if (!this.audio) return;
        
              this.handleTimeUpdate();
        Severity: Major
        Found in app/javascript/mastodon/features/audio/index.jsx and 1 other location - About 2 hrs to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 383..395

        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.audio.currentTime + time;
        
            if (!isNaN(currentTime)) {
              this.setState({ currentTime }, () => {
        Severity: Major
        Found in app/javascript/mastodon/features/audio/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/video/index.jsx on lines 271..279

        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/audio/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/video/index.jsx on lines 218..223

        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

          handlePlay = () => {
            this.setState({ paused: false });
        
            if (this.audioContext && this.audioContext.state === 'suspended') {
              this.audioContext.resume();
        Severity: Major
        Found in app/javascript/mastodon/features/audio/index.jsx and 1 other location - About 2 hrs to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 193..201

        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

          handleLoadedData = () => {
            const { autoPlay, currentTime } = this.props;
        
            if (currentTime) {
              this.audio.currentTime = currentTime;
        Severity: Major
        Found in app/javascript/mastodon/features/audio/index.jsx and 1 other location - About 1 hr to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 337..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 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/audio/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/video/index.jsx on lines 468..474

        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/audio/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/video/index.jsx on lines 391..395

        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

          setAudioRef = c => {
            this.audio = c;
        
            if (this.audio) {
              this.audio.volume = 1;
        Severity: Major
        Found in app/javascript/mastodon/features/audio/index.jsx and 1 other location - About 1 hr to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 127..134

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

        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

          _draw() {
            this.visualizer.draw(this._getCX(), this._getCY(), this._getAccentColor(), this._getRadius(), this._getScaleCoefficient());
          }
        Severity: Major
        Found in app/javascript/mastodon/features/audio/index.jsx and 1 other location - About 1 hr to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 401..403

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

        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

          handleAudioKeyDown = e => {
            // On the audio 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/audio/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/video/index.jsx on lines 281..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 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 2 locations. Consider refactoring.
        Open

          _getRadius () {
            return parseInt((this.state.height || this.props.height) / 2 - PADDING * this._getScaleCoefficient());
          }
        Severity: Minor
        Found in app/javascript/mastodon/features/audio/index.jsx and 1 other location - About 55 mins to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 405..407

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

        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

          handlePause = () => {
            this.setState({ paused: true });
        
            if (this.audioContext) {
              this.audioContext.suspend();
        Severity: Minor
        Found in app/javascript/mastodon/features/audio/index.jsx and 1 other location - About 50 mins to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 203..209

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

        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.audio.currentTime,
              duration: this.audio.duration,
            });
        Severity: Major
        Found in app/javascript/mastodon/features/audio/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/video/index.jsx on lines 199..204

        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

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

          componentDidMount () {
            window.addEventListener('scroll', this.handleScroll);
            window.addEventListener('resize', this.handleResize, { passive: true });
          }
        Severity: Minor
        Found in app/javascript/mastodon/features/audio/index.jsx and 1 other location - About 35 mins to fix
        app/javascript/flavours/glitch/features/audio/index.jsx on lines 142..145

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

        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