ikuseiGmbH/smart-village-app-cms

View on GitHub

Showing 1,158 of 1,254 total issues

Class has too many lines. [199/100]
Open

class ConstructionsController < ApplicationController
  before_action :verify_current_user
  before_action { verify_current_user_role("role_construction_site") }
  before_action :init_graphql_client
  before_action :load_category_list, only: [:edit, :new, :create]

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

Method convert_params_for_graphql has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
Open

    def convert_params_for_graphql
      # Convert has_many categories
      if @event_params["categories"].present?
        categories = []
        @event_params["categories"].each do |_key, category|
Severity: Minor
Found in app/controllers/events_controller.rb - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Class has too many lines. [188/100]
Open

class SurveysController < ApplicationController
  before_action :verify_current_user
  before_action { verify_current_user_role("role_survey") }
  before_action :init_graphql_client

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

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

  def edit
    results = @smart_village.query <<~GRAPHQL
      query {
        tour(
          id: #{params[:id]}
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. [95/10]
Open

    def convert_params_for_graphql
      # Check recursively if any addresses data is given.
      # If not, we do not want to submit the params, because the name is required by the model,
      # which will result in a validation error.
      if @point_of_interest_params["addresses"].present?

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

  def edit
    results = @smart_village.query <<~GRAPHQL
      query {
        newsItem(
          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. [90.98/15]
Open

    def convert_params_for_graphql
      # Convert has_many categories
      if @event_params["categories"].present?
        categories = []
        @event_params["categories"].each do |_key, category|

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.

Class has too many lines. [134/100]
Open

class DashboardController < ApplicationController
  before_action :verify_current_user
  before_action :init_graphql_client

  def index

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

Method convert_params_for_graphql has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
Open

    def convert_params_for_graphql
      # Convert has_many categories
      if @construction_params["categories"].present?
        categories = []
        @construction_params["categories"].each do |_key, category|
Severity: Minor
Found in app/controllers/constructions_controller.rb - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Complex method EventsController#convert_params_for_graphql (128.9)
Open

    def convert_params_for_graphql
      # Convert has_many categories
      if @event_params["categories"].present?
        categories = []
        @event_params["categories"].each do |_key, category|
Severity: Minor
Found in app/controllers/events_controller.rb by flog

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 has too many lines. [73/10]
Open

  def edit
    results = @smart_village.query <<~GRAPHQL
      query {
        genericItem(
          id: #{params[:id]}
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.

Class has too many lines. [111/100]
Open

class StaticContentsController < ApplicationController
  before_action :verify_current_user
  before_action { verify_current_user_role("role_static_contents") }
  before_action :init_graphql_client

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

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

    def convert_params_for_graphql
      # Convert has_many categories
      if @event_params["categories"].present?
        categories = []
        @event_params["categories"].each do |_key, category|

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

    def convert_params_for_graphql
      # Convert has_many categories
      if @construction_params["categories"].present?
        categories = []
        @construction_params["categories"].each do |_key, category|

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 convert_params_for_graphql has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

    def convert_params_for_graphql
      # Convert has_many contacts
      if @job_params["contacts"].present?
        contacts = []
        @job_params["contacts"].each do |_key, contact|
Severity: Minor
Found in app/controllers/jobs_controller.rb - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Possible XSS vulnerability with certain configurations of rails-html-sanitizer
Open

    rails-html-sanitizer (1.2.0)
Severity: Minor
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2022-23519

Criticality: Medium

URL: https://github.com/rails/rails-html-sanitizer/security/advisories/GHSA-9h9g-93gc-623h

Solution: upgrade to >= 1.4.4

Uncontrolled Recursion in Loofah
Open

    loofah (2.2.3)
Severity: Critical
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2022-23516

Criticality: High

URL: https://github.com/flavorjones/loofah/security/advisories/GHSA-3x8r-x6xp-q4vm

Solution: upgrade to >= 2.19.1

Loofah XSS Vulnerability
Open

    loofah (2.2.3)
Severity: Minor
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2019-15587

Criticality: Medium

URL: https://github.com/flavorjones/loofah/issues/171

Solution: upgrade to >= 2.3.1

Possible XSS vulnerability with certain configurations of Rails::Html::Sanitizer
Open

    rails-html-sanitizer (1.2.0)
Severity: Minor
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2022-32209

Criticality: Medium

URL: https://groups.google.com/g/rubyonrails-security/c/ce9PhUANQ6s

Solution: upgrade to >= 1.4.3

Cross-Site Scripting in Kaminari via original_script_name parameter
Open

    kaminari (1.1.1)
Severity: Minor
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2020-11082

Criticality: Medium

URL: https://github.com/kaminari/kaminari/security/advisories/GHSA-r5jw-62xg-j433

Solution: upgrade to >= 1.2.1

Severity
Category
Status
Source
Language