autoforce/APIcasso

View on GitHub

Showing 315 of 317 total issues

ReDoS based DoS vulnerability in GlobalID
Open

    globalid (0.4.2)
Severity: Minor
Found in Gemfile.lock by bundler-audit

Advisory: CVE-2023-22799

URL: https://github.com/rails/globalid/releases/tag/v1.0.1

Solution: upgrade to >= 1.0.1

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

  class ApidocsController < Apicasso::ApplicationController
    skip_before_action :restrict_access

    include Swagger::Blocks
    # Default application settings for documentation generation.

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

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

    ActiveRecord::Base.descendants.each do |model|
      next if MODELS_EXCLUDED.include?(model.name) || model.abstract_class

      # Resource definitions of GET, OPTIONS, POST
      swagger_path "/#{model.name.underscore}" do

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.

Complex method Apicasso::ApidocsController::operation(get)::response#200 (237.7)
Open

            response 200 do
              key :description, I18n.t("activerecord.models.#{inner_name.underscore}.index.response",
                                      default: "#{inner_name} response, which include records matching current query and pagination metadata")
              schema do
                key :name, :total

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

Complex method Apicasso::ApidocsController::operation#get (202.9)
Open

          operation :get do
            key :summary, I18n.t("activerecord.models.#{inner_name.underscore}.index.summary", default: inner_name)
            key :description, I18n.t("activerecord.models.#{inner_name.underscore}.index.description", default: inner_name)
            key :operationId, "find#{inner_name.pluralize}"
            key :produces, ['application/json']

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

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

      model.reflect_on_all_associations.each do |association|
        begin
          inner_name = association.class_name.to_s.classify
        rescue NoMethodError, ActionController::RoutingError
          inner_name = association.name.to_s.classify

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.

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

  class CrudController < Apicasso::ApplicationController
    before_action :set_root_resource, except: %i[ql batch_create batch_update]
    before_action :set_object, except: %i[index create schema ql batch_create batch_update]
    before_action :set_nested_resource, only: %i[nested_index]
    before_action :set_records, only: %i[index nested_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.

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

      swagger_path "/#{model.name.underscore}" do
        operation :get do
          key :summary, I18n.t("activerecord.models.#{model.name.underscore}.index.summary", default: model.name)
          key :description, I18n.t("activerecord.models.#{model.name.underscore}.index.description", default: model.name)
          key :operationId, "find#{model.name.pluralize}"

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

        swagger_path "/#{model.name.underscore}/{id}/#{association.name}" do
          operation :get do
            key :summary, I18n.t("activerecord.models.#{inner_name.underscore}.index.summary", default: inner_name)
            key :description, I18n.t("activerecord.models.#{inner_name.underscore}.index.description", default: inner_name)
            key :operationId, "find#{inner_name.pluralize}"

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.

File apidocs_controller.rb has 482 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Apicasso
  # Controller used to generate an application Swagger JSON, used by
  # SwaggerUI to generate beautiful API documentation
  class ApidocsController < Apicasso::ApplicationController
    skip_before_action :restrict_access
Severity: Minor
Found in app/controllers/apicasso/apidocs_controller.rb - About 7 hrs to fix

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

          operation :get do
            key :summary, I18n.t("activerecord.models.#{inner_name.underscore}.index.summary", default: inner_name)
            key :description, I18n.t("activerecord.models.#{inner_name.underscore}.index.description", default: inner_name)
            key :operationId, "find#{inner_name.pluralize}"
            key :produces, ['application/json']

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

        operation :get do
          key :summary, I18n.t("activerecord.models.#{model.name.underscore}.index.summary", default: model.name)
          key :description, I18n.t("activerecord.models.#{model.name.underscore}.index.description", default: model.name)
          key :operationId, "find#{model.name.pluralize}"
          key :produces, ['application/json']

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.

Complex method Apicasso::ApidocsController::operation#patch (75.7)
Open

        operation :patch do
          key :description, I18n.t("activerecord.models.#{model.name.underscore}.update.response",
                                  default: "Updates a #{model.name}")
          key :operationId, "edit#{model.name}"
          key :produces, ['application/json']

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

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

      swagger_path "/#{model.name.underscore}/{id}" do
        operation :patch do
          key :description, I18n.t("activerecord.models.#{model.name.underscore}.update.response",
                                  default: "Updates a #{model.name}")
          key :operationId, "edit#{model.name}"

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

          response 200 do
            key :description, I18n.t("activerecord.models.#{model.name.underscore}.index.response",
                                    default: "#{model.name} response, which include records matching current query and pagination metadata")
            schema do
              key :name, :total

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

            response 200 do
              key :description, I18n.t("activerecord.models.#{inner_name.underscore}.index.response",
                                      default: "#{inner_name} response, which include records matching current query and pagination metadata")
              schema do
                key :name, :total

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.

Complex method Apicasso::ApidocsController::operation#post (51.1)
Open

        operation :post do
          key :description, I18n.t("activerecord.models.#{model.name.underscore}.create.response",
                                  default: "Creates a #{model.name}")
          key :operationId, "add#{model.name}"
          key :produces, ['application/json']

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

Assignment Branch Condition size for set_records is too high. [24.27/15]
Open

    def set_records
      authorize! :read, resource.name.underscore.to_sym
      @records = request_collection.ransack(parsed_query).result(distinct: true)
      @object = request_collection.new
      key_scope_records

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

Complex method Apicasso::ApidocsController::operation#delete (44.8)
Open

        operation :delete do
          key :description, I18n.t("activerecord.models.#{model.name.underscore}.destroy.response",
                                  default: "Deletes a #{model.name}")
          key :operationId, "destroy#{model.name}"
          key :produces, ['application/json']

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

  def change
    execute <<-SQL
      CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
    SQL
    # The apicasso_keys schema to creates the table

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