glitch-soc/mastodon

View on GitHub

Showing 4,938 of 4,938 total issues

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

  render () {
    let ancestors, descendants, remoteHint;
    const { isLoading, status, settings, ancestorsIds, descendantsIds, intl, domain, multiColumn, pictureInPicture } = this.props;
    const { fullscreen } = this.state;

Severity: Major
Found in app/javascript/flavours/glitch/features/status/index.jsx - About 4 hrs to fix

    File detailed_status.tsx has 350 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* eslint-disable @typescript-eslint/no-unsafe-member-access,
                      @typescript-eslint/no-unsafe-call,
                      @typescript-eslint/no-explicit-any,
                      @typescript-eslint/no-unsafe-assignment */
    
    

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

      export const vote = (pollId, choices) => (dispatch) => {
        dispatch(voteRequest());
      
        api().post(`/api/v1/polls/${pollId}/votes`, { choices })
          .then(({ data }) => {
      Severity: Major
      Found in app/javascript/mastodon/actions/polls.js and 1 other location - About 4 hrs to fix
      app/javascript/flavours/glitch/actions/polls.js on lines 13..22

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

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

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

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

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

      Refactorings

      Further Reading

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

      export const vote = (pollId, choices) => (dispatch) => {
        dispatch(voteRequest());
      
        api().post(`/api/v1/polls/${pollId}/votes`, { choices })
          .then(({ data }) => {
      Severity: Major
      Found in app/javascript/flavours/glitch/actions/polls.js and 1 other location - About 4 hrs to fix
      app/javascript/mastodon/actions/polls.js on lines 13..22

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

      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 RegenerationIndicator = () => (
        <div className='regeneration-indicator'>
          <div className='regeneration-indicator__figure'>
            <img src={illustration} alt='' />
          </div>
      app/javascript/flavours/glitch/components/regeneration_indicator.jsx on lines 5..16

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

      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 RegenerationIndicator = () => (
        <div className='regeneration-indicator'>
          <div className='regeneration-indicator__figure'>
            <img src={illustration} alt='' />
          </div>
      app/javascript/mastodon/components/regeneration_indicator.jsx on lines 5..16

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

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

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

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

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

      Refactorings

      Further Reading

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

      export const useHovering = (animate?: boolean) => {
        const [hovering, setHovering] = useState<boolean>(animate ?? false);
      
        const handleMouseEnter = useCallback(() => {
          if (animate) return;
      Severity: Major
      Found in app/javascript/hooks/useHovering.ts and 1 other location - About 4 hrs to fix
      app/javascript/flavours/glitch/hooks/useHovering.ts on lines 3..17

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

      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

      Object.keys(shortCodesToEmojiData).forEach((shortCode) => {
        const emojiData = shortCodesToEmojiData[shortCode];
        if (!emojiData) return;
      
        const [_filenameData, searchData] = emojiData;
      app/javascript/mastodon/features/emoji/emoji_mart_data_light.ts on lines 31..44

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

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

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

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

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

      Refactorings

      Further Reading

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

      export const TimelineHint: React.FC<Props> = ({
        className,
        message,
        label,
        url,
      Severity: Major
      Found in app/javascript/flavours/glitch/components/timeline_hint.tsx and 1 other location - About 4 hrs to fix
      app/javascript/mastodon/components/timeline_hint.tsx on lines 10..23

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

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

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

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

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

      Refactorings

      Further Reading

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

      export const useHovering = (animate?: boolean) => {
        const [hovering, setHovering] = useState<boolean>(animate ?? false);
      
        const handleMouseEnter = useCallback(() => {
          if (animate) return;
      Severity: Major
      Found in app/javascript/flavours/glitch/hooks/useHovering.ts and 1 other location - About 4 hrs to fix
      app/javascript/hooks/useHovering.ts on lines 3..17

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

      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

      Object.keys(shortCodesToEmojiData).forEach((shortCode) => {
        const emojiData = shortCodesToEmojiData[shortCode];
        if (!emojiData) return;
      
        const [_filenameData, searchData] = emojiData;
      app/javascript/flavours/glitch/features/emoji/emoji_mart_data_light.ts on lines 31..44

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

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

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

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

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

      Refactorings

      Further Reading

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

      export const TimelineHint: React.FC<Props> = ({
        className,
        message,
        label,
        url,
      Severity: Major
      Found in app/javascript/mastodon/components/timeline_hint.tsx and 1 other location - About 4 hrs to fix
      app/javascript/flavours/glitch/components/timeline_hint.tsx on lines 10..23

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

      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

      function ensureTrailingGap(
        groups: NotificationGroupsState['groups'],
      ): NotificationGap {
        const groupOrGap = groups.at(-1);
      
      
      Severity: Major
      Found in app/javascript/mastodon/reducers/notification_groups.ts and 1 other location - About 4 hrs to fix
      app/javascript/flavours/glitch/reducers/notification_groups.ts on lines 405..424

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

      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

      function ensureTrailingGap(
        groups: NotificationGroupsState['groups'],
      ): NotificationGap {
        const groupOrGap = groups.at(-1);
      
      
      app/javascript/mastodon/reducers/notification_groups.ts on lines 405..424

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

      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

      Function Profile has 109 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const Profile = () => {
        const account = useAppSelector(state => state.getIn(['accounts', me]));
        const [displayName, setDisplayName] = useState(account.get('display_name'));
        const [note, setNote] = useState(unescapeHTML(account.get('note')));
        const [avatar, setAvatar] = useState(null);
      Severity: Major
      Found in app/javascript/flavours/glitch/features/onboarding/profile.jsx - About 4 hrs to fix

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

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

          Function Profile has 109 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const Profile = () => {
            const account = useAppSelector(state => state.getIn(['accounts', me]));
            const [displayName, setDisplayName] = useState(account.get('display_name'));
            const [note, setNote] = useState(unescapeHTML(account.get('note')));
            const [avatar, setAvatar] = useState(null);
          Severity: Major
          Found in app/javascript/mastodon/features/onboarding/profile.jsx - About 4 hrs to fix

            Class LinkDetailsExtractor has 34 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class LinkDetailsExtractor
              include ActionView::Helpers::TagHelper
              include LanguagesHelper
            
              # Some publications wrap their JSON-LD data in their <script> tags
            Severity: Minor
            Found in app/lib/link_details_extractor.rb - About 4 hrs to fix

              File user.rb has 347 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              class User < ApplicationRecord
                self.ignored_columns += %w(
                  remember_created_at
                  remember_token
                  current_sign_in_ip
              Severity: Minor
              Found in app/models/user.rb - About 4 hrs to fix

                File feed_manager.rb has 346 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require 'singleton'
                
                class FeedManager
                  include Singleton
                  include Redisable
                Severity: Minor
                Found in app/lib/feed_manager.rb - About 4 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language