slack-ruby/slack-ruby-client

View on GitHub
bin/commands/files.rb

Summary

Maintainability
A
2 hrs
Test Coverage

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

        g.command 'upload' do |c|
          c.flag 'channels', desc: 'Comma-separated list of channel names or IDs where the file will be shared.'
          c.flag 'content', desc: 'File contents via a POST variable. If omitting this parameter, you must provide a file.'
          c.flag 'file', desc: 'File contents via multipart/form-data. If omitting this parameter, you must submit content.'
          c.flag 'filename', desc: 'Filename of file.'
Severity: Major
Found in bin/commands/files.rb and 2 other locations - About 1 hr to fix
bin/commands/calls.rb on lines 11..21
bin/commands/conversations.rb on lines 217..227

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

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

        g.command 'list' do |c|
          c.flag 'channel', desc: 'Filter files appearing in a specific channel, indicated by its ID.'
          c.flag 'show_files_hidden_by_limit', desc: 'Show truncated file info for files hidden due to being too old, and the team who owns the file being over the file limit.'
          c.flag 'team_id', desc: 'encoded team id to list files in, required if org token is used.'
          c.flag 'ts_from', desc: 'Filter files created after this timestamp (inclusive).'
Severity: Major
Found in bin/commands/files.rb and 6 other locations - About 1 hr to fix
bin/commands/apps_datastore.rb on lines 44..53
bin/commands/bookmarks.rb on lines 11..20
bin/commands/conversations.rb on lines 74..83
bin/commands/files_remote.rb on lines 69..78
bin/commands/usergroups.rb on lines 59..68
bin/commands/users_admin.rb on lines 11..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 58.

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