glitch-soc/mastodon

View on GitHub
app/javascript/flavours/glitch/features/ui/index.jsx

Summary

Maintainability
F
1 wk
Test Coverage

File index.jsx has 554 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: Major
Found in app/javascript/flavours/glitch/features/ui/index.jsx - About 1 day to fix

    UI has 36 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class UI extends PureComponent {
      static propTypes = {
        identity: identityContextPropShape,
        dispatch: PropTypes.func.isRequired,
        children: PropTypes.node,
    Severity: Minor
    Found in app/javascript/flavours/glitch/features/ui/index.jsx - About 4 hrs to fix

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

        render () {
          const { children, singleColumn } = this.props;
          const { signedIn } = this.props.identity;
          const pathName = this.props.location.pathname;
      
      
      Severity: Major
      Found in app/javascript/flavours/glitch/features/ui/index.jsx - About 3 hrs to fix

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

          render () {
            const { draggingOver } = this.state;
            const { children, isWide, location, layout, moved } = this.props;
        
            const className = classNames('ui', {
        Severity: Major
        Found in app/javascript/flavours/glitch/features/ui/index.jsx - About 2 hrs to fix

          Function componentDidMount has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            componentDidMount () {
              const { signedIn } = this.props.identity;
          
              window.addEventListener('beforeunload', this.handleBeforeUnload, false);
              window.addEventListener('resize', this.handleResize, { passive: true });
          Severity: Minor
          Found in app/javascript/flavours/glitch/features/ui/index.jsx - About 1 hr to fix

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

              render () {
                const { children, singleColumn } = this.props;
                const { signedIn } = this.props.identity;
                const pathName = this.props.location.pathname;
            
            
            Severity: Minor
            Found in app/javascript/flavours/glitch/features/ui/index.jsx - About 1 hr 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

            Function componentDidUpdate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              componentDidUpdate (prevProps) {
                if (this.props.unreadNotifications !== prevProps.unreadNotifications ||
                    this.props.showFaviconBadge !== prevProps.showFaviconBadge) {
                  if (this.favicon) {
                    try {
            Severity: Minor
            Found in app/javascript/flavours/glitch/features/ui/index.jsx - About 1 hr 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

            Function componentDidMount has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              componentDidMount () {
                const { signedIn } = this.props.identity;
            
                window.addEventListener('beforeunload', this.handleBeforeUnload, false);
                window.addEventListener('resize', this.handleResize, { passive: true });
            Severity: Minor
            Found in app/javascript/flavours/glitch/features/ui/index.jsx - About 25 mins 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

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

                if (signedIn) {
                  if (singleColumn) {
                    redirect = <Redirect from='/' to='/home' exact />;
                  } else {
                    redirect = <Redirect from='/' to='/deck/getting-started' exact />;
            Severity: Major
            Found in app/javascript/flavours/glitch/features/ui/index.jsx and 1 other location - About 1 day to fix
            app/javascript/mastodon/features/ui/index.jsx on lines 168..180

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

            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

                const handlers = {
                  help: this.handleHotkeyToggleHelp,
                  new: this.handleHotkeyNew,
                  search: this.handleHotkeySearch,
                  forceNew: this.handleHotkeyForceNew,
            Severity: Major
            Found in app/javascript/flavours/glitch/features/ui/index.jsx and 1 other location - About 7 hrs to fix
            app/javascript/mastodon/features/ui/index.jsx on lines 559..579

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

            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

              handleDragEnter = (e) => {
                e.preventDefault();
            
                if (!this.dragTargets) {
                  this.dragTargets = [];
            Severity: Major
            Found in app/javascript/flavours/glitch/features/ui/index.jsx and 1 other location - About 7 hrs to fix
            app/javascript/mastodon/features/ui/index.jsx on lines 298..312

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

            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

              handleDrop = (e) => {
                if (this.dataTransferIsText(e.dataTransfer)) return;
            
                e.preventDefault();
            
            
            Severity: Major
            Found in app/javascript/flavours/glitch/features/ui/index.jsx and 1 other location - About 5 hrs to fix
            app/javascript/mastodon/features/ui/index.jsx on lines 329..340

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

            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

              handleHotkeyFocusColumn = e => {
                const index  = (e.key * 1) + 1; // First child is drawer, skip that
                const column = this.node.querySelector(`.column:nth-child(${index})`);
                if (!column) return;
                const container = column.querySelector('.scrollable');
            Severity: Major
            Found in app/javascript/flavours/glitch/features/ui/index.jsx and 1 other location - About 5 hrs to fix
            app/javascript/mastodon/features/ui/index.jsx on lines 467..483

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

            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

              componentDidUpdate (prevProps) {
                if (![this.props.location.pathname, '/'].includes(prevProps.location.pathname)) {
                  this.node.handleChildrenContentChange();
                }
            
            
            Severity: Major
            Found in app/javascript/flavours/glitch/features/ui/index.jsx and 1 other location - About 5 hrs to fix
            app/javascript/mastodon/features/ui/index.jsx on lines 144..153

            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

              handleDragLeave = (e) => {
                e.preventDefault();
                e.stopPropagation();
            
                this.dragTargets = this.dragTargets.filter(el => el !== e.target && this.node.contains(el));
            Severity: Major
            Found in app/javascript/flavours/glitch/features/ui/index.jsx and 1 other location - About 4 hrs to fix
            app/javascript/mastodon/features/ui/index.jsx on lines 342..353

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

            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

              UNSAFE_componentWillMount () {
                if (this.props.singleColumn) {
                  document.body.classList.toggle('layout-single-column', true);
                  document.body.classList.toggle('layout-multiple-columns', false);
                } else {
            Severity: Major
            Found in app/javascript/flavours/glitch/features/ui/index.jsx and 1 other location - About 3 hrs to fix
            app/javascript/mastodon/features/ui/index.jsx on lines 134..142

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

            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 (signedIn) {
                  this.props.dispatch(fetchMarkers());
                  this.props.dispatch(expandHomeTimeline());
                  this.props.dispatch(initializeNotifications());
                  this.props.dispatch(fetchServerTranslationLanguages());
            Severity: Major
            Found in app/javascript/flavours/glitch/features/ui/index.jsx and 1 other location - About 3 hrs to fix
            app/javascript/mastodon/features/ui/index.jsx on lines 406..413

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

            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

              handleResize = () => {
                const layout = layoutFromWindow();
            
                if (layout !== this.props.layout) {
                  this.handleLayoutChange.cancel();
            Severity: Major
            Found in app/javascript/flavours/glitch/features/ui/index.jsx and 1 other location - About 2 hrs to fix
            app/javascript/mastodon/features/ui/index.jsx on lines 377..386

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

            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

              handleDragOver = (e) => {
                if (this.dataTransferIsText(e.dataTransfer)) return false;
            
                e.preventDefault();
                e.stopPropagation();
            Severity: Major
            Found in app/javascript/flavours/glitch/features/ui/index.jsx and 1 other location - About 2 hrs to fix
            app/javascript/mastodon/features/ui/index.jsx on lines 314..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 82.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

              handleServiceWorkerPostMessage = ({ data }) => {
                if (data.type === 'navigate') {
                  this.props.history.push(data.path);
                } else {
                  console.warn('Unknown message type:', data.type);
            Severity: Major
            Found in app/javascript/flavours/glitch/features/ui/index.jsx and 1 other location - About 2 hrs to fix
            app/javascript/mastodon/features/ui/index.jsx on lines 363..369

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

            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

              handleHotkeyToggleHelp = () => {
                if (this.props.location.pathname === '/keyboard-shortcuts') {
                  this.props.history.goBack();
                } else {
                  this.props.history.push('/keyboard-shortcuts');
            Severity: Major
            Found in app/javascript/flavours/glitch/features/ui/index.jsx and 1 other location - About 1 hr to fix
            app/javascript/mastodon/features/ui/index.jsx on lines 499..505

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

            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

              handleHotkeyBack = () => {
                const { history } = this.props;
            
                if (history.location?.state?.fromMastodon) {
                  history.goBack();
            Severity: Major
            Found in app/javascript/flavours/glitch/features/ui/index.jsx and 1 other location - About 1 hr to fix
            app/javascript/mastodon/features/ui/index.jsx on lines 485..493

            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

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

                        {singleColumn && pathName.startsWith('/deck/') ? <Redirect from={pathName} to={{...this.props.location, pathname: pathName.slice(5)}} /> : null}
            Severity: Major
            Found in app/javascript/flavours/glitch/features/ui/index.jsx and 1 other location - About 1 hr to fix
            app/javascript/mastodon/features/ui/index.jsx on lines 189..189

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

            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

                      <SwitchingColumnsArea identity={this.props.identity} location={location} singleColumn={layout === 'mobile' || layout === 'single-column'}>
                        {children}
                      </SwitchingColumnsArea>
            Severity: Major
            Found in app/javascript/flavours/glitch/features/ui/index.jsx and 1 other location - About 1 hr to fix
            app/javascript/mastodon/features/ui/index.jsx on lines 586..588

            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

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

              handleHotkeyNew = e => {
                e.preventDefault();
            
                const element = this.node.querySelector('.autosuggest-textarea__textarea');
            
            
            Severity: Major
            Found in app/javascript/flavours/glitch/features/ui/index.jsx and 3 other locations - About 1 hr to fix
            app/javascript/flavours/glitch/features/ui/index.jsx on lines 497..505
            app/javascript/mastodon/features/ui/index.jsx on lines 437..445
            app/javascript/mastodon/features/ui/index.jsx on lines 447..455

            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

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

              handleHotkeySearch = e => {
                e.preventDefault();
            
                const element = this.node.querySelector('.search__input');
            
            
            Severity: Major
            Found in app/javascript/flavours/glitch/features/ui/index.jsx and 3 other locations - About 1 hr to fix
            app/javascript/flavours/glitch/features/ui/index.jsx on lines 487..495
            app/javascript/mastodon/features/ui/index.jsx on lines 437..445
            app/javascript/mastodon/features/ui/index.jsx on lines 447..455

            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

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

              dataTransferIsText = (dataTransfer) => {
                return (dataTransfer && Array.from(dataTransfer.types).filter((type) => type === 'text/plain').length === 1);
              };
            Severity: Minor
            Found in app/javascript/flavours/glitch/features/ui/index.jsx and 1 other location - About 55 mins to fix
            app/javascript/mastodon/features/ui/index.jsx on lines 355..357

            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

              canUploadMore: !state.getIn(['compose', 'media_attachments']).some(x => ['audio', 'video'].includes(x.get('type'))) && state.getIn(['compose', 'media_attachments']).size < 4,
            Severity: Minor
            Found in app/javascript/flavours/glitch/features/ui/index.jsx and 1 other location - About 35 mins to fix
            app/javascript/mastodon/features/ui/index.jsx on lines 88..88

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 46.

            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

              handleHotkeyGoToProfile = () => {
                this.props.history.push(`/@${this.props.username}`);
              };
            Severity: Minor
            Found in app/javascript/flavours/glitch/features/ui/index.jsx and 1 other location - About 35 mins to fix
            app/javascript/mastodon/features/ui/index.jsx on lines 539..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 46.

            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

                this.hotkeys.__mousetrap__.stopCallback = (e, element) => {
                  return ['TEXTAREA', 'SELECT', 'INPUT'].includes(element.tagName);
                };
            Severity: Minor
            Found in app/javascript/flavours/glitch/features/ui/index.jsx and 1 other location - About 30 mins to fix
            app/javascript/mastodon/features/ui/index.jsx on lines 415..417

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

            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