glitch-soc/mastodon

View on GitHub

Showing 1,278 of 4,906 total issues

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

  def process_attachments
    return [] if @object['attachment'].nil?

    media_attachments = []

Severity: Minor
Found in app/lib/activitypub/activity/create.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 cc has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def cc(status)
    cc = []

    cc << uri_for(status.reblog.account) if status.reblog?

Severity: Minor
Found in app/lib/activitypub/tag_manager.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 pluck_each has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def pluck_each(*column_names)
      relation = self

      options = column_names.extract_options!

Severity: Minor
Found in lib/active_record/batches.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 add has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def add(*addresses)
      fail_with_message 'No IP(s) given' if addresses.empty?

      skipped   = 0
      processed = 0
Severity: Minor
Found in lib/mastodon/cli/ip_blocks.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 Dropdown has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

const Dropdown: React.FC<DropdownProps> = ({
  value,
  options,
  disabled,
  onChange,

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

const Dropdown: React.FC<DropdownProps> = ({
  value,
  options,
  disabled,
  onChange,

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 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render () {
    const { attachments, isLoading, hasMore, isAccount, multiColumn, suspended } = this.props;
    const { width } = this.state;

    if (!isAccount) {
Severity: Minor
Found in app/javascript/flavours/glitch/features/account_gallery/index.jsx - About 1 hr to fix

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

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

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

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

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

          render () {
            const { label, limit } = this.props;
            const { loading, data } = this.state;
        
            let content;
        Severity: Minor
        Found in app/javascript/flavours/glitch/components/admin/Dimension.jsx - About 1 hr to fix

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

            render () {
              const { components } = this.props;
          
              let handleOpenVideo;
          
          
          Severity: Minor
          Found in app/javascript/flavours/glitch/containers/media_container.jsx - About 1 hr to fix

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

              render () {
                const { label, limit } = this.props;
                const { loading, data } = this.state;
            
                let content;
            Severity: Minor
            Found in app/javascript/mastodon/components/admin/Dimension.jsx - About 1 hr to fix

              Function uploadCompose has 46 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/mastodon/actions/compose.js - About 1 hr to fix

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

                  render () {
                    const { components } = this.props;
                
                    let handleOpenVideo;
                
                
                Severity: Minor
                Found in app/javascript/mastodon/containers/media_container.jsx - About 1 hr to fix

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

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

                    Function useLinks has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const useLinks = () => {
                      const history = useHistory();
                      const dispatch = useAppDispatch();
                    
                      const handleHashtagClick = useCallback(
                    Severity: Minor
                    Found in app/javascript/hooks/useLinks.ts - About 1 hr to fix

                      Function handleKeyDown has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          (e: React.KeyboardEvent<HTMLLIElement>) => {
                            const value = e.currentTarget.getAttribute('data-index');
                            const index = items.findIndex((item) => item.value === value);
                      
                            let element: Element | null | undefined = null;
                      Severity: Minor
                      Found in app/javascript/flavours/glitch/components/dropdown_selector.tsx - About 1 hr to fix

                        Function useLinks has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const useLinks = () => {
                          const history = useHistory();
                          const dispatch = useAppDispatch();
                        
                          const handleHashtagClick = useCallback(
                        Severity: Minor
                        Found in app/javascript/flavours/glitch/hooks/useLinks.ts - About 1 hr to fix

                          Function handleKeyDown has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              (e: React.KeyboardEvent<HTMLLIElement>) => {
                                const value = e.currentTarget.getAttribute('data-index');
                                const index = items.findIndex((item) => item.value === value);
                          
                                let element: Element | null | undefined = null;
                          Severity: Minor
                          Found in app/javascript/mastodon/components/dropdown_selector.tsx - About 1 hr to fix

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

                              render () {
                                const { server, intl } = this.props;
                                const isLoading = server.get('isLoading');
                            
                                return (
                            Severity: Minor
                            Found in app/javascript/flavours/glitch/components/server_banner.jsx - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language