glitch-soc/mastodon

View on GitHub

Showing 4,938 of 4,938 total issues

Method hydrate_reblog_payload has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def hydrate_reblog_payload(empty_payload, account_id)
    empty_payload.tap do |payload|
      payload[:muted]      = false
      payload[:bookmarked] = false
      payload[:pinned]     = false if @status.account_id == account_id
Severity: Minor
Found in app/lib/status_cache_hydrator.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 prune has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def prune
      _, deleted = parallelize_with_progress(prunable_accounts) do |account|
        next if account.bot? || account.group?
        next if account.suspended?
        next if account.silenced?
Severity: Minor
Found in lib/mastodon/cli/accounts.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

Function mergeGaps has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

function mergeGaps(groups: NotificationGroupsState['groups']) {
  for (let i = 0; i < groups.length; i++) {
    const firstGroupOrGap = groups[i];

    if (firstGroupOrGap?.type === 'gap') {
Severity: Minor
Found in app/javascript/flavours/glitch/reducers/notification_groups.ts - 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 make has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def make
      metadata = VideoMetadataExtractor.new(@file.path)

      raise Paperclip::Error, "Error while transcoding #{@file.path}: unsupported file" unless metadata.valid?

Severity: Minor
Found in lib/paperclip/transcoder.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 build has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def build(username = nil)
      if options[:all] || username.nil?
        processed, = parallelize_with_progress(active_user_accounts) do |account|
          PrecomputeFeedService.new.call(account) unless dry_run?
        end
Severity: Minor
Found in lib/mastodon/cli/feeds.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

Function synchronouslySubmitMarkers has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  async (_args, { getState }) => {
    const accessToken = getAccessToken();
    const params = buildPostMarkersParams(getState());

    if (
Severity: Minor
Found in app/javascript/flavours/glitch/actions/markers.ts - 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 NotificationAdminReport has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

}> = ({ notification, notification: { report }, unread }) => {
  const intl = useIntl();
  const targetAccount = useAppSelector((state) =>
    state.accounts.get(report.targetAccountId),
  );

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

      def self_destruct
        if SelfDestructHelper.self_destruct?
          say('Self-destruct mode is already enabled for this Mastodon server', :green)

          pending_accounts = Account.local.without_suspended.count + Account.local.suspended.joins(:deletion_request).count
Severity: Minor
Found in lib/mastodon/cli/federation.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

Function mergeGaps has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

function mergeGaps(groups: NotificationGroupsState['groups']) {
  for (let i = 0; i < groups.length; i++) {
    const firstGroupOrGap = groups[i];

    if (firstGroupOrGap?.type === 'gap') {
Severity: Minor
Found in app/javascript/mastodon/reducers/notification_groups.ts - 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 NotificationAdminReport has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

}> = ({ notification, notification: { report }, unread }) => {
  const intl = useIntl();
  const targetAccount = useAppSelector((state) =>
    state.accounts.get(report.targetAccountId),
  );

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

  async (_args, { getState }) => {
    const accessToken = getAccessToken();
    const params = buildPostMarkersParams(getState());

    if (
Severity: Minor
Found in app/javascript/mastodon/actions/markers.ts - 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 connectStream has 39 lines of code (exceeds 25 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 1 hr to fix

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

      render () {
        const { intl, accountIds, hasMore, isLoading, multiColumn } = this.props;
    
        if (!accountIds) {
          return (
    Severity: Minor
    Found in app/javascript/flavours/glitch/features/reblogs/index.jsx - About 1 hr to fix

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

        render () {
          const { intl, accountIds, hasMore, isLoading, multiColumn } = this.props;
      
          if (!accountIds) {
            return (
      Severity: Minor
      Found in app/javascript/flavours/glitch/features/favourites/index.jsx - About 1 hr to fix

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

          render () {
            const { settings, intl } = this.props;
        
            return (
              <div className='modal-root__modal confirmation-modal'>

          Function connectStream has 39 lines of code (exceeds 25 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/mastodon/stream.js - About 1 hr to fix

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

              render () {
                const { draggingOver } = this.state;
                const { children, isComposing, location, layout } = this.props;
            
                const handlers = {
            Severity: Minor
            Found in app/javascript/mastodon/features/ui/index.jsx - About 1 hr to fix

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

                render () {
                  const { account, hidden, hideTabs } = this.props;
              
                  if (account === null) {
                    return null;

                Method call has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def call(username, domain, json, options = {})
                    return if json['inbox'].blank? || unsupported_uri_scheme?(json['id']) || domain_not_allowed?(domain)
                
                    @options     = options
                    @json        = json
                Severity: Minor
                Found in app/services/activitypub/process_account_service.rb - About 1 hr to fix

                  Function loadingBarMiddleware has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const loadingBarMiddleware = (
                    config: Config = {},
                  ): Middleware<{ skipLoading?: boolean }, RootState> => {
                    const promiseTypeSuffixes = config.promiseTypeSuffixes ?? defaultTypeSuffixes;
                  
                  
                  Severity: Minor
                  Found in app/javascript/flavours/glitch/store/middlewares/loading_bar.ts - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language