glitch-soc/mastodon

View on GitHub

Showing 4,938 of 4,938 total issues

Function _calculateOptions has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _calculateOptions (value) {
    const { signedIn } = this.props.identity;
    const trimmedValue = value.trim();
    const options = [];

Severity: Minor
Found in app/javascript/mastodon/features/compose/components/search.jsx - About 1 hr to fix

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

      render () {
        const { announcement } = this.props;
        const { unread } = this.state;
        const startsAt = announcement.get('starts_at') && new Date(announcement.get('starts_at'));
        const endsAt = announcement.get('ends_at') && new Date(announcement.get('ends_at'));

      Function ColumnSettings has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const ColumnSettings = () => {
        const dispatch = useDispatch();
        const settings = useSelector((state) => state.settings.get('notifications'));
      
        const onChange = useCallback(
      Severity: Minor
      Found in app/javascript/mastodon/features/notifications/requests.jsx - About 1 hr to fix

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

          render () {
            const { account, submitted } = this.props;
        
            return (
              <>
        Severity: Minor
        Found in app/javascript/mastodon/features/report/thanks.jsx - About 1 hr to fix

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

            render () {
              const { intl, hidden, account, onAuthorize, onReject } = this.props;
          
              if (!account) {
                return <div />;

            Method create has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def create
                authorize @report, :show?
            
                case action_from_button
                when 'delete', 'mark_as_sensitive'
            Severity: Minor
            Found in app/controllers/admin/reports/actions_controller.rb - About 1 hr to fix

              Method failures has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def failures
                  @bulk_import = current_account.bulk_imports.state_finished.find(params[:id])
              
                  respond_to do |format|
                    format.csv do
              Severity: Minor
              Found in app/controllers/settings/imports_controller.rb - About 1 hr to fix

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

                  def call(body, actor, **options)
                    @account = actor
                    @json    = original_json = Oj.load(body, mode: :strict)
                    @options = options
                
                
                Severity: Minor
                Found in app/services/activitypub/process_collection_service.rb - About 1 hr to fix

                  Method perform has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def perform
                      return if under_load?
                  
                      budget = compute_budget
                  
                  
                  Severity: Minor
                  Found in app/workers/scheduler/accounts_statuses_cleanup_scheduler.rb - About 1 hr to fix

                    Method refresh has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def refresh
                          if options[:status]
                            scope = MediaAttachment.where(status_id: options[:status])
                          elsif options[:account]
                            username, domain = options[:account].split('@')
                    Severity: Minor
                    Found in lib/mastodon/cli/media.rb - About 1 hr to fix

                      Function markersReducer has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const markersReducer = createReducer(initialState, (builder) => {
                        builder.addCase(
                          submitMarkersAction.fulfilled,
                          (state, { payload: { home, notifications } }) => {
                            if (home) state.home = home;
                      Severity: Minor
                      Found in app/javascript/flavours/glitch/reducers/markers.ts - About 1 hr to fix

                        Function markersReducer has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const markersReducer = createReducer(initialState, (builder) => {
                          builder.addCase(
                            submitMarkersAction.fulfilled,
                            (state, { payload: { home, notifications } }) => {
                              if (home) state.home = home;
                        Severity: Minor
                        Found in app/javascript/mastodon/reducers/markers.ts - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                            if (normalOldStatus && normalOldStatus.get('content') === normalStatus.content && normalOldStatus.get('spoiler_text') === normalStatus.spoiler_text) {
                              normalStatus.search_index = normalOldStatus.get('search_index');
                              normalStatus.contentHtml = normalOldStatus.get('contentHtml');
                              normalStatus.spoilerHtml = normalOldStatus.get('spoilerHtml');
                              normalStatus.hidden = normalOldStatus.get('hidden');
                          Severity: Major
                          Found in app/javascript/flavours/glitch/actions/importer/normalizer.js - About 1 hr to fix

                            Consider simplifying this complex logical expression.
                            Open

                                } else if (isLoading || childrenCount > 0 || numPending > 0 || hasMore || !emptyMessage) {
                                  scrollableArea = (
                                    <div className={classNames('scrollable', { fullscreen })} ref={this.setRef} onMouseMove={this.handleMouseMove}>
                                      <div role='feed' className='item-list'>
                                        {prepend}
                            Severity: Major
                            Found in app/javascript/mastodon/components/scrollable_list.jsx - About 1 hr to fix

                              Consider simplifying this complex logical expression.
                              Open

                                  if (multiColumn) {
                                    const { columns } = this.props;
                              
                                    return (
                                      <div className='drawer' role='region' aria-label={intl.formatMessage(messages.compose)}>
                              Severity: Major
                              Found in app/javascript/mastodon/features/compose/index.jsx - About 1 hr to fix

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

                                    const custom = [
                                      {
                                        id: 'mastodon',
                                        name: 'mastodon',
                                        short_names: ['mastodon'],
                                app/javascript/mastodon/features/emoji/__tests__/emoji_index-test.js on lines 80..91
                                app/javascript/mastodon/features/emoji/__tests__/emoji_index-test.js on lines 100..111

                                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 55.

                                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 3 locations. Consider refactoring.
                                Open

                                    const custom = [
                                      {
                                        id: 'mastodon',
                                        name: 'mastodon',
                                        short_names: ['mastodon'],
                                app/javascript/mastodon/features/emoji/__tests__/emoji_index-test.js on lines 54..65
                                app/javascript/mastodon/features/emoji/__tests__/emoji_index-test.js on lines 80..91

                                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 55.

                                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 3 locations. Consider refactoring.
                                Open

                                    const custom = [
                                      {
                                        id: 'mastodon',
                                        name: 'mastodon',
                                        short_names: ['mastodon'],
                                app/javascript/mastodon/features/emoji/__tests__/emoji_index-test.js on lines 54..65
                                app/javascript/mastodon/features/emoji/__tests__/emoji_index-test.js on lines 100..111

                                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 55.

                                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

                                Similar blocks of code found in 7 locations. Consider refactoring.
                                Open

                                export function changeLocalSetting(key, value) {
                                  return dispatch => {
                                    dispatch({
                                      type: LOCAL_SETTING_CHANGE,
                                      key,
                                Severity: Major
                                Found in app/javascript/flavours/glitch/actions/local_settings.js and 6 other locations - About 1 hr to fix
                                app/javascript/flavours/glitch/actions/columns.js on lines 8..18
                                app/javascript/flavours/glitch/actions/columns.js on lines 31..41
                                app/javascript/flavours/glitch/actions/settings.js on lines 10..20
                                app/javascript/mastodon/actions/columns.js on lines 8..18
                                app/javascript/mastodon/actions/columns.js on lines 31..41
                                app/javascript/mastodon/actions/settings.js on lines 10..20

                                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 55.

                                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

                                Similar blocks of code found in 7 locations. Consider refactoring.
                                Open

                                export function addColumn(id, params) {
                                  return dispatch => {
                                    dispatch({
                                      type: COLUMN_ADD,
                                      id,
                                Severity: Major
                                Found in app/javascript/mastodon/actions/columns.js and 6 other locations - About 1 hr to fix
                                app/javascript/flavours/glitch/actions/columns.js on lines 8..18
                                app/javascript/flavours/glitch/actions/columns.js on lines 31..41
                                app/javascript/flavours/glitch/actions/local_settings.js on lines 49..59
                                app/javascript/flavours/glitch/actions/settings.js on lines 10..20
                                app/javascript/mastodon/actions/columns.js on lines 31..41
                                app/javascript/mastodon/actions/settings.js on lines 10..20

                                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 55.

                                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