Dalphi/dalphi

View on GitHub

Showing 1,441 of 1,441 total issues

Method has too many lines. [13/10]
Open

  def self.batch_process(project, data)
    return { error: [], success: [] } unless data || data == []
    data_size = data.size
    data_first = data.first.tempfile
    if data_size == 1 && valid_zip?(data_first)
Severity: Minor
Found in app/models/raw_datum.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [13/10]
Open

  def merge_data
    data = []
    self.annotation_documents.group_by(&:raw_datum).each do |raw_datum, annotation_documents|
      data << {
        raw_datum: {
Severity: Minor
Found in app/models/project.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [13/10]
Open

  def initialize(request)
    tokens = url_tokens(request.original_url)
    @breadcrumbs = []
    subpath = ''
    predecessor_token = nil
Severity: Minor
Found in app/helpers/breadcrumb_bakery.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [13/10]
Open

  def create
    begin
      @interface = Interface.new(converted_attributes)
      set_interface_type_from_params

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [13/10]
Open

  def update
    begin
      set_interface_type_from_params
      if @interface.update(converted_attributes)
        flash[:notice] = t('interfaces.action.update.success')

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [13/10]
Open

  def compare_annotation_document_with_json_response(model_instance, json_object)
    object_subset = json_object.except('requested_at')
                               .except('updated_at')

    expect(object_subset).to eq(

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for role_is_valid is too high. [18.03/15]
Open

  def role_is_valid(model_instance, role_identifier, target_enum)
    model_instance.role = role_identifier
    expect(model_instance).to be_valid
    expect(model_instance.iterate?).to eq(target_enum == 0)
    expect(model_instance.merge?).to eq(target_enum == 1)
Severity: Minor
Found in spec/support/service_helper.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Block has too many lines. [45/25]
Open

  config.before(:each) do
    stub_request(:get, 'http://localhost:3000/').
      with(:headers => {'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'localhost:3000', 'User-Agent' => 'Ruby'}).
      to_return(status: 200, body: '', headers: {})
    stub_request(:get, 'http://localhost:3001/').
Severity: Minor
Found in spec/spec_helper.rb by rubocop

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. [45/25]
Open

    it 'associates every statistic with the right project from raw_data ids' do
      raw_datum = FactoryGirl.create(:raw_datum)
      project = raw_datum.project
      statistic_1 = FactoryGirl.build(:statistic, key: 'compliance', project: project)
      statistic_2 = FactoryGirl.build(:statistic, key: 'precision', project: project)

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. [45/25]
Open

RSpec.describe 'Annotator create', type: :request do
  before(:each) do
    @project = FactoryGirl.create :project
    @annotator = FactoryGirl.build :annotator
    sign_in(@project.admin)

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. [44/25]
Open

  swagger_schema :AnnotationDocument do
    key :required,
        [
          :interface_type,
          :payload,
Severity: Minor
Found in app/models/annotation_document.rb by rubocop

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. [44/25]
Open

    it 'creates multiple statistics for a list of valid statistics' do
      project = FactoryGirl.create(:project)
      statistic_1 = FactoryGirl.build(:statistic, key: 'compliance', project: project)
      statistic_2 = FactoryGirl.build(:statistic, key: 'precision', project: project)
      expect(Statistic.count).to eq(0)

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. [44/25]
Open

  it 'combines annotation documents into a raw datum by sending them to a merge service' do
    arbitrary_interface_type = FactoryGirl.create(:interface_type)
    raw_datum = FactoryGirl.create :raw_datum,
                                   data: File.new("#{Rails.root}/spec/fixtures/text/unmerged.txt"),
                                   project: @project

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.

Method has too many lines. [12/10]
Open

    def save_statistics
      return unless @statistics
      Statistic.transaction do
        iteration_index = Statistic.where(project: @project).maximum(:iteration_index) || 0
        iteration_index += 1

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [12/10]
Open

    def service_params
      interface_types = params[:service][:interface_types]
      permitted_params = params.require(:service).permit(
        :role,
        :description,

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [12/10]
Open

  def index
    @annotator = Annotator.new
    objects_per_page = Rails.configuration.x.dalphi['paginated-objects-per-page']['annotators']
    ids = Annotator.all
                   .select { |annotator| !@project || annotator.projects.include?(@project) }

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Similar blocks of code found in 6 locations. Consider refactoring.
Open

      swagger_path '/statistics/{id}' do
        operation :get do
          key :comsumes, ['application/json']
          key :description, I18n.t('api.statistics.show.description')
          key :operationId, 'statistic_read'
Severity: Major
Found in app/controllers/api/v1/statistics_controller.rb and 5 other locations - About 1 hr to fix
app/controllers/api/v1/annotation_documents_controller.rb on lines 14..40
app/controllers/api/v1/annotation_documents_controller.rb on lines 122..148
app/controllers/api/v1/raw_data_controller.rb on lines 13..39
app/controllers/api/v1/raw_data_controller.rb on lines 167..193
app/controllers/api/v1/statistics_controller.rb on lines 121..147

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 73.

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

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

      swagger_path '/raw_data/{id}' do
        operation :delete do
          key :comsumes, ['application/json']
          key :description, I18n.t('api.raw_datum.destroy.description')
          key :operationId, 'raw_datum_destroy'
Severity: Major
Found in app/controllers/api/v1/raw_data_controller.rb and 5 other locations - About 1 hr to fix
app/controllers/api/v1/annotation_documents_controller.rb on lines 14..40
app/controllers/api/v1/annotation_documents_controller.rb on lines 122..148
app/controllers/api/v1/raw_data_controller.rb on lines 13..39
app/controllers/api/v1/statistics_controller.rb on lines 13..39
app/controllers/api/v1/statistics_controller.rb on lines 121..147

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 73.

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

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

      swagger_path '/annotation_documents/{id}' do
        operation :get do
          key :comsumes, ['application/json']
          key :description, I18n.t('api.annotation_document.show.description')
          key :operationId, 'annotation_document_read'
Severity: Major
Found in app/controllers/api/v1/annotation_documents_controller.rb and 5 other locations - About 1 hr to fix
app/controllers/api/v1/annotation_documents_controller.rb on lines 122..148
app/controllers/api/v1/raw_data_controller.rb on lines 13..39
app/controllers/api/v1/raw_data_controller.rb on lines 167..193
app/controllers/api/v1/statistics_controller.rb on lines 13..39
app/controllers/api/v1/statistics_controller.rb on lines 121..147

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 73.

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

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

      swagger_path '/statistics/{id}' do
        operation :delete do
          key :comsumes, ['application/json']
          key :description, I18n.t('api.statistic.destroy.description')
          key :operationId, 'statistic_destroy'
Severity: Major
Found in app/controllers/api/v1/statistics_controller.rb and 5 other locations - About 1 hr to fix
app/controllers/api/v1/annotation_documents_controller.rb on lines 14..40
app/controllers/api/v1/annotation_documents_controller.rb on lines 122..148
app/controllers/api/v1/raw_data_controller.rb on lines 13..39
app/controllers/api/v1/raw_data_controller.rb on lines 167..193
app/controllers/api/v1/statistics_controller.rb on lines 13..39

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 73.

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

Further Reading

Severity
Category
Status
Source
Language