glitch-soc/mastodon

View on GitHub

Showing 1,287 of 4,903 total issues

Consider simplifying this complex logical expression.
Open

    if (!newItems.isEmpty()) {
      usePendingItems = isLoadingRecent && (usePendingItems || !mutable.get('pendingItems').isEmpty());

      mutable.update(usePendingItems ? 'pendingItems' : 'items', oldItems => {
        // If called to poll *new* notifications, we just need to add them on top without duplicates
Severity: Major
Found in app/javascript/mastodon/reducers/notifications.js - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

      if (
        event.data &&
        typeof event.data === 'object' &&
        'type' in event.data &&
        event.data.type === 'fetchInteractionURL' &&
    Severity: Major
    Found in app/javascript/flavours/glitch/entrypoints/remote_interaction_helper.ts - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

        if (
          event.data &&
          typeof event.data === 'object' &&
          'type' in event.data &&
          event.data.type === 'fetchInteractionURL' &&
      Severity: Major
      Found in app/javascript/entrypoints/remote_interaction_helper.ts - About 40 mins to fix

        Function expandNotificationsSuccess has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        export function expandNotificationsSuccess(notifications, next, isLoadingMore, isLoadingRecent, usePendingItems) {
        Severity: Minor
        Found in app/javascript/flavours/glitch/actions/notifications.js - About 35 mins to fix

          Function expandNotificationsSuccess has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          export function expandNotificationsSuccess(notifications, next, isLoadingMore, isLoadingRecent, usePendingItems) {
          Severity: Minor
          Found in app/javascript/mastodon/actions/notifications.js - About 35 mins to fix

            Method import_relationships! has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def import_relationships!(action, undo_action, overwrite_scope, limit, extra_fields = {})
            Severity: Minor
            Found in app/services/import_service.rb - About 35 mins to fix

              Method retrieve has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                def self.retrieve(dimension_keys, start_at, end_at, limit, params)
              Severity: Minor
              Found in app/lib/admin/metrics/dimension.rb - About 35 mins to fix

                Method perform has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def perform(json, source_account_id, inbox_url, old_target_account_id, options = {})
                Severity: Minor
                Found in app/workers/activitypub/migrated_follow_delivery_worker.rb - About 35 mins to fix

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

                  const checkCanvasReliability = () => new Promise((resolve, reject) => {
                    switch(_browser_quirks['canvas-read-unreliable']) {
                    case true:
                      reject('Canvas reading unreliable');
                      break;
                  Severity: Minor
                  Found in app/javascript/flavours/glitch/utils/resize_image.js - 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 connectStream has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const connectStream = (channelName, params, callbacks) => (dispatch, getState) => {
                    const streamingAPIBaseURL = getState().getIn(['meta', 'streaming_api_base_url']);
                    const accessToken = getAccessToken();
                    const { onConnect, onReceive, onDisconnect } = callbacks(dispatch, getState);
                  
                  
                  Severity: Minor
                  Found in app/javascript/flavours/glitch/stream.js - 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 percIncrease has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const percIncrease = (a, b) => {
                    let percent;
                  
                    if (b !== 0) {
                      if (a !== 0) {
                  Severity: Minor
                  Found in app/javascript/flavours/glitch/components/admin/Counter.jsx - 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 dropOrientationIfNeeded has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const dropOrientationIfNeeded = (orientation) => new Promise(resolve => {
                    switch (_browser_quirks['image-orientation-automatic']) {
                    case true:
                      resolve(1);
                      break;
                  Severity: Minor
                  Found in app/javascript/flavours/glitch/utils/resize_image.js - 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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    render() {
                      const { intl, multiColumn, isSearching } = this.props;
                      const { signedIn } = this.props.identity;
                  
                      return (
                  Severity: Minor
                  Found in app/javascript/flavours/glitch/features/explore/index.jsx - 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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    render () {
                      const { label, href, target } = this.props;
                      const { loading, data } = this.state;
                  
                      let content;
                  Severity: Minor
                  Found in app/javascript/flavours/glitch/components/admin/Counter.jsx - 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 emojifyNode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const emojifyNode = (node, customEmojis) => {
                    for (const child of node.childNodes) {
                      switch(child.nodeType) {
                      case Node.TEXT_NODE:
                        emojifyTextNode(child, customEmojis);
                  Severity: Minor
                  Found in app/javascript/flavours/glitch/features/emoji/emoji.js - 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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    render () {
                      const { Message } = this;
                      const { type, children } = this.props;
                  
                      let iconId, iconComponent;
                  Severity: Minor
                  Found in app/javascript/flavours/glitch/components/status_prepend.jsx - 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 NotificationRequest has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const NotificationRequest = ({ multiColumn, params: { id } }) => {
                    const columnRef = useRef();
                    const intl = useIntl();
                    const dispatch = useDispatch();
                    const notificationRequest = useSelector(state => state.notificationRequests.current.item?.id === id ? state.notificationRequests.current.item : null);
                  Severity: Minor
                  Found in app/javascript/flavours/glitch/features/notifications/request.jsx - 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 NotificationRequests has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const NotificationRequests = ({ multiColumn }) => {
                    const columnRef = useRef();
                    const intl = useIntl();
                    const dispatch = useDispatch();
                    const isLoading = useSelector(state => state.notificationRequests.isLoading);
                  Severity: Minor
                  Found in app/javascript/flavours/glitch/features/notifications/requests.jsx - 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 getDerivedStateFromProps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    static getDerivedStateFromProps(props, state) {
                      let update = {};
                      let updated = false;
                  
                      if (props.params.statusId && state.statusId !== props.params.statusId) {
                  Severity: Minor
                  Found in app/javascript/flavours/glitch/features/status/index.jsx - 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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    render () {
                      const { intl, hasUnread, columnId, multiColumn, hasAnnouncements, unreadAnnouncements, showAnnouncements } = this.props;
                      const pinned = !!columnId;
                      const { signedIn } = this.props.identity;
                      const banners = [];
                  Severity: Minor
                  Found in app/javascript/flavours/glitch/features/home_timeline/index.jsx - 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

                  Severity
                  Category
                  Status
                  Source
                  Language