Block has too many lines. [325/257] Open
resource :srch do
# Request URL should be /api/srch/all?query=QRY
desc 'Perform a search of all available resources', hidden: false,
is_array: false,
nickname: 'search_all'
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.
File search.rb
has 346 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'grape'
require 'grape-entity'
module Srch
class Search < Grape::API
- Create a ticketCreate a ticket
TODO found Open
# TODO: evaluate if disabling this caching action actually speeds things up?
- Create a ticketCreate a ticket
- Exclude checks
Similar blocks of code found in 4 locations. Consider refactoring. Open
get :nodes do
search_request = SearchRequest.from_request(params)
results = Search.execute(:nodes, params)
if results.present?
- Read upRead up
- Create a ticketCreate a ticket
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 44.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 4 locations. Consider refactoring. Open
get :notes do
search_request = SearchRequest.from_request(params)
results = Search.execute(:notes, params)
if results.present?
- Read upRead up
- Create a ticketCreate a ticket
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 44.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 4 locations. Consider refactoring. Open
get :wikis do
search_request = SearchRequest.from_request(params)
results = Search.execute(:wikis, params)
if results.present?
- Read upRead up
- Create a ticketCreate a ticket
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 44.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 4 locations. Consider refactoring. Open
get :places do
search_request = SearchRequest.from_request(params)
results = Search.execute(:places, params)
if results.present?
- Read upRead up
- Create a ticketCreate a ticket
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 44.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Align the elements of a hash literal if they span more than one line. Open
is_array: false,
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:
- key (left align keys)
- separator (align hash rockets and colons, right align keys)
- table (left align keys, hash rockets, and values)
The treatment of hashes passed as the last argument to a method call can also be configured. The options are:
- always_inspect
- always_ignore
- ignore_implicit (without curly braces)
- ignore_explicit (with curly braces)
Example:
# EnforcedHashRocketStyle: key (default)
# EnforcedColonStyle: key (default)
# good
{
foo: bar,
ba: baz
}
{
:foo => bar,
:ba => baz
}
# bad
{
foo: bar,
ba: baz
}
{
:foo => bar,
:ba => baz
}
Example:
# EnforcedHashRocketStyle: separator
# EnforcedColonStyle: separator
#good
{
foo: bar,
ba: baz
}
{
:foo => bar,
:ba => baz
}
#bad
{
foo: bar,
ba: baz
}
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
Example:
# EnforcedHashRocketStyle: table
# EnforcedColonStyle: table
#good
{
foo: bar,
ba: baz
}
{
:foo => bar,
:ba => baz
}
#bad
{
foo: bar,
ba: baz
}
{
:foo => bar,
:ba => baz
}
Align the elements of a hash literal if they span more than one line. Open
nickname: 'search_content'
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:
- key (left align keys)
- separator (align hash rockets and colons, right align keys)
- table (left align keys, hash rockets, and values)
The treatment of hashes passed as the last argument to a method call can also be configured. The options are:
- always_inspect
- always_ignore
- ignore_implicit (without curly braces)
- ignore_explicit (with curly braces)
Example:
# EnforcedHashRocketStyle: key (default)
# EnforcedColonStyle: key (default)
# good
{
foo: bar,
ba: baz
}
{
:foo => bar,
:ba => baz
}
# bad
{
foo: bar,
ba: baz
}
{
:foo => bar,
:ba => baz
}
Example:
# EnforcedHashRocketStyle: separator
# EnforcedColonStyle: separator
#good
{
foo: bar,
ba: baz
}
{
:foo => bar,
:ba => baz
}
#bad
{
foo: bar,
ba: baz
}
{
:foo => bar,
:ba => baz
}
{
:foo => bar,
:ba => baz
}
Example:
# EnforcedHashRocketStyle: table
# EnforcedColonStyle: table
#good
{
foo: bar,
ba: baz
}
{
:foo => bar,
:ba => baz
}
#bad
{
foo: bar,
ba: baz
}
{
:foo => bar,
:ba => baz
}