Showing 922 of 922 total issues
Method ransack_transport_mode
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def ransack_transport_mode scope
return scope unless params[:q].try(:[], :transport_mode) || params[:q].try(:[], :transport_submode)
@transport_modes = params[:q][:transport_mode].keys if params[:q].has_key?(:transport_mode)
@transport_submodes = params[:q][:transport_submode].keys if params[:q].has_key?(:transport_submode)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Similar blocks of code found in 2 locations. Consider refactoring. Open
<div>
<BSelect2 {...this.props} onSelect={ this.onChange.bind(this) }/>
{ hasError && <span className='help-block small'>{I18n.t('activerecord.errors.models.route.attributes.stop_points.empty_stop_point')}</span> }
</div>
- Read upRead up
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 70.
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
<div className={`select2-bootstrap-append ${hasError && 'has-error'}`}>
<BSelect2 {...this.props} onSelect={ this.onChange.bind(this) }/>
{ hasError && <span className='help-block small'>{I18n.t('activerecord.errors.models.route.attributes.stop_points.empty_stop_point')}</span> }
</div>
- Read upRead up
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 70.
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
Function componentDidUpdate
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
componentDidUpdate(prevProps, prevState) {
if(this.props.status.isFetching == false){
$('.table-2entries').each(function() {
$(this).find('.th').css('height', 'auto')
var refH = []
Method state_update
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def state_update state
update_attributes(self.class.state_permited_attributes(state))
self.calendar_id = nil if self.respond_to?(:calendar_id) && !state['calendar']
days = state['day_types'].split(',')
Method line_params
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def line_params
out = params.require(:line)
out = out.permit(
:activated,
:active_from,
Method stop_area_params
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def stop_area_params
fields = [
:area_type,
:children_ids,
:city_name,
Method show
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
@q = route.journey_patterns
if params[:q].present?
ids = @q.ransack(params[:q]).result(distinct: true).pluck(:id)
@q = @q.where(id: ids)
Identical blocks of code found in 2 locations. Consider refactoring. Open
className={'btn btn-default ' + (this.state.additional_time == 0 && this.state.originalDT.hour == this.state.duplicate_time_hh && this.state.originalDT.minute == this.state.duplicate_time_mm ? 'disabled' : '')}
- Read upRead up
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 69.
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
let noInputChanges = this.state.additional_time == 0 && this.state.originalDT.hour == this.state.duplicate_time_hh && this.state.originalDT.minute == this.state.duplicate_time_mm
- Read upRead up
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 69.
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
Function render
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
if (!this.hasPolicy()) {
return false
}
return (
Method compute_for_referential
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def compute_for_referential(referential)
Chouette::Benchmark.measure 'service_counts', referential: referential.id do
referential_inserter = ReferentialInserter.new(referential) do |config|
config.add(IdInserter)
config.add(CopyInserter)
Method collection
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def collection
scope = select_time_tables
scope = self.ransack_period_range(scope: scope, error_message: t('referentials.errors.validity_period'), query: :overlapping)
@q = scope.ransack(params[:q])
Method checksum_parents
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.checksum_parents object
klass = object.class
return [] unless klass.respond_to? :checksum_parent_relations
return [] unless klass.checksum_parent_relations
Consider simplifying this complex logical expression. Open
if(this.props.status.fetchSuccess == true) {
return (
<li className='st_action'>
<button
type='button'
Similar blocks of code found in 2 locations. Consider refactoring. Open
class UserStatusFinalizer
def initialize(macro_list_run)
@macro_list_run = macro_list_run
end
attr_reader :macro_list_run
- Read upRead up
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 67.
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
class UserStatusFinalizer
def initialize(control_list_run)
@control_list_run = control_list_run
end
attr_reader :control_list_run
- Read upRead up
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 67.
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
Function configs
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
static get configs() {
return {
default: {
valueField: 'id',
labelField: 'text',
Method fill_passing_times!
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def fill_passing_times!
encountered_empty_vjas = []
previous_stop = nil
vehicle_journey_at_stops.each do |vjas|
sp = vjas.stop_point
Method save_model
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def save_model(model, filename: nil, line_number: nil, column_number: nil, resource: nil)
return unless model.changed?
if resource
filename ||= "#{resource.name}.txt"