glitch-soc/mastodon

View on GitHub

Showing 4,938 of 4,938 total issues

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

        const Onboarding = () => {
          const account = useAppSelector(state => state.getIn(['accounts', me]));
          const dispatch = useDispatch();
          const intl = useIntl();
        
        
        Severity: Minor
        Found in app/javascript/mastodon/features/onboarding/index.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 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 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

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

                    render () {
                      const {
                        intl,
                        statusId,
                        contextType,

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

                    export const PollForm = () => {
                      const intl = useIntl();
                      const dispatch = useDispatch();
                      const poll = useSelector(state => state.getIn(['compose', 'poll']));
                      const options = poll?.get('options');

                      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/mastodon/components/server_banner.jsx - About 1 hr to fix

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

                        export const PollForm = () => {
                          const intl = useIntl();
                          const dispatch = useDispatch();
                          const poll = useSelector(state => state.getIn(['compose', 'poll']));
                          const options = poll?.get('options');
                        Severity: Minor
                        Found in app/javascript/mastodon/features/compose/components/poll_form.jsx - About 1 hr to fix

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

                            render () {
                              const {
                                intl,
                                statusId,
                                contextType,
                          Severity: Minor
                          Found in app/javascript/mastodon/features/ui/components/filter_modal.jsx - About 1 hr to fix

                            Method paginate_groups has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def paginate_groups(limit, pagination_order, grouped_types: nil)
                                  raise ArgumentError unless %i(asc desc).include?(pagination_order)
                            
                                  query = reorder(id: pagination_order)
                            
                            
                            Severity: Minor
                            Found in app/models/notification.rb - About 1 hr to fix

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

                              export const FilteredNotificationsBanner: React.FC = () => {
                                const dispatch = useAppDispatch();
                                const policy = useAppSelector((state) => state.notificationPolicy);
                                const minimizeSetting = useAppSelector(
                                  selectSettingsNotificationsMinimizeFilteredBanner,

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

                                export const FilteredNotificationsBanner: React.FC = () => {
                                  const dispatch = useAppDispatch();
                                  const policy = useAppSelector((state) => state.notificationPolicy);
                                  const minimizeSetting = useAppSelector(
                                    selectSettingsNotificationsMinimizeFilteredBanner,

                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                    handleHotkeyBack = () => {
                                      const { history } = this.props;
                                  
                                      if (history.location?.state?.fromMastodon) {
                                        history.goBack();
                                  Severity: Major
                                  Found in app/javascript/flavours/glitch/features/ui/index.jsx and 1 other location - About 1 hr to fix
                                  app/javascript/mastodon/features/ui/index.jsx on lines 485..493

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 71.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                  export const expandCommunityTimeline       = ({ maxId, onlyMedia } = {}) => expandTimeline(`community${onlyMedia ? ':media' : ''}`, '/api/v1/timelines/public', { local: true, max_id: maxId, only_media: !!onlyMedia });
                                  Severity: Major
                                  Found in app/javascript/mastodon/actions/timelines.js and 1 other location - About 1 hr to fix
                                  app/javascript/flavours/glitch/actions/timelines.js on lines 161..161

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 71.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                    handleLoadedData = () => {
                                      const { autoPlay, currentTime } = this.props;
                                  
                                      if (currentTime) {
                                        this.audio.currentTime = currentTime;
                                  Severity: Major
                                  Found in app/javascript/flavours/glitch/features/audio/index.jsx and 1 other location - About 1 hr to fix
                                  app/javascript/mastodon/features/audio/index.jsx on lines 331..341

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 71.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                  const mapStateToProps = state => ({
                                    disabled: state.getIn(['compose', 'is_uploading']) || (state.getIn(['compose', 'media_attachments']).size > 0),
                                    active: state.getIn(['compose', 'poll']) !== null,
                                  });
                                  app/javascript/flavours/glitch/features/compose/containers/poll_button_container.js on lines 6..9

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 71.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language