CreateAssessmentInstruments   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 100 %

Importance

Changes 0
Metric Value
dl 14
loc 14
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A change() 12 12 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
# frozen_string_literal: true
2
3
# Creates table for association class between assessments and instruments
4 View Code Duplication
class CreateAssessmentInstruments < ActiveRecord::Migration[5.1]
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
5
  def change
6
    create_table :assessment_instruments do |t|
7
      t.references :assessment, null: false, foreign_key: true
8
      t.references :instrument, null: false, foreign_key: true
9
      t.timestamps null: false, default: -> { 'CURRENT_TIMESTAMP' }
10
    end
11
12
    add_index :assessment_instruments, 
13
              %i[assessment_id instrument_id], 
14
              unique: true,
15
              name: 'index_by_assessment_instrument'
16
  end
17
end
18