slack-ruby/slack-ruby-client

View on GitHub
lib/slack/web/api/endpoints/conversations.rb

Summary

Maintainability
C
1 day
Test Coverage

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

          def conversations_members(options = {})
            raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
            options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
            if block_given?
              Pagination::Cursor.new(self, :conversations_members, options).each do |page|
Severity: Minor
Found in lib/slack/web/api/endpoints/conversations.rb and 1 other location - About 50 mins to fix
lib/slack/web/api/endpoints/conversations.rb on lines 120..128

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

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

          def conversations_history(options = {})
            raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
            options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
            if block_given?
              Pagination::Cursor.new(self, :conversations_history, options).each do |page|
Severity: Minor
Found in lib/slack/web/api/endpoints/conversations.rb and 1 other location - About 50 mins to fix
lib/slack/web/api/endpoints/conversations.rb on lines 300..308

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

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

          def conversations_rename(options = {})
            raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
            raise ArgumentError, 'Required arguments :name missing' if options[:name].nil?
            options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
            post('conversations.rename', options)
Severity: Major
Found in lib/slack/web/api/endpoints/conversations.rb and 8 other locations - About 40 mins to fix
lib/slack/web/api/endpoints/chat.rb on lines 38..42
lib/slack/web/api/endpoints/chat.rb on lines 56..60
lib/slack/web/api/endpoints/chat.rb on lines 72..76
lib/slack/web/api/endpoints/conversations.rb on lines 160..164
lib/slack/web/api/endpoints/conversations.rb on lines 282..286
lib/slack/web/api/endpoints/conversations.rb on lines 389..393
lib/slack/web/api/endpoints/conversations.rb on lines 405..409
lib/slack/web/api/endpoints/reminders.rb on lines 24..28

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

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

          def conversations_setTopic(options = {})
            raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
            raise ArgumentError, 'Required arguments :topic missing' if options[:topic].nil?
            options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
            post('conversations.setTopic', options)
Severity: Major
Found in lib/slack/web/api/endpoints/conversations.rb and 8 other locations - About 40 mins to fix
lib/slack/web/api/endpoints/chat.rb on lines 38..42
lib/slack/web/api/endpoints/chat.rb on lines 56..60
lib/slack/web/api/endpoints/chat.rb on lines 72..76
lib/slack/web/api/endpoints/conversations.rb on lines 160..164
lib/slack/web/api/endpoints/conversations.rb on lines 282..286
lib/slack/web/api/endpoints/conversations.rb on lines 339..343
lib/slack/web/api/endpoints/conversations.rb on lines 389..393
lib/slack/web/api/endpoints/reminders.rb on lines 24..28

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

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

          def conversations_invite(options = {})
            raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
            raise ArgumentError, 'Required arguments :users missing' if options[:users].nil?
            options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
            post('conversations.invite', options)
Severity: Major
Found in lib/slack/web/api/endpoints/conversations.rb and 8 other locations - About 40 mins to fix
lib/slack/web/api/endpoints/chat.rb on lines 38..42
lib/slack/web/api/endpoints/chat.rb on lines 56..60
lib/slack/web/api/endpoints/chat.rb on lines 72..76
lib/slack/web/api/endpoints/conversations.rb on lines 282..286
lib/slack/web/api/endpoints/conversations.rb on lines 339..343
lib/slack/web/api/endpoints/conversations.rb on lines 389..393
lib/slack/web/api/endpoints/conversations.rb on lines 405..409
lib/slack/web/api/endpoints/reminders.rb on lines 24..28

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

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

          def conversations_setPurpose(options = {})
            raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
            raise ArgumentError, 'Required arguments :purpose missing' if options[:purpose].nil?
            options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
            post('conversations.setPurpose', options)
