glitch-soc/mastodon

View on GitHub

Showing 1,278 of 4,906 total issues

Function statusLists has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function statusLists(state = initialState, action) {
  switch(action.type) {
  case FAVOURITED_STATUSES_FETCH_REQUEST:
  case FAVOURITED_STATUSES_EXPAND_REQUEST:
    return state.setIn(['favourites', 'isLoading'], true);
Severity: Major
Found in app/javascript/mastodon/reducers/status_lists.js - About 2 hrs to fix

    Function timelines has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function timelines(state = initialState, action) {
      switch(action.type) {
      case TIMELINE_LOAD_PENDING:
        return state.update(action.timeline, initialTimeline, map =>
          map.update('items', list => map.get('pendingItems').concat(list.take(40))).set('pendingItems', ImmutableList()).set('unread', 0));
    Severity: Major
    Found in app/javascript/mastodon/reducers/timelines.js - About 2 hrs to fix

      File note_serializer.rb has 251 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class ActivityPub::NoteSerializer < ActivityPub::Serializer
        include FormattingHelper
      
        context_extensions :atom_uri, :conversation, :sensitive, :voters_count, :direct_message
      
      
      Severity: Minor
      Found in app/serializers/activitypub/note_serializer.rb - About 2 hrs to fix

        Function render has 50 lines of code (exceeds 25 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 2 hrs to fix

          Function normalizeStatus has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function normalizeStatus(status, normalOldStatus, settings) {
            const normalStatus   = { ...status };
            normalStatus.account = status.account.id;
          
            if (status.reblog && status.reblog.id) {
          Severity: Minor
          Found in app/javascript/flavours/glitch/actions/importer/normalizer.js - About 2 hrs to fix

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

              render () {
                const { signedIn } = this.props.identity;
                const { location, openClosedRegistrationsModal, signupUrl, intl } = this.props;
            
                let content;
            Severity: Minor
            Found in app/javascript/flavours/glitch/features/ui/components/header.jsx - About 2 hrs to fix

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

                render () {
                  const { label, href, target } = this.props;
                  const { loading, data } = this.state;
              
                  let content;
              Severity: Minor
              Found in app/javascript/mastodon/components/admin/Counter.jsx - About 2 hrs to fix

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

                  render () {
                    const { loading, style, intl, custom_emojis, skinTone, frequentlyUsedEmojis } = this.props;
                
                    if (loading) {
                      return <div style={{ width: 299 }} />;

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

                    render () {
                      const { signedIn } = this.props.identity;
                      const { location, openClosedRegistrationsModal, signupUrl, intl } = this.props;
                  
                      let content;
                  Severity: Minor
                  Found in app/javascript/mastodon/features/ui/components/header.jsx - About 2 hrs to fix

                    Function createNotificationGroupFromNotificationJSON has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function createNotificationGroupFromNotificationJSON(
                      notification: ApiNotificationJSON,
                    ): NotificationGroup {
                      const group = {
                        sampleAccountIds: [notification.account.id],
                    Severity: Minor
                    Found in app/javascript/flavours/glitch/models/notification_group.ts - About 2 hrs to fix

                      Function createNotificationGroupFromNotificationJSON has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function createNotificationGroupFromNotificationJSON(
                        notification: ApiNotificationJSON,
                      ): NotificationGroup {
                        const group = {
                          sampleAccountIds: [notification.account.id],
                      Severity: Minor
                      Found in app/javascript/mastodon/models/notification_group.ts - About 2 hrs to fix

                        Function uploadCompose has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function uploadCompose(files) {
                          return function (dispatch, getState) {
                            const uploadLimit = getState().getIn(['server', 'server', 'configuration', 'statuses', 'max_media_attachments']);
                            const media = getState().getIn(['compose', 'media_attachments']);
                            const pending = getState().getIn(['compose', 'pending_media_attachments']);
                        Severity: Minor
                        Found in app/javascript/flavours/glitch/actions/compose.js - About 1 hr to fix

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

                            render () {
                              const { accountId, accountIds, hasMore, blockedBy, isAccount, multiColumn, isLoading, suspended, hidden, remote, remoteUrl, hideCollections } = this.props;
                          
                              if (!isAccount) {
                                return (
                          Severity: Minor
                          Found in app/javascript/mastodon/features/followers/index.jsx - About 1 hr to fix

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

                              render () {
                                const { accountId, accountIds, hasMore, blockedBy, isAccount, multiColumn, isLoading, suspended, hidden, remote, remoteUrl, hideCollections } = this.props;
                            
                                if (!isAccount) {
                                  return (
                            Severity: Minor
                            Found in app/javascript/mastodon/features/following/index.jsx - About 1 hr to fix

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

                                render () {
                                  let closedRegistrationsMessage;
                              
                                  if (this.props.message) {
                                    closedRegistrationsMessage = (

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

                                  render () {
                                    let closedRegistrationsMessage;
                                
                                    if (this.props.message) {
                                      closedRegistrationsMessage = (

                                  Function mapDispatchToProps has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  const mapDispatchToProps = (dispatch, { contextType }) => ({
                                  
                                    onReply (status) {
                                      dispatch((_, getState) => {
                                        let state = getState();
                                  Severity: Minor
                                  Found in app/javascript/flavours/glitch/containers/status_container.js - 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 mapDispatchToProps has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  const mapDispatchToProps = (dispatch, { contextType }) => ({
                                  
                                    onReply (status) {
                                      dispatch((_, getState) => {
                                        let state = getState();
                                  Severity: Minor
                                  Found in app/javascript/mastodon/containers/status_container.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

                                  Method calculate_scores has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    def calculate_scores(preview_cards, at_time)
                                      items = preview_cards.map do |preview_card|
                                        expected  = preview_card.history.get(at_time - 1.day).accounts.to_f
                                        expected  = 1.0 if expected.zero?
                                        observed  = preview_card.history.get(at_time).accounts.to_f
                                  Severity: Minor
                                  Found in app/models/trends/links.rb - 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

                                  Method safe_for_forwarding? has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    def safe_for_forwarding?(original, compacted)
                                      original.without('@context', 'signature').all? do |key, value|
                                        compacted_value = compacted[key]
                                        return false unless value.instance_of?(compacted_value.class)
                                  
                                  
                                  Severity: Minor
                                  Found in app/helpers/jsonld_helper.rb - 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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language