Showing 922 of 922 total issues
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<div
className={this.isIn(this.props.currentDate) + (this.props.metas.day_types[this.props.day.wday] || !this.props.day.in_periods ? '' : ' out_from_daytypes')}
>
Function validate
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
validate(toggleArrivals) {
this.clipboard.error = null
const deserializedContent = this.contentTable
const deserializedCopyContent = this.copyContent.deserialize(toggleArrivals)
Function submitTimetable
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
submitTimetable: (dispatch, timetable, metas, next) => {
dispatch(actions.fetchingApi())
let strDayTypes = actions.arrayToStrDayTypes(metas.day_types)
metas.day_types = strDayTypes
let sentState = assign({}, timetable, metas)
Function initPublicationSetupButtons
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const initPublicationSetupButtons = container => {
$(container).find("input[type=checkbox][name*=destroy]").each((i, el) => {
const $el = $(el)
const $group = $($el.parents('.form-group')[0])
$group.hide()
Function constructor
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(
reducer,
initialState,
actionsCreator = {}
) {
Method multiple_selection_toolbox
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def multiple_selection_toolbox(actions, collection_name:)
links = content_tag :ul do
# #5206 `if params[:controller]` mieux passer comme parametre si besoin
delete_path = nil
Function render
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
render() {
const {
vjas,
x,
y,
- 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
Function Navigate
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export default function Navigate({ dispatch, journeyPatterns, pagination, status }) {
let firstPage = 1
let lastPage = Math.ceil(pagination.totalCount / window.journeyPatternsPerPage)
let firstItemOnPage = firstPage + (pagination.perPage * (pagination.page - firstPage))
- 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
Function render
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
render() {
this.previousCity = undefined
let detailed_calendars = this.hasFeature('detailed_calendars') && !this.disabled
let detailed_calendars_shown = $('.detailed-timetables-bt').hasClass('active')
let { time_tables } = this.props.value
- 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
Method change_status
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def change_status(status, attributes = {})
attributes.delete_if { |_, v| v.nil? }
now = Time.zone.now
- 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
Method values
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def values(offset: 1, limit: 1000)
if sequence_type.range_sequence?
return [] unless range_start && range_end
value_start = range_start + offset - 1
- 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
Method process
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def process(source_file, target_file)
route_ids = self.route_ids
ignore_parents = self.ignore_parents?
gtfs_target_for = Proc.new do |resource, associations|
- 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
Method referential_identifier
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def referential_identifier
%w[line_referential stop_area_referential].each do |name|
if (r = self.class.reflections[name])
id = send(r.foreign_key)
return id ? [r.klass, { id: id }] : nil
- 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
Method unique_codes
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def unique_codes(model)
unique_codes = {}
if model.respond_to?(:codes)
code_spaces = model.codes.map(&:code_space).uniq
- 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
Method process_trip
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def process_trip(resource, trip, stop_times)
begin
raise InvalidTripSingleStopTime unless stop_times.many?
raise InvalidTripTimesError unless consistent_stop_times(stop_times)
- 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
Method all_costs_values_must_be_positive
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
validate def all_costs_values_must_be_positive
unless costs.empty?
invalid_distances = false
invalid_times = false
costs.values.each do |val|
- 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
Method definition_list
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def definition_list title, test, options={}
return unless test.present?
togglable = options[:togglable]
togglable = 0 if togglable.present? && !togglable.is_a?(Fixnum)
- 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
Method full_schedule?
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def full_schedule?
full = true
stop_points.sort_by(&:position).inject(nil) do |start, finish|
next finish unless start.present?
costs = costs_between(start, finish)
- 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 4 locations. Consider refactoring. Open
shapeWaypoint: new Style({
image: new Circle({
radius: 8,
stroke: new Stroke({ color: 'white', width: 2 }),
fill: new Fill({ color: 'red' })
- 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 60.
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
shapeConstraint: new Style({
image: new Circle({
radius: 8,
stroke: new Stroke({ color: 'red', width: 2 }),
fill: new Fill({ color: 'white' })
- 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 60.
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