Severity: Major
Found in lib/slack/web/api/endpoints/conversations.rb and 8 other locations - About 40 mins to fix
lib/slack/web/api/endpoints/chat.rb on lines 38..42
lib/slack/web/api/endpoints/chat.rb on lines 56..60
lib/slack/web/api/endpoints/chat.rb on lines 72..76
lib/slack/web/api/endpoints/conversations.rb on lines 160..164
lib/slack/web/api/endpoints/conversations.rb on lines 282..286
lib/slack/web/api/endpoints/conversations.rb on lines 339..343
lib/slack/web/api/endpoints/conversations.rb on lines 405..409
lib/slack/web/api/endpoints/reminders.rb on lines 24..28

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

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

          def conversations_mark(options = {})
            raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
            raise ArgumentError, 'Required arguments :ts missing' if options[:ts].nil?
            options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
            post('conversations.mark', options)
Severity: Major
Found in lib/slack/web/api/endpoints/conversations.rb and 8 other locations - About 40 mins to fix
lib/slack/web/api/endpoints/chat.rb on lines 38..42
lib/slack/web/api/endpoints/chat.rb on lines 56..60
lib/slack/web/api/endpoints/chat.rb on lines 72..76
lib/slack/web/api/endpoints/conversations.rb on lines 160..164
lib/slack/web/api/endpoints/conversations.rb on lines 339..343
lib/slack/web/api/endpoints/conversations.rb on lines 389..393
lib/slack/web/api/endpoints/conversations.rb on lines 405..409
lib/slack/web/api/endpoints/reminders.rb on lines 24..28

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

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

          def conversations_unarchive(options = {})
            raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
            options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
            post('conversations.unarchive', options)
Severity: Major
Found in lib/slack/web/api/endpoints/conversations.rb and 11 other locations - About 25 mins to fix
lib/slack/web/api/endpoints/conversations.rb on lines 52..55
lib/slack/web/api/endpoints/conversations.rb on lines 65..68
lib/slack/web/api/endpoints/conversations.rb on lines 143..146
lib/slack/web/api/endpoints/conversations.rb on lines 180..183
lib/slack/web/api/endpoints/conversations.rb on lines 193..196
lib/slack/web/api/endpoints/conversations.rb on lines 223..226
lib/slack/web/api/endpoints/pins.rb on lines 18..21
lib/slack/web/api/endpoints/pins.rb on lines 31..34
lib/slack/web/api/endpoints/pins.rb on lines 46..49
lib/slack/web/api/endpoints/reactions.rb on lines 89..92
lib/slack/web/api/endpoints/users.rb on lines 76..79

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

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

          def conversations_inviteShared(options = {})
            raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
            options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
            post('conversations.inviteShared', options)
Severity: Major
Found in lib/slack/web/api/endpoints/conversations.rb and 11 other locations - About 25 mins to fix
lib/slack/web/api/endpoints/conversations.rb on lines 52..55
lib/slack/web/api/endpoints/conversations.rb on lines 65..68
lib/slack/web/api/endpoints/conversations.rb on lines 143..146
lib/slack/web/api/endpoints/conversations.rb on lines 193..196
lib/slack/web/api/endpoints/conversations.rb on lines 223..226
lib/slack/web/api/endpoints/conversations.rb on lines 419..422
lib/slack/web/api/endpoints/pins.rb on lines 18..21
lib/slack/web/api/endpoints/pins.rb on lines 31..34
lib/slack/web/api/endpoints/pins.rb on lines 46..49
lib/slack/web/api/endpoints/reactions.rb on lines 89..92
lib/slack/web/api/endpoints/users.rb on lines 76..79

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

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

          def conversations_info(options = {})
            raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
            options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
            post('conversations.info', options)
Severity: Major
Found in lib/slack/web/api/endpoints/conversations.rb and 11 other locations - About 25 mins to fix
lib/slack/web/api/endpoints/conversations.rb on lines 52..55
lib/slack/web/api/endpoints/conversations.rb on lines 65..68
lib/slack/web/api/endpoints/conversations.rb on lines 180..183
lib/slack/web/api/endpoints/conversations.rb on lines 193..196
lib/slack/web/api/endpoints/conversations.rb on lines 223..226
lib/slack/web/api/endpoints/conversations.rb on lines 419..422
lib/slack/web/api/endpoints/pins.rb on lines 18..21
lib/slack/web/api/endpoints/pins.rb on lines 31..34
lib/slack/web/api/endpoints/pins.rb on lines 46..49
lib/slack/web/api/endpoints/reactions.rb on lines 89..92
lib/slack/web/api/endpoints/users.rb on lines 76..79

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

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

          def conversations_close(options = {})
            raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
            options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
            post('conversations.close', options)
