glitch-soc/mastodon

View on GitHub

Showing 1,278 of 4,906 total issues

Function HashtagHeader has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

}> = ({ tagId }) => {
  const intl = useIntl();
  const { signedIn, permissions } = useIdentity();
  const dispatch = useAppDispatch();
  const [tag, setTag] = useState<ApiHashtagJSON>();

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

}> = ({ multiColumn }) => {
  const intl = useIntl();
  const dispatch = useAppDispatch();
  const isLoading = useAppSelector((state) => state.suggestions.isLoading);
  const suggestions = useAppSelector((state) => state.suggestions.items);
Severity: Minor
Found in app/javascript/flavours/glitch/features/onboarding/follows.tsx - 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 showAlertForError has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export const showAlertForError = (error: unknown, skipNotFound = false) => {
  if (error instanceof AxiosError && error.response) {
    const { status, statusText, headers } = error.response;
    const { data } = error.response as AxiosResponse<ApiErrorResponse>;

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

}> = ({ content, mentions, language, className }) => {
  const history = useHistory();

  const handleContentRef = useCallback(
    (node: HTMLDivElement | 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 HashtagHeader has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

}> = ({ tagId }) => {
  const intl = useIntl();
  const { signedIn, permissions } = useIdentity();
  const dispatch = useAppDispatch();
  const [tag, setTag] = useState<ApiHashtagJSON>();

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

}> = ({ multiColumn }) => {
  const intl = useIntl();
  const dispatch = useAppDispatch();
  const isLoading = useAppSelector((state) => state.suggestions.isLoading);
  const suggestions = useAppSelector((state) => state.suggestions.items);
Severity: Minor
Found in app/javascript/mastodon/features/onboarding/follows.tsx - 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 NewList has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

}> = ({ multiColumn }) => {
  const dispatch = useAppDispatch();
  const { id } = useParams<{ id?: string }>();
  const intl = useIntl();
  const history = useHistory();
Severity: Minor
Found in app/javascript/mastodon/features/lists/new.tsx - 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 render has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render () {
    const { click } = this.handlers;
    const {
      children,
      className,
Severity: Minor
Found in app/javascript/flavours/glitch/components/link.jsx - About 1 hr to fix

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

      render () {
        const { errorType, multiColumn, stacktrace } = this.props;
    
        let title, body;
    
    

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

        render () {
          const { hasUnread, columnId, multiColumn } = this.props;
          const { id, local } = this.props.params;
          const pinned = !!columnId;
      
      
      Severity: Minor
      Found in app/javascript/flavours/glitch/features/hashtag_timeline/index.jsx - About 1 hr to fix

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

          render () {
            const { intl, hashtags, isLoading, hasMore, multiColumn } = this.props;
        
            const emptyMessage = <FormattedMessage id='empty_column.followed_tags' defaultMessage='You have not followed any hashtags yet. When you do, they will show up here.' />;
        
        
        Severity: Minor
        Found in app/javascript/flavours/glitch/features/followed_tags/index.jsx - About 1 hr to fix

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

            render () {
              const { handleClick } = this;
              const {
                active,
                className,

            Function ContentTypeButton has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const ContentTypeButton = () => {
              const intl = useIntl();
            
              const showButton = useAppSelector((state) => state.getIn(['local_settings', 'show_content_type_choice']));
              const contentType = useAppSelector((state) => state.getIn(['compose', 'content_type']));

              Function makeGetStatus has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const makeGetStatus = () => {
                return createSelector(
                  [
                    (state, { id }) => state.getIn(['statuses', id]),
                    (state, { id }) => state.getIn(['statuses', state.getIn(['statuses', id, 'reblog'])]),
              Severity: Minor
              Found in app/javascript/mastodon/selectors/index.js - About 1 hr to fix

                Function render has 35 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/mastodon/features/reblogs/index.jsx - About 1 hr to fix

                  Function render has 35 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/mastodon/features/favourites/index.jsx - About 1 hr to fix

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

                      render () {
                        const { status, intl, withOpenButton } = this.props;
                    
                        const publicStatus  = ['public', 'unlisted'].includes(status.get('visibility'));
                        const reblogPrivate = status.getIn(['account', 'id']) === me && status.get('visibility') === 'private';

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

                        render () {
                          const { hasUnread, columnId, multiColumn } = this.props;
                          const { id, local } = this.props.params;
                          const pinned = !!columnId;
                      
                      
                      Severity: Minor
                      Found in app/javascript/mastodon/features/hashtag_timeline/index.jsx - About 1 hr to fix

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

                          render () {
                            const { intl, hashtags, isLoading, hasMore, multiColumn } = this.props;
                        
                            const emptyMessage = <FormattedMessage id='empty_column.followed_tags' defaultMessage='You have not followed any hashtags yet. When you do, they will show up here.' />;
                        
                        
                        Severity: Minor
                        Found in app/javascript/mastodon/features/followed_tags/index.jsx - About 1 hr to fix

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

                            render () {
                              const { errorType, multiColumn, stacktrace } = this.props;
                          
                              let title, body;
                          
                          
                            Severity
                            Category
                            Status
                            Source
                            Language