glitch-soc/mastodon

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

Summary

Maintainability
F
1 wk
Test Coverage

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

  render () {
    const { multiColumn, intl, server, extendedDescription, domainBlocks } = this.props;
    const isLoading = server.get('isLoading');

    return (
Severity: Major
Found in app/javascript/flavours/glitch/features/about/index.jsx - About 3 hrs to fix

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

      render () {
        const { multiColumn, intl, server, extendedDescription, domainBlocks } = this.props;
        const isLoading = server.get('isLoading');
    
        return (
    Severity: Minor
    Found in app/javascript/flavours/glitch/features/about/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

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

              <Section title={intl.formatMessage(messages.blocks)} onOpen={this.handleDomainBlocksOpen}>
                {domainBlocks.get('isLoading') ? (
                  <>
                    <Skeleton width='100%' />
                    <br />
    Severity: Major
    Found in app/javascript/flavours/glitch/features/about/index.jsx and 1 other location - About 2 days to fix
    app/javascript/mastodon/features/about/index.jsx on lines 181..210

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

    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

    class Section extends PureComponent {
    
      static propTypes = {
        title: PropTypes.string,
        children: PropTypes.node,
    Severity: Major
    Found in app/javascript/flavours/glitch/features/about/index.jsx and 1 other location - About 1 day to fix
    app/javascript/mastodon/features/about/index.jsx on lines 51..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 333.

    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

              <div className='about__meta'>
                <div className='about__meta__column'>
                  <h4><FormattedMessage id='server_banner.administered_by' defaultMessage='Administered by:' /></h4>
    
                  <Account id={server.getIn(['contact', 'account', 'id'])} size={36} minimal />
    Severity: Major
    Found in app/javascript/flavours/glitch/features/about/index.jsx and 1 other location - About 1 day to fix
    app/javascript/mastodon/features/about/index.jsx on lines 129..143

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

    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

              <Section title={intl.formatMessage(messages.rules)}>
                {!isLoading && (server.get('rules', ImmutableList()).isEmpty() ? (
                  <p><FormattedMessage id='about.not_available' defaultMessage='This information has not been made available on this server.' /></p>
                ) : (
                  <ol className='rules-list'>
    Severity: Major
    Found in app/javascript/flavours/glitch/features/about/index.jsx and 1 other location - About 1 day to fix
    app/javascript/mastodon/features/about/index.jsx on lines 166..179

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

    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

              <div className='about__header'>
                <ServerHeroImage blurhash={server.getIn(['thumbnail', 'blurhash'])} src={server.getIn(['thumbnail', 'url'])} srcSet={server.getIn(['thumbnail', 'versions'])?.map((value, key) => `${value} ${key.replace('@', '')}`).join(', ')} className='about__header__hero' />
                <h1>{isLoading ? <Skeleton width='10ch' /> : server.get('domain')}</h1>
                <p><FormattedMessage id='about.powered_by' defaultMessage='Decentralized social media powered by {mastodon}' values={{ mastodon: <a href='https://joinmastodon.org' className='about__mail' target='_blank'>Mastodon</a> }} /></p>
              </div>
    Severity: Major
    Found in app/javascript/flavours/glitch/features/about/index.jsx and 1 other location - About 1 day to fix
    app/javascript/mastodon/features/about/index.jsx on lines 123..127

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

    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

              <Section open title={intl.formatMessage(messages.title)}>
                {extendedDescription.get('isLoading') ? (
                  <>
                    <Skeleton width='100%' />
                    <br />
    Severity: Major
    Found in app/javascript/flavours/glitch/features/about/index.jsx and 1 other location - About 1 day to fix
    app/javascript/mastodon/features/about/index.jsx on lines 145..164

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

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

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

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

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

    Refactorings

    Further Reading

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

    const messages = defineMessages({
      title: { id: 'column.about', defaultMessage: 'About' },
      rules: { id: 'about.rules', defaultMessage: 'Server rules' },
      blocks: { id: 'about.blocks', defaultMessage: 'Moderated servers' },
      silenced: { id: 'about.domain_blocks.silenced.title', defaultMessage: 'Limited' },
    Severity: Major
    Found in app/javascript/flavours/glitch/features/about/index.jsx and 9 other locations - About 4 hrs to fix
    app/javascript/flavours/glitch/features/compose/components/content_type_button.jsx on lines 16..24
    app/javascript/flavours/glitch/features/direct_timeline/components/conversation.jsx on lines 32..40
    app/javascript/flavours/glitch/features/local_settings/navigation/index.jsx on lines 18..26
    app/javascript/flavours/glitch/features/notifications/components/notification_request.jsx on lines 26..34
    app/javascript/flavours/glitch/features/ui/components/focal_point_modal.jsx on lines 33..41
    app/javascript/mastodon/features/about/index.jsx on lines 23..31
    app/javascript/mastodon/features/direct_timeline/components/conversation.jsx on lines 31..39
    app/javascript/mastodon/features/notifications/components/notification_request.jsx on lines 26..34
    app/javascript/mastodon/features/ui/components/focal_point_modal.jsx on lines 33..41

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

    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 = {
        server: ImmutablePropTypes.map,
        extendedDescription: ImmutablePropTypes.map,
        domainBlocks: ImmutablePropTypes.contains({
          isLoading: PropTypes.bool,
    Severity: Major
    Found in app/javascript/flavours/glitch/features/about/index.jsx and 1 other location - About 3 hrs to fix
    app/javascript/mastodon/features/about/index.jsx on lines 92..103

    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

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

    const mapStateToProps = state => ({
      server: state.getIn(['server', 'server']),
      extendedDescription: state.getIn(['server', 'extendedDescription']),
      domainBlocks: state.getIn(['server', 'domainBlocks']),
    });
    Severity: Major
    Found in app/javascript/flavours/glitch/features/about/index.jsx and 1 other location - About 1 hr to fix
    app/javascript/mastodon/features/about/index.jsx on lines 45..49

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 60.

    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 severityMessages = {
      silence: {
        title: messages.silenced,
        explanation: messages.silencedExplanation,
      },
    Severity: Major
    Found in app/javascript/flavours/glitch/features/about/index.jsx and 1 other location - About 1 hr to fix
    app/javascript/mastodon/features/about/index.jsx on lines 33..43

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 56.

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

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

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

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

    Refactorings

    Further Reading

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

      componentDidMount () {
        const { dispatch } = this.props;
        dispatch(fetchServer());
        dispatch(fetchExtendedDescription());
      }
    Severity: Minor
    Found in app/javascript/flavours/glitch/features/about/index.jsx and 1 other location - About 30 mins to fix
    app/javascript/mastodon/features/about/index.jsx on lines 105..109

    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