Severity: Major
Found in lib/slack/web/api/endpoints/conversations.rb and 11 other locations - About 25 mins to fix
lib/slack/web/api/endpoints/conversations.rb on lines 52..55
lib/slack/web/api/endpoints/conversations.rb on lines 143..146
lib/slack/web/api/endpoints/conversations.rb on lines 180..183
lib/slack/web/api/endpoints/conversations.rb on lines 193..196
lib/slack/web/api/endpoints/conversations.rb on lines 223..226
lib/slack/web/api/endpoints/conversations.rb on lines 419..422
lib/slack/web/api/endpoints/pins.rb on lines 18..21
lib/slack/web/api/endpoints/pins.rb on lines 31..34
lib/slack/web/api/endpoints/pins.rb on lines 46..49
lib/slack/web/api/endpoints/reactions.rb on lines 89..92
lib/slack/web/api/endpoints/users.rb on lines 76..79

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

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

          def conversations_leave(options = {})
            raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
            options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
            post('conversations.leave', options)
Severity: Major
Found in lib/slack/web/api/endpoints/conversations.rb and 11 other locations - About 25 mins to fix
lib/slack/web/api/endpoints/conversations.rb on lines 52..55
lib/slack/web/api/endpoints/conversations.rb on lines 65..68
lib/slack/web/api/endpoints/conversations.rb on lines 143..146
lib/slack/web/api/endpoints/conversations.rb on lines 180..183
lib/slack/web/api/endpoints/conversations.rb on lines 193..196
lib/slack/web/api/endpoints/conversations.rb on lines 419..422
lib/slack/web/api/endpoints/pins.rb on lines 18..21
lib/slack/web/api/endpoints/pins.rb on lines 31..34
lib/slack/web/api/endpoints/pins.rb on lines 46..49
lib/slack/web/api/endpoints/reactions.rb on lines 89..92
lib/slack/web/api/endpoints/users.rb on lines 76..79

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

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

          def conversations_archive(options = {})
            raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
            options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
            post('conversations.archive', options)
Severity: Major
Found in lib/slack/web/api/endpoints/conversations.rb and 11 other locations - About 25 mins to fix
lib/slack/web/api/endpoints/conversations.rb on lines 65..68
lib/slack/web/api/endpoints/conversations.rb on lines 143..146
lib/slack/web/api/endpoints/conversations.rb on lines 180..183
lib/slack/web/api/endpoints/conversations.rb on lines 193..196
lib/slack/web/api/endpoints/conversations.rb on lines 223..226
lib/slack/web/api/endpoints/conversations.rb on lines 419..422
lib/slack/web/api/endpoints/pins.rb on lines 18..21
lib/slack/web/api/endpoints/pins.rb on lines 31..34
lib/slack/web/api/endpoints/pins.rb on lines 46..49
lib/slack/web/api/endpoints/reactions.rb on lines 89..92
lib/slack/web/api/endpoints/users.rb on lines 76..79

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

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

          def conversations_join(options = {})
            raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
            options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
            post('conversations.join', options)
Severity: Major
Found in lib/slack/web/api/endpoints/conversations.rb and 11 other locations - About 25 mins to fix
lib/slack/web/api/endpoints/conversations.rb on lines 52..55
lib/slack/web/api/endpoints/conversations.rb on lines 65..68
lib/slack/web/api/endpoints/conversations.rb on lines 143..146
lib/slack/web/api/endpoints/conversations.rb on lines 180..183
lib/slack/web/api/endpoints/conversations.rb on lines 223..226
lib/slack/web/api/endpoints/conversations.rb on lines 419..422
lib/slack/web/api/endpoints/pins.rb on lines 18..21
lib/slack/web/api/endpoints/pins.rb on lines 31..34
lib/slack/web/api/endpoints/pins.rb on lines 46..49
lib/slack/web/api/endpoints/reactions.rb on lines 89..92
lib/slack/web/api/endpoints/users.rb on lines 76..79

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

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

There are no issues that match your filters.

Category
Status