ikuseiGmbH/smart-village-app-cms

View on GitHub

Showing 1,158 of 1,254 total issues

Perceived complexity for create is too high. [10/7]
Open

  def create
    results = @smart_village.query <<~GRAPHQL
      query {
        publicJsonFile(name: "wasteTypes", version: "1.0.0") {
          content

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

  def remove_tour
    @smart_village.query <<~GRAPHQL
      mutation {
        destroyRecord(
          id: #{params["id"]},

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

    def convert_params_for_graphql
      # Convert date, as we always have and need exactly one
      if @survey_params["dates"].present?
        dates = @survey_params.delete(:dates)
        @survey_params["date"] = dates["0"]

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. [13/10]
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 checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Cyclomatic complexity for cli_arg_version is too high. [9/6]
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 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. [13/10]
Open

  def remove_location
    # TODO: temporarily commented, as we need memcached for this in order to be successful across multiple workers
    # Rails.cache.delete("waste_locations")

    @smart_village.query <<~GRAPHQL

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 perform is too high. [10/7]
Open

  def perform
    @tour_data.each do |tour_data_line|
      @waste_types.each do |waste_type_key, _waste_type|
        next if @tour_assignment[waste_type_key].blank?
        next if @address_assignment[waste_type_key].blank?

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. [13/10]
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 if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Function recSetObjKey has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var recSetObjKey = function (obj, keyparts, value) {
      var arrayMatch = null;
      var reArray = /\[([0-9]*)\]$/;
      var subkey = keyparts.shift();
      var idx = 0;
Severity: Minor
Found in lib/jsonform-defaults.js - About 2 hrs to fix

    Function extractDefaultValues has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        var extractDefaultValues = function (schemaItem, path) {
          var properties = null;
          var child = null;
    
          if (!schemaItem || (schemaItem !== Object(schemaItem))) return null;
    Severity: Minor
    Found in lib/jsonform-defaults.js - About 1 hr to fix

      Method has too many lines. [12/10]
      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 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 new_generic_item
            OpenStruct.new(
              generic_type: "Job",
              contacts: [OpenStruct.new(web_urls: [OpenStruct.new])],
              content_blocks: [OpenStruct.new],
      Severity: Minor
      Found in app/controllers/jobs_controller.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. [12/10]
      Open

        def create
          query = create_or_update_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.

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

        def verify_user
          result = validate_support_id
          if result && result.code == "200" && result.body.present?
            encounter_server = SmartVillageApi.encounter_server_url
            uri = Addressable::URI.parse("#{encounter_server}/v1/support/verify_user.json")

      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 create
          query = create_or_update_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.

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

        def update
          news_id = params[:id]
      
          unless category_present?(news_item_params)
            flash[:error] = "Bitte eine Kategorie auswählen"

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

        def update
          news_id = params[:id]
      
          unless category_present?(news_item_params)
            flash[:error] = "Bitte eine Kategorie auswählen"

      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. [12/10]
      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 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_or_update_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.

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

        def show
          result = validate_support_id
      
          if result && result.code == "200" && result.body.present?
            user_data = OpenStruct.new(JSON.parse(result.body))

      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