glitch-soc/mastodon

View on GitHub

Showing 1,287 of 4,903 total issues

Function timeRemainingString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const timeRemainingString = (
  intl: IntlShape,
  date: Date,
  now: number,
  timeGiven = true,
Severity: Minor
Found in app/javascript/mastodon/components/relative_timestamp.tsx - About 35 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

Function Hashtag has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export const Hashtag: React.FC<HashtagProps> = ({
  name,
  to,
  people,
  uses,
Severity: Minor
Found in app/javascript/mastodon/components/hashtag.tsx - About 35 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

Function loaded has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function loaded() {
  const { messages: localeData } = getLocale();

  const locale = document.documentElement.lang;

Severity: Minor
Found in app/javascript/entrypoints/public.tsx - About 35 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

Avoid too many return statements within this function.
Open

  return showAlert({
    title: messages.unexpectedTitle,
    message: messages.unexpectedMessage,
  });
Severity: Major
Found in app/javascript/flavours/glitch/actions/alerts.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

      return value;
    Severity: Major
    Found in app/javascript/flavours/glitch/features/interaction_modal/index.jsx - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return '';
      Severity: Major
      Found in app/javascript/flavours/glitch/features/interaction_modal/index.jsx - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

          return showAlert({
            title: messages.unexpectedTitle,
            message: messages.unexpectedMessage,
          });
        Severity: Major
        Found in app/javascript/mastodon/actions/alerts.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return state;
          Severity: Major
          Found in app/javascript/flavours/glitch/reducers/statuses.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return state;
            Severity: Major
            Found in app/javascript/flavours/glitch/reducers/user_lists.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return messages.follow;
              Severity: Major
              Found in app/javascript/mastodon/features/account/components/header.jsx - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return state.withMutations(map => {
                      map.set('text', text);
                      map.set('content_type', action.content_type || 'text/plain');
                      map.set('in_reply_to', action.status.get('in_reply_to_id'));
                      map.set('privacy', action.status.get('visibility'));
                Severity: Major
                Found in app/javascript/flavours/glitch/reducers/compose.js - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                      return actor unless verify_signature(actor, signature, compare_signed_string).nil?
                  Severity: Major
                  Found in app/controllers/concerns/signature_verification.rb - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return state;
                    Severity: Major
                    Found in app/javascript/mastodon/reducers/compose.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return state.set('id', null);
                      Severity: Major
                      Found in app/javascript/mastodon/reducers/compose.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return state;
                        Severity: Major
                        Found in app/javascript/mastodon/reducers/user_lists.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return '';
                          Severity: Major
                          Found in app/javascript/mastodon/features/interaction_modal/index.jsx - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                              return value;
                            Severity: Major
                            Found in app/javascript/mastodon/features/interaction_modal/index.jsx - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                    return state;
                              Severity: Major
                              Found in app/javascript/mastodon/reducers/statuses.js - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                    return ActivityPub::TagManager.instance.uri_to_resource(object_uri, Status) if ActivityPub::TagManager.instance.local_uri?(object_uri)
                                Severity: Major
                                Found in app/services/activitypub/fetch_remote_status_service.rb - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                        return
                                  Severity: Major
                                  Found in app/services/resolve_account_service.rb - About 30 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language