ikuseiGmbH/smart-village-app-cms

View on GitHub

Showing 1,158 of 1,254 total issues

Assignment Branch Condition size for copy_event_and_set_invisibility is too high. [17.12/15]
Open

  def copy_event_and_set_invisibility
    query = create_update_or_copy_mutation(is_copy: true)
    begin
      results = @smart_village.query query
      @smart_village.query <<~GRAPHQL

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 and https://en.wikipedia.org/wiki/ABC_Software_Metric.

Cyclomatic complexity for get_request is too high. [8/6]
Open

  def get_request(content_type_xml = false, pem = nil)
    uri = Addressable::URI.parse(@uri.strip).normalize

    uri.query = [uri.query, URI.encode_www_form(@params)].join("&") if @params&.any?

Severity: Minor
Found in app/services/api_request_service.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

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

  def update
    survey_id = params[:id]
    query = create_params
    begin
      @smart_village.query query

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 activate_bundler is too high. [17.35/15]
Open

  def activate_bundler(bundler_version)
    if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new("2.0")
      bundler_version = "< 2"
    end
    gem_error = activation_error_handling do
Severity: Minor
Found in bin/bundle 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 and https://en.wikipedia.org/wiki/ABC_Software_Metric.

Perceived complexity for cli_arg_version is too high. [9/7]
Open

  def cli_arg_version
    return unless invoked_as_script? # don't want to hijack other binstubs
    return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`

    bundler_version = nil
Severity: Minor
Found in bin/bundle by rubocop

This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

Example:

def my_method                   # 1
  if cond                       # 1
    case var                    # 2 (0.8 + 4 * 0.2, rounded)
    when 1 then func_one
    when 2 then func_two
    when 3 then func_three
    when 4..10 then func_other
    end
  else                          # 1
    do_something until a && b   # 2
  end                           # ===
end                             # 7 complexity points

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

  def create
    query = create_params
    begin
      results = @smart_village.query query
    rescue Graphlient::Errors::GraphQLError => e

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 create
    query = create_update_or_copy_mutation
    begin
      results = @smart_village.query query
    rescue Graphlient::Errors::GraphQLError => e

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.

Complex method WasteCalendarController#tour_dates (38.7)
Open

  def tour_dates
    @edit_year = (params[:year].presence || Date.today.year).to_i
    @beginning_of_year = Date.strptime(@edit_year.to_s, "%Y").beginning_of_year
    @end_of_year = Date.strptime(@edit_year.to_s, "%Y").end_of_year

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Method edit has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def edit
    results = @smart_village.query <<~GRAPHQL
      query {
        genericItem(
          id: #{params[:id]}
Severity: Minor
Found in app/controllers/constructions_controller.rb - About 1 hr to fix

    Assignment Branch Condition size for create is too high. [16.58/15]
    Open

      def create
        query = create_or_update_mutation
        begin
          results = @smart_village.query query
        rescue Graphlient::Errors::GraphQLError => e
    Severity: Minor
    Found in app/controllers/jobs_controller.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 and https://en.wikipedia.org/wiki/ABC_Software_Metric.

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

        def new_generic_item
          OpenStruct.new(
            generic_type: "Offer",
            content_blocks: [OpenStruct.new],
            media_contents: [OpenStruct.new(source_url: OpenStruct.new)],

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

        def nested_values?(value_to_check, result = [])
          result << true if value_to_check.class == String && value_to_check.present?
    
          if value_to_check.class == Array
            value_to_check.each do |value|

    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 create is too high. [16.58/15]
    Open

      def create
        query = create_or_update_mutation
        begin
          results = @smart_village.query query
        rescue Graphlient::Errors::GraphQLError => e

    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 and https://en.wikipedia.org/wiki/ABC_Software_Metric.

    Assignment Branch Condition size for create is too high. [16.58/15]
    Open

      def create
        query = create_or_update_mutation
        begin
          results = @smart_village.query query
        rescue Graphlient::Errors::GraphQLError => e
    Severity: Minor
    Found in app/controllers/tours_controller.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 and https://en.wikipedia.org/wiki/ABC_Software_Metric.

    Assignment Branch Condition size for create is too high. [16.58/15]
    Open

      def create
        query = create_params
        begin
          results = @smart_village.query query
        rescue Graphlient::Errors::GraphQLError => e

    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 and https://en.wikipedia.org/wiki/ABC_Software_Metric.

    Assignment Branch Condition size for create is too high. [16.58/15]
    Open

      def create
        query = create_or_update_mutation
        begin
          results = @smart_village.query query
        rescue Graphlient::Errors::GraphQLError => e

    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 and https://en.wikipedia.org/wiki/ABC_Software_Metric.

    Assignment Branch Condition size for create is too high. [16.58/15]
    Open

      def create
        query = create_update_or_copy_mutation
        begin
          results = @smart_village.query query
        rescue Graphlient::Errors::GraphQLError => e

    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 and https://en.wikipedia.org/wiki/ABC_Software_Metric.

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

        def nested_values?(value_to_check, result = [])
          result << true if value_to_check.class == String && value_to_check.present?
    
          if value_to_check.class == Array
            value_to_check.each do |value|

    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.

    Perceived complexity for get_request is too high. [8/7]
    Open

      def get_request(content_type_xml = false, pem = nil)
        uri = Addressable::URI.parse(@uri.strip).normalize
    
        uri.query = [uri.query, URI.encode_www_form(@params)].join("&") if @params&.any?
    
    
    Severity: Minor
    Found in app/services/api_request_service.rb by rubocop

    This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

    Example:

    def my_method                   # 1
      if cond                       # 1
        case var                    # 2 (0.8 + 4 * 0.2, rounded)
        when 1 then func_one
        when 2 then func_two
        when 3 then func_three
        when 4..10 then func_other
        end
      else                          # 1
        do_something until a && b   # 2
      end                           # ===
    end                             # 7 complexity points

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

      def create
        query = create_params
        begin
          results = @smart_village.query query
        rescue Graphlient::Errors::GraphQLError => e

    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