Class has too many lines. [478/100] Open
class ApidocsController < Apicasso::ApplicationController
skip_before_action :restrict_access
include Swagger::Blocks
# Default application settings for documentation generation.
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Block has too many lines. [369/25] Open
ActiveRecord::Base.descendants.each do |model|
next if MODELS_EXCLUDED.include?(model.name) || model.abstract_class
# Resource definitions of GET, OPTIONS, POST
swagger_path "/#{model.name.underscore}" do
- 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.
Complex method Apicasso::ApidocsController::operation(get)::response#200 (237.7) Open
response 200 do
key :description, I18n.t("activerecord.models.#{inner_name.underscore}.index.response",
default: "#{inner_name} response, which include records matching current query and pagination metadata")
schema do
key :name, :total
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method Apicasso::ApidocsController::operation#get (202.9) Open
operation :get do
key :summary, I18n.t("activerecord.models.#{inner_name.underscore}.index.summary", default: inner_name)
key :description, I18n.t("activerecord.models.#{inner_name.underscore}.index.description", default: inner_name)
key :operationId, "find#{inner_name.pluralize}"
key :produces, ['application/json']
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Block has too many lines. [142/25] Open
model.reflect_on_all_associations.each do |association|
begin
inner_name = association.class_name.to_s.classify
rescue NoMethodError, ActionController::RoutingError
inner_name = association.name.to_s.classify
- 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.
Block has too many lines. [141/25] Open
swagger_path "/#{model.name.underscore}" do
operation :get do
key :summary, I18n.t("activerecord.models.#{model.name.underscore}.index.summary", default: model.name)
key :description, I18n.t("activerecord.models.#{model.name.underscore}.index.description", default: model.name)
key :operationId, "find#{model.name.pluralize}"
- 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.
Block has too many lines. [131/25] Open
swagger_path "/#{model.name.underscore}/{id}/#{association.name}" do
operation :get do
key :summary, I18n.t("activerecord.models.#{inner_name.underscore}.index.summary", default: inner_name)
key :description, I18n.t("activerecord.models.#{inner_name.underscore}.index.description", default: inner_name)
key :operationId, "find#{inner_name.pluralize}"
- 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 apidocs_controller.rb
has 482 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Apicasso
# Controller used to generate an application Swagger JSON, used by
# SwaggerUI to generate beautiful API documentation
class ApidocsController < Apicasso::ApplicationController
skip_before_action :restrict_access
- Create a ticketCreate a ticket
Block has too many lines. [108/25] Open
operation :get do
key :summary, I18n.t("activerecord.models.#{inner_name.underscore}.index.summary", default: inner_name)
key :description, I18n.t("activerecord.models.#{inner_name.underscore}.index.description", default: inner_name)
key :operationId, "find#{inner_name.pluralize}"
key :produces, ['application/json']
- 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.
Block has too many lines. [101/25] Open
operation :get do
key :summary, I18n.t("activerecord.models.#{model.name.underscore}.index.summary", default: model.name)
key :description, I18n.t("activerecord.models.#{model.name.underscore}.index.description", default: model.name)
key :operationId, "find#{model.name.pluralize}"
key :produces, ['application/json']
- 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.
Complex method Apicasso::ApidocsController::operation#patch (75.7) Open
operation :patch do
key :description, I18n.t("activerecord.models.#{model.name.underscore}.update.response",
default: "Updates a #{model.name}")
key :operationId, "edit#{model.name}"
key :produces, ['application/json']
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Block has too many lines. [79/25] Open
swagger_path "/#{model.name.underscore}/{id}" do
operation :patch do
key :description, I18n.t("activerecord.models.#{model.name.underscore}.update.response",
default: "Updates a #{model.name}")
key :operationId, "edit#{model.name}"
- 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.
Block has too many lines. [61/25] Open
response 200 do
key :description, I18n.t("activerecord.models.#{model.name.underscore}.index.response",
default: "#{model.name} response, which include records matching current query and pagination metadata")
schema do
key :name, :total
- 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.
Block has too many lines. [61/25] Open
response 200 do
key :description, I18n.t("activerecord.models.#{inner_name.underscore}.index.response",
default: "#{inner_name} response, which include records matching current query and pagination metadata")
schema do
key :name, :total
- 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.
Complex method Apicasso::ApidocsController::operation#post (51.1) Open
operation :post do
key :description, I18n.t("activerecord.models.#{model.name.underscore}.create.response",
default: "Creates a #{model.name}")
key :operationId, "add#{model.name}"
key :produces, ['application/json']
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method Apicasso::ApidocsController::operation#delete (44.8) Open
operation :delete do
key :description, I18n.t("activerecord.models.#{model.name.underscore}.destroy.response",
default: "Deletes a #{model.name}")
key :operationId, "destroy#{model.name}"
key :produces, ['application/json']
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method Apicasso::ApidocsController::operation#options (38.4) Open
operation :options do
key :description, I18n.t("activerecord.models.#{inner_name.underscore}.schema.description",
default: "#{inner_name} metadata information.")
key :operationId, "schema#{inner_name.pluralize}"
key :produces, ['application/json']
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Block has too many lines. [40/25] Open
swagger_root do
MODELS_EXCLUDED = [
'ApplicationRecord',
'ActiveRecord::SchemaMigration',
'Apicasso::ApplicationRecord',
- 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.
Block has too many lines. [39/25] Open
SWAGGERED_CLASSES.each do |klass|
next if MODELS_EXCLUDED.include?(klass.name) || klass.abstract_class
swagger_schema klass.name.to_sym do
key :required, klass.presence_validators if klass.presence_validators?
- 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.
Complex method Apicasso::ApidocsController::operation(options)::response#200 (33.0) Open
response 200 do
key :description, I18n.t("activerecord.models.#{inner_name.underscore}.schema.response",
default: "#{inner_name} metadata as a json with field names as keys and field types as values.")
schema do
key :'$ref', "#{inner_name}".to_sym
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Block has too many lines. [32/25] Open
operation :patch do
key :description, I18n.t("activerecord.models.#{model.name.underscore}.update.response",
default: "Updates a #{model.name}")
key :operationId, "edit#{model.name}"
key :produces, ['application/json']
- 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.
Similar blocks of code found in 2 locations. Consider refactoring. Open
parameter do
key :name, model.name.underscore.to_sym
key :in, :body
key :description, I18n.t("activerecord.models.#{model.name.underscore}.create.description",
default: "#{model.name} to add into application")
- 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 41.
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 2 locations. Consider refactoring. Open
parameter do
key :name, model.name.underscore.to_sym
key :in, :body
key :description, I18n.t("activerecord.models.#{model.name.underscore}.update.description",
default: "Existing #{model.name} to update on the application")
- 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 41.
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 3 locations. Consider refactoring. Open
parameter do
key :name, :id
key :in, :path
key :description, I18n.t("activerecord.models.attributes.#{model.name.underscore}.id",
default: "ID of #{model.name} to delete on the application")
- 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 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
- 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 3 locations. Consider refactoring. Open
parameter do
key :name, :id
key :in, :path
key :description, I18n.t("activerecord.models.attributes.#{model.name.underscore}.id",
default: "ID of #{model.name} to update on the application")
- 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 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
- 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 3 locations. Consider refactoring. Open
parameter do
key :name, :id
key :in, :path
key :description, I18n.t("activerecord.models.attributes.#{model.name.underscore}.id",
default: "ID of #{model.name} to fetch on the application")
- 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 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
- 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 3 locations. Consider refactoring. Open
response 200 do
key :description, I18n.t("activerecord.models.#{model.name.underscore}.show.description",
default: "#{model.name} response")
schema do
key :'$ref', model.name.to_sym
- 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 28.
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 3 locations. Consider refactoring. Open
response 200 do
key :description, I18n.t("activerecord.models.#{model.name.underscore}.show.description",
default: "#{model.name} response")
schema do
key :'$ref', model.name.to_sym
- 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 28.
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 3 locations. Consider refactoring. Open
response 201 do
key :description, I18n.t("activerecord.models.#{model.name.underscore}.show.description",
default: "#{model.name} response")
schema do
key :'$ref', model.name.to_sym
- 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 28.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
parameter do
key :name, :sort
key :in, :query
key :description, I18n.t('apicasso.sort.description',
default: 'Parameters sorting splitted by `,` preffixed by `+` or `-` which translates into ascending or descending order')
- 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 26.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
parameter do
key :name, :sort
key :in, :query
key :description, I18n.t('apicasso.sort.description',
default: 'Parameters sorting splitted by `,` preffixed by `+` or `-` which translates into ascending or descending order')
- 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 26.
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 parameters of a method call if they span more than one line. Open
default: "ID of #{model.name} to delete on the application")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: 'Total records contained in current collection, as if there was no pagination.')
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: "The link of the previous page for the current collection. It can be null if there isn't any")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Line is too long. [263/80] Open
default: 'Records filtering by attribute and search query as affix. Usage: `?q[{attribute}{search_affix}]={matcher}`. All available search affixes are listed on: https://github.com/activerecord-hackery/ransack#search-matchers')
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [96/80] Open
default: "ID of #{model.name} to update on the application")
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [101/80] Open
key :description, I18n.t("activerecord.models.#{model.name.underscore}.show.description",
- Create a ticketCreate a ticket
- Exclude checks
Align the parameters of a method call if they span more than one line. Open
default: 'Total records contained in current collection, as if there was no pagination.')
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: "Creates a #{model.name}")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: 'Records pagination size, which sets how many records will be rendered per request')
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Line is too long. [89/80] Open
key :description, ENV.fetch('APP_DESCRIPTION', I18n.t('application.description'))
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [81/80] Open
key :required, %i[*presence_validators] if klass.presence_validators?
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [129/80] Open
default: 'Records pagination size, which sets how many records will be rendered per request')
- Create a ticketCreate a ticket
- Exclude checks
Avoid using rescue
in its modifier form. Open
inner_klass = begin inner_name.constantize rescue NameError; false end
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for uses of rescue in its modifier form.
Example:
# bad
some_method rescue handle_error
# good
begin
some_method
rescue
handle_error
end
Align the parameters of a method call if they span more than one line. Open
default: "#{model.name} metadata information.")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Line is too long. [100/80] Open
key :description, I18n.t("activerecord.models.#{model.name.underscore}.schema.response",
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [103/80] Open
key :description, I18n.t("activerecord.models.#{model.name.underscore}.update.description",
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [123/80] Open
key :description, I18n.t("activerecord.models.#{inner_name.underscore}.index.description", default: inner_name)
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [142/80] Open
default: "#{inner_name} response, which include records matching current query and pagination metadata")
- Create a ticketCreate a ticket
- Exclude checks
Align the parameters of a method call if they span more than one line. Open
default: 'An indication if current request is the last to paginate in the current collection')
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: "Creates a #{model.name}")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: "Deletes a #{model.name}")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: "#{model.name} response")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: 'An indication if current request is the last to paginate in the current collection')
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: 'How many records were offsetted from the collection to render the current page')
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Line is too long. [140/80] Open
default: "#{model.name} response, which include records matching current query and pagination metadata")
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [100/80] Open
default: 'How many pages of data the current collection has.')
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [98/80] Open
key :description, I18n.t("activerecord.models.attributes.#{model.name.underscore}.id",
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [95/80] Open
default: "ID of #{model.name} to fetch on the application")
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [93/80] Open
key :description, I18n.t("activerecord.errors.models.#{inner_name.underscore}",
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [83/80] Open
default: "Unexpected error in #{inner_name}")
- Create a ticketCreate a ticket
- Exclude checks
Prefer to_s
over string interpolation. Open
key :'$ref', "#{model.name}".to_sym
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for strings that are just an interpolated expression.
Example:
# bad
"#{@var}"
# good
@var.to_s
# good if @var is already a String
@var
Align the parameters of a method call if they span more than one line. Open
default: "#{model.name} to add into application")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: "#{inner_name} metadata information.")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Line is too long. [103/80] Open
key :description, I18n.t("activerecord.models.#{model.name.underscore}.create.description",
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [101/80] Open
key :description, I18n.t("activerecord.models.#{model.name.underscore}.show.description",
- Create a ticketCreate a ticket
- Exclude checks
Align the parameters of a method call if they span more than one line. Open
default: 'How many records were offsetted from the collection to render the current page')
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: "#{model.name} response")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: 'Records filtering by attribute and search query as affix. Usage: `?q[{attribute}{search_affix}]={matcher}`. All available search affixes are listed on: https://github.com/activerecord-hackery/ransack#search-matchers')
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Line is too long. [115/80] Open
key :description, I18n.t("activerecord.models.#{model.name.underscore}.description", default: model.name)
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [113/80] Open
key :summary, I18n.t("activerecord.models.#{model.name.underscore}.index.summary", default: model.name)
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [121/80] Open
key :description, I18n.t("activerecord.models.#{model.name.underscore}.index.description", default: model.name)
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [105/80] Open
default: 'The records collection in the current pagination scope.')
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [101/80] Open
key :description, I18n.t("activerecord.models.#{inner_name.underscore}.index.response",
- Create a ticketCreate a ticket
- Exclude checks
Prefer to_s
over string interpolation. Open
key :'$ref', "#{model.name}".to_sym
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for strings that are just an interpolated expression.
Example:
# bad
"#{@var}"
# good
@var.to_s
# good if @var is already a String
@var
Align the parameters of a method call if they span more than one line. Open
default: "ID of #{model.name} to update on the application")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: "ID of #{model.name} to fetch on the application")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: "Unexpected error in #{inner_name}")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Useless assignment to variable - inner_klass
. Open
inner_klass = begin inner_name.constantize rescue NameError; false end
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for every useless assignment to local variable in every
scope.
The basic idea for this cop was from the warning of ruby -cw
:
assigned but unused variable - foo
Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.
Example:
# bad
def some_method
some_var = 1
do_something
end
Example:
# good
def some_method
some_var = 1
do_something(some_var)
end
Line is too long. [98/80] Open
key :host, I18n.t('application.apicasso_host', default: ENV.fetch('ROOT', 'localhost:3000'))
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [81/80] Open
default: "#{model.name} metadata information.")
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [98/80] Open
key :description, I18n.t("activerecord.models.#{model.name.underscore}.create.response",
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [160/80] Open
default: 'Parameters sorting splitted by `,` preffixed by `+` or `-` which translates into ascending or descending order')
- Create a ticketCreate a ticket
- Exclude checks
Align the parameters of a method call if they span more than one line. Open
default: 'Records pagination size, which sets how many records will be rendered per request')
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: 'How many pages of data the current collection has.')
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Line is too long. [141/80] Open
default: "The link of the previous page for the current collection. It can be null if there isn't any")
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [130/80] Open
default: 'How many records were offsetted from the collection to render the current page')
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [83/80] Open
default: "Unexpected error in #{inner_name}")
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [134/80] Open
default: "#{inner_name} metadata as a json with field names as keys and field types as values.")
- Create a ticketCreate a ticket
- Exclude checks
Align the parameters of a method call if they span more than one line. Open
default: 'Parameters sorting splitted by `,` preffixed by `+` or `-` which translates into ascending or descending order')
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: "The link of the next page for the current collection. It can be null if there isn't any")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Line is too long. [128/80] Open
default: 'Records pagination paging, which offsets collection based on `params[:per_page]`')
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [132/80] Open
default: "#{model.name} metadata as a json with field names as keys and field types as values.")
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [115/80] Open
key :summary, I18n.t("activerecord.models.#{inner_name.underscore}.index.summary", default: inner_name)
- Create a ticketCreate a ticket
- Exclude checks
Prefer to_s
over string interpolation. Open
key :'$ref', "#{model.name}".to_sym
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for strings that are just an interpolated expression.
Example:
# bad
"#{@var}"
# good
@var.to_s
# good if @var is already a String
@var
Align the parameters of a method call if they span more than one line. Open
default: "Updates a #{model.name}")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Line is too long. [86/80] Open
altText: I18n.t('app.logo.alttext', default: 'Application Logo')
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [139/80] Open
default: "The link of the next page for the current collection. It can be null if there isn't any")
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [102/80] Open
key :description, I18n.t("activerecord.models.#{inner_name.underscore}.schema.response",
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [104/80] Open
key :description, I18n.t("activerecord.models.#{model.name.underscore}.destroy.description",
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [130/80] Open
default: 'Records pagination paging, which offsets collection based on `params[:per_page]`')
- Create a ticketCreate a ticket
- Exclude checks
Align the parameters of a method call if they span more than one line. Open
default: 'The records collection in the current pagination scope.')
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: 'An indication if current request is out of pagination bounds for the current collection')
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Line is too long. [99/80] Open
key :description, I18n.t("activerecord.models.#{model.name.underscore}.index.response",
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [98/80] Open
key :description, I18n.t("activerecord.models.attributes.#{model.name.underscore}.id",
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [99/80] Open
default: "Existing #{model.name} to update on the application")
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [86/80] Open
next if Apicasso.configuration.model_definitions_excluded.include?(inner_name)
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [134/80] Open
default: 'An indication if current request is the last to paginate in the current collection')
- Create a ticketCreate a ticket
- Exclude checks
Prefer to_s
over string interpolation. Open
key :'$ref', "#{model.name}".to_sym
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for strings that are just an interpolated expression.
Example:
# bad
"#{@var}"
# good
@var.to_s
# good if @var is already a String
@var
Align the parameters of a method call if they span more than one line. Open
default: "#{model.name} response, which include records matching current query and pagination metadata")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: "#{model.name} metadata as a json with field names as keys and field types as values.")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: "The link of the next page for the current collection. It can be null if there isn't any")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Line is too long. [137/80] Open
default: "The link of the next page for the current collection. It can be null if there isn't any")
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [137/80] Open
default: 'An indication if current request is out of pagination bounds for the current collection')
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [101/80] Open
key :description, I18n.t("activerecord.models.#{model.name.underscore}.schema.description",
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [98/80] Open
key :description, I18n.t("activerecord.models.attributes.#{model.name.underscore}.id",
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [139/80] Open
default: 'An indication if current request is out of pagination bounds for the current collection')
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [103/80] Open
key :description, I18n.t("activerecord.models.#{inner_name.underscore}.schema.description",
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [83/80] Open
default: "#{inner_name} metadata information.")
- Create a ticketCreate a ticket
- Exclude checks
Align the parameters of a method call if they span more than one line. Open
default: 'How many pages of data the current collection has.')
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: "#{model.name} response")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Line is too long. [128/80] Open
default: 'How many records were offsetted from the collection to render the current page')
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [83/80] Open
default: "#{model.name} to add into application")
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [101/80] Open
key :description, I18n.t("activerecord.models.#{model.name.underscore}.show.description",
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [265/80] Open
default: 'Records filtering by attribute and search query as affix. Usage: `?q[{attribute}{search_affix}]={matcher}`. All available search affixes are listed on: https://github.com/activerecord-hackery/ransack#search-matchers')
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [129/80] Open
default: 'Total records contained in current collection, as if there was no pagination.')
- Create a ticketCreate a ticket
- Exclude checks
Align the parameters of a method call if they span more than one line. Open
default: 'Records filtering by attribute and search query as affix. Usage: `?q[{attribute}{search_affix}]={matcher}`. All available search affixes are listed on: https://github.com/activerecord-hackery/ransack#search-matchers')
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: 'Records pagination paging, which offsets collection based on `params[:per_page]`')
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: 'An indication if current request is out of pagination bounds for the current collection')
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: 'Parameters sorting splitted by `,` preffixed by `+` or `-` which translates into ascending or descending order')
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: 'Records pagination paging, which offsets collection based on `params[:per_page]`')
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: "#{inner_name} response, which include records matching current query and pagination metadata")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: 'The records collection in the current pagination scope.')
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: "Unexpected error in #{inner_name}")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Line is too long. [158/80] Open
default: 'Parameters sorting splitted by `,` preffixed by `+` or `-` which translates into ascending or descending order')
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [132/80] Open
default: 'An indication if current request is the last to paginate in the current collection')
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [98/80] Open
key :description, I18n.t("activerecord.models.#{model.name.underscore}.update.response",
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [96/80] Open
key :description, I18n.t("activerecord.models.#{model.name.underscore}.show.response",
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [99/80] Open
key :description, I18n.t("activerecord.models.#{model.name.underscore}.destroy.response",
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [131/80] Open
default: 'Records pagination size, which sets how many records will be rendered per request')
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [143/80] Open
default: "The link of the previous page for the current collection. It can be null if there isn't any")
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [93/80] Open
key :description, I18n.t("activerecord.errors.models.#{inner_name.underscore}",
- Create a ticketCreate a ticket
- Exclude checks
Align the parameters of a method call if they span more than one line. Open
default: "The link of the previous page for the current collection. It can be null if there isn't any")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: "Existing #{model.name} to update on the application")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: "#{model.name} response")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Align the parameters of a method call if they span more than one line. Open
default: "#{inner_name} metadata as a json with field names as keys and field types as values.")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Line is too long. [107/80] Open
key :name, I18n.t("activerecord.models.#{model.name.underscore}", default: model.name.underscore)
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [127/80] Open
default: 'Total records contained in current collection, as if there was no pagination.')
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [96/80] Open
default: "ID of #{model.name} to delete on the application")
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [102/80] Open
default: 'How many pages of data the current collection has.')
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [107/80] Open
default: 'The records collection in the current pagination scope.')
- Create a ticketCreate a ticket
- Exclude checks
Use %i
or %I
for an array of symbols. Open
key :required, [:code, :message]
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop can check for array literals made up of symbols that are not using the %i() syntax.
Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.
Configuration option: MinSize
If set, arrays with fewer elements than this value will not trigger the
cop. For example, a MinSize of
3` will not enforce a style on an array
of 2 or fewer elements.
Example: EnforcedStyle: percent (default)
# good
%i[foo bar baz]
# bad
[:foo, :bar, :baz]
Example: EnforcedStyle: brackets
# good
[:foo, :bar, :baz]
# bad
%i[foo bar baz]
Prefer to_s
over string interpolation. Open
key :'$ref', "#{model.name}".to_sym
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for strings that are just an interpolated expression.
Example:
# bad
"#{@var}"
# good
@var.to_s
# good if @var is already a String
@var
Prefer to_s
over string interpolation. Open
key :'$ref', "#{inner_name}".to_sym
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for strings that are just an interpolated expression.
Example:
# bad
"#{@var}"
# good
@var.to_s
# good if @var is already a String
@var
Prefer to_s
over string interpolation. Open
key :'$ref', "#{inner_name}".to_sym
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for strings that are just an interpolated expression.
Example:
# bad
"#{@var}"
# good
@var.to_s
# good if @var is already a String
@var
Prefer to_s
over string interpolation. Open
key :'$ref', "#{model.name}".to_sym
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for strings that are just an interpolated expression.
Example:
# bad
"#{@var}"
# good
@var.to_s
# good if @var is already a String
@var