glitch-soc/mastodon

View on GitHub

Showing 1,278 of 4,906 total issues

Method deploy has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def deploy
      verify_deploy_options!

      indices = if options[:only]
                  options[:only].map { |str| "#{str.camelize}Index".constantize }
Severity: Minor
Found in lib/mastodon/cli/search.rb - About 2 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 useLinks has a Cognitive Complexity of 16 (exceeds 5 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 2 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 Directory has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

}> = ({ columnId, multiColumn, params }) => {
  const intl = useIntl();
  const dispatch = useAppDispatch();

  const column = useRef<ColumnRef>(null);
Severity: Minor
Found in app/javascript/flavours/glitch/features/directory/index.tsx - About 2 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 SearchResults has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

export const SearchResults: React.FC<{ multiColumn: boolean }> = ({
  multiColumn,
}) => {
  const columnRef = useRef<ColumnRef>(null);
  const intl = useIntl();
Severity: Minor
Found in app/javascript/flavours/glitch/features/search/index.tsx - About 2 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 SearchResults has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

export const SearchResults: React.FC<{ multiColumn: boolean }> = ({
  multiColumn,
}) => {
  const columnRef = useRef<ColumnRef>(null);
  const intl = useIntl();
Severity: Minor
Found in app/javascript/mastodon/features/search/index.tsx - About 2 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 Directory has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

}> = ({ columnId, multiColumn, params }) => {
  const intl = useIntl();
  const dispatch = useAppDispatch();

  const column = useRef<ColumnRef>(null);
Severity: Minor
Found in app/javascript/mastodon/features/directory/index.tsx - About 2 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 render has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render () {
    const { media, lang, sensitive, letterbox, fullwidth, defaultWidth, autoplay } = this.props;
    const { visible } = this.state;
    const size     = media.size;
    const uncached = media.every(attachment => attachment.get('type') === 'unknown');
Severity: Major
Found in app/javascript/flavours/glitch/components/media_gallery.jsx - About 2 hrs to fix

    Function normalizeWheel has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const normalizeWheel = event => {
      // Reasonable defaults
      const PIXEL_STEP = 10;
      const LINE_HEIGHT = 40;
      const PAGE_HEIGHT = 800;

      Function normalizeWheel has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const normalizeWheel = event => {
        // Reasonable defaults
        const PIXEL_STEP = 10;
        const LINE_HEIGHT = 40;
        const PAGE_HEIGHT = 800;
      Severity: Major
      Found in app/javascript/mastodon/features/ui/components/zoomable_image.jsx - About 2 hrs to fix

        Function content has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            const content = media.map((image) => {
              const width  = image.getIn(['meta', 'original', 'width']) || null;
              const height = image.getIn(['meta', 'original', 'height']) || null;
              const description = image.getIn(['translation', 'description']) || image.get('description');
        
        
        Severity: Major
        Found in app/javascript/mastodon/features/ui/components/media_modal.jsx - About 2 hrs to fix

          Method crawl has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def crawl(start = nil)
                stats           = Concurrent::Hash.new
                processed       = Concurrent::AtomicFixnum.new(0)
                failed          = Concurrent::AtomicFixnum.new(0)
                start_at        = Time.now.to_f
          Severity: Major
          Found in lib/mastodon/cli/domains.rb - About 2 hrs to fix

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

            export function register () {
              return (dispatch, getState) => {
                dispatch(setBrowserSupport(supportsPushNotifications));
            
                if (supportsPushNotifications) {

              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/flavours/glitch/reducers/timelines.js - About 2 hrs to fix

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

                    render () {
                      const { index, versions, language, onClose } = this.props;
                      const currentVersion = versions.get(index);
                  
                      const emojiMap = currentVersion.get('emojis').reduce((obj, emoji) => {

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

                        const content = media.map((image) => {
                          const width  = image.getIn(['meta', 'original', 'width']) || null;
                          const height = image.getIn(['meta', 'original', 'height']) || null;
                          const description = image.getIn(['translation', 'description']) || image.get('description');
                    
                    
                    Severity: Major
                    Found in app/javascript/flavours/glitch/features/ui/components/media_modal.jsx - About 2 hrs to fix

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

                      export function register () {
                        return (dispatch, getState) => {
                          dispatch(setBrowserSupport(supportsPushNotifications));
                      
                          if (supportsPushNotifications) {
                      Severity: Major
                      Found in app/javascript/mastodon/actions/push_notifications/registerer.js - About 2 hrs to fix

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

                          render () {
                            const { media, lang, sensitive, defaultWidth, autoplay } = this.props;
                            const { visible } = this.state;
                            const width = this.state.width || defaultWidth;
                        
                        
                        Severity: Major
                        Found in app/javascript/mastodon/components/media_gallery.jsx - About 2 hrs to fix

                          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/flavours/glitch/reducers/status_lists.js - About 2 hrs to fix

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

                              render () {
                                const { index, versions, language, onClose } = this.props;
                                const currentVersion = versions.get(index);
                            
                                const emojiMap = currentVersion.get('emojis').reduce((obj, emoji) => {
                              Severity
                              Category
                              Status
                              Source
                              Language