glitch-soc/mastodon

View on GitHub

Showing 1,287 of 4,903 total issues

Function notificationRequestsReducer has 102 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  createReducer<NotificationRequestsState>(initialState, (builder) => {
    builder
      .addCase(fetchNotificationRequests.fulfilled, (state, action) => {
        state.items = action.payload.requests
          .map(createNotificationRequestFromJSON)
Severity: Major
Found in app/javascript/flavours/glitch/reducers/notification_requests.ts - About 4 hrs to fix

    Function notificationRequestsReducer has 102 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      createReducer<NotificationRequestsState>(initialState, (builder) => {
        builder
          .addCase(fetchNotificationRequests.fulfilled, (state, action) => {
            state.items = action.payload.requests
              .map(createNotificationRequestFromJSON)
    Severity: Major
    Found in app/javascript/mastodon/reducers/notification_requests.ts - About 4 hrs to fix

      File status_action_bar.jsx has 336 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import PropTypes from 'prop-types';
      
      import { defineMessages, injectIntl } from 'react-intl';
      
      import classNames from 'classnames';
      Severity: Minor
      Found in app/javascript/mastodon/components/status_action_bar.jsx - About 4 hrs to fix

        File account.rb has 336 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        class Account < ApplicationRecord
          self.ignored_columns += %w(
            devices_url
            hub_url
            remote_url
        Severity: Minor
        Found in app/models/account.rb - About 4 hrs to fix

          Method call has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
          Open

            def call(uri, suppress_errors: true)
              raise Error, 'No key URI given' if uri.blank?
          
              @json = fetch_resource(uri, false)
          
          
          Severity: Minor
          Found in app/services/activitypub/fetch_remote_key_service.rb - About 3 hrs 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 initialize has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
          Open

            def initialize
              @flavours = {}
          
              Rails.root.glob('app/javascript/flavours/*/theme.yml') do |pathname|
                data = YAML.load_file(pathname)
          Severity: Minor
          Found in app/lib/themes.rb - About 3 hrs 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 EmbeddedStatus has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
          Open

          export const EmbeddedStatus: React.FC<{ statusId: string }> = ({
            statusId,
          }) => {
            const history = useHistory();
            const clickCoordinatesRef = useRef<[number, number] | null>();

          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 FollowButton has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
          Open

          }> = ({ accountId }) => {
            const intl = useIntl();
            const dispatch = useAppDispatch();
            const { signedIn } = useIdentity();
            const account = useAppSelector((state) =>
          Severity: Minor
          Found in app/javascript/flavours/glitch/components/follow_button.tsx - About 3 hrs 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 userLists has 96 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function userLists(state = initialState, action) {
            switch(action.type) {
            case FOLLOWERS_FETCH_SUCCESS:
              return normalizeList(state, ['followers', action.id], action.accounts, action.next);
            case FOLLOWERS_EXPAND_SUCCESS:
          Severity: Major
          Found in app/javascript/flavours/glitch/reducers/user_lists.js - About 3 hrs to fix

            Function userLists has 96 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function userLists(state = initialState, action) {
              switch(action.type) {
              case FOLLOWERS_FETCH_SUCCESS:
                return normalizeList(state, ['followers', action.id], action.accounts, action.next);
              case FOLLOWERS_EXPAND_SUCCESS:
            Severity: Major
            Found in app/javascript/mastodon/reducers/user_lists.js - About 3 hrs to fix

              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 94 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/mastodon/features/about/index.jsx - About 3 hrs to fix

                  Function render has a Cognitive Complexity of 26 (exceeds 5 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: Minor
                  Found in app/javascript/flavours/glitch/features/video/index.jsx - About 3 hrs 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 make has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def make
                        return File.open(@file.path) unless needs_convert?
                  
                        dst = TempfileFactory.new.generate([@basename, @format ? ".#{@format}" : @current_format].join)
                  
                  
                  Severity: Minor
                  Found in lib/paperclip/vips_lazy_thumbnail.rb - About 3 hrs 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 perform has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def perform
                      return if under_load?
                  
                      budget = compute_budget
                  
                  
                  Severity: Minor
                  Found in app/workers/scheduler/accounts_statuses_cleanup_scheduler.rb - About 3 hrs 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

                  File zoomable_image.jsx has 322 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import PropTypes from 'prop-types';
                  import { PureComponent } from 'react';
                  
                  const MIN_SCALE = 1;
                  const MAX_SCALE = 4;

                    File zoomable_image.jsx has 322 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import PropTypes from 'prop-types';
                    import { PureComponent } from 'react';
                    
                    const MIN_SCALE = 1;
                    const MAX_SCALE = 4;
                    Severity: Minor
                    Found in app/javascript/mastodon/features/ui/components/zoomable_image.jsx - About 3 hrs to fix

                      File scrollable_list.jsx has 321 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import PropTypes from 'prop-types';
                      import { Children, cloneElement, PureComponent } from 'react';
                      
                      import classNames from 'classnames';
                      import { useLocation } from 'react-router-dom';
                      Severity: Minor
                      Found in app/javascript/flavours/glitch/components/scrollable_list.jsx - About 3 hrs to fix

                        File scrollable_list.jsx has 321 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import PropTypes from 'prop-types';
                        import { Children, cloneElement, PureComponent } from 'react';
                        
                        import classNames from 'classnames';
                        import { useLocation } from 'react-router-dom';
                        Severity: Minor
                        Found in app/javascript/mastodon/components/scrollable_list.jsx - About 3 hrs to fix

                          Status has 30 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class Status extends ImmutablePureComponent {
                          
                            static contextType = SensitiveMediaContext;
                          
                            static propTypes = {
                          Severity: Minor
                          Found in app/javascript/mastodon/components/status.jsx - About 3 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language