Dalphi/dalphi

View on GitHub

Showing 1,441 of 1,441 total issues

File service_spec.rb has 264 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rails_helper'

RSpec.configure do |c|
  c.include ServiceHelper
end
Severity: Minor
Found in spec/models/service_spec.rb - About 2 hrs to fix

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

    FactoryGirl.define do
      # interface_type_instance = FactoryGirl.create(:interface_type)
      factory :service, class: Service do
        role 0
        description 'Arnnes algorithm for optimal results'
    Severity: Minor
    Found in spec/factories/services.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. [49/25]
    Open

    RSpec.describe 'Service update', type: :request do
      before(:each) do
        @project = FactoryGirl.create(:project)
        @service = FactoryGirl.create(:service)
        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.

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

        def merge_annotation_documents
          record_count = error_count = 0
          @project.merge_data.each do |merge_datum|
            response = merge_request merge_datum
            if response.kind_of? Net::HTTPSuccess

    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. [15/10]
    Open

          def update
            params_data = params['data']
            if params_data.present?
              File.write @raw_datum.data.path,
                         Base64.decode64(params_data).force_encoding('utf-8')

    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 3 locations. Consider refactoring.
    Open

          swagger_path '/raw_data' do
            operation :post do
              key :comsumes, ['application/json']
              key :description, I18n.t('api.raw_datum.create.description')
              key :operationId, 'raw_datum_create'
    Severity: Major
    Found in app/controllers/api/v1/raw_data_controller.rb and 2 other locations - About 2 hrs to fix
    app/controllers/api/v1/annotation_documents_controller.rb on lines 45..78
    app/controllers/api/v1/statistics_controller.rb on lines 44..77

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

    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 3 locations. Consider refactoring.
    Open

          swagger_path '/statistics' do
            operation :post do
              key :comsumes, ['application/json']
              key :description, I18n.t('api.statistic.create.description')
              key :operationId, 'statistic_create'
    Severity: Major
    Found in app/controllers/api/v1/statistics_controller.rb and 2 other locations - About 2 hrs to fix
    app/controllers/api/v1/annotation_documents_controller.rb on lines 45..78
    app/controllers/api/v1/raw_data_controller.rb on lines 49..82

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

    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 3 locations. Consider refactoring.
    Open

          swagger_path '/annotation_documents' do
            operation :post do
              key :comsumes, ['application/json']
              key :description, I18n.t('api.annotation_document.create.description')
              key :operationId, 'annotation_document_create'
    Severity: Major
    Found in app/controllers/api/v1/annotation_documents_controller.rb and 2 other locations - About 2 hrs to fix
    app/controllers/api/v1/raw_data_controller.rb on lines 49..82
    app/controllers/api/v1/statistics_controller.rb on lines 44..77

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

    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 2 locations. Consider refactoring.
    Open

      describe 'java_script' do
        it 'can be nil' do
          @interface.java_script = nil
          expect(@interface).to be_valid
        end
    Severity: Major
    Found in spec/models/interface_spec.rb and 1 other location - About 2 hrs to fix
    spec/models/interface_spec.rb on lines 122..145

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

    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 2 locations. Consider refactoring.
    Open

      describe 'stylesheet' do
        it 'can be nil' do
          @interface.stylesheet = nil
          expect(@interface).to be_valid
        end
    Severity: Major
    Found in spec/models/interface_spec.rb and 1 other location - About 2 hrs to fix
    spec/models/interface_spec.rb on lines 185..208

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

    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

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

      factory :service, class: Service do
        role 0
        description 'Arnnes algorithm for optimal results'
        problem_id 'NER'
        url 'http://www.google.com'
    Severity: Minor
    Found in spec/factories/services.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.

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

            def annotation_document_params
              return annotation_document_params_from_json if params['_json']
              parameters = params.require(:annotation_document).permit(
                :id,
                :interface_type,

    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 index is too high. [19.67/15]
    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 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

    Assignment Branch Condition size for validate_stylesheet is too high. [19.42/15]
    Open

      def self.validate_stylesheet(record)
        return if record.stylesheet.path.nil?
    
        container_class = Rails.configuration.x.dalphi['annotation-interface']['container-class-name']
        stylesheet_contents = Paperclip.io_adapters.for(record.stylesheet).read

    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

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

      def index
        respond_to do |format|
          format.js { render json: @raw_data }
          format.zip do
            raw_data_zip

    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.

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

      describe 'filename' do
        it 'should not be nil' do
          @raw_datum.filename = nil
          expect(@raw_datum).to be_invalid
        end
    Severity: Minor
    Found in spec/models/raw_datum_spec.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. [46/25]
    Open

      describe 'title' do
        it 'should not be nil' do
          @interface.title = nil
          expect(@interface).to be_invalid
        end
    Severity: Minor
    Found in spec/models/interface_spec.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. [46/25]
    Open

    RSpec.describe 'Interface creation', type: :request do
      before(:each) do
        @project = FactoryGirl.create(:project)
        sign_in(@project.admin)
      end

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

    feature 'Project selection from projects index view' do
      before(:each) do
        @project = FactoryGirl.create(:project_with_annotator)
      end
    
    

    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. [13/10]
    Open

        def process_iteration_data(raw_data)
          @annotation_documents = false
          iterate_service = @project.iterate_service
          response = json_post_request iterate_service.url,
                                       process_iteration_data_response_hash(raw_data)

    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.

    Severity
    Category
    Status
    Source
    Language