mirror of
https://github.com/docusealco/docuseal
synced 2026-11-04 06:42:32 -05:00
fix rubocop
This commit is contained in:
1 parent
f9c12b9d78
commit
9bfa6f7f4a
25 files changed
+27
-52
No files matched your search
@@ -54,14 +54,13 @@ class AccountsController < ApplicationController
|
||||
email: true_user.email.sub('@', '+removed@'))
|
||||
true_user.account.update!(archived_at: Time.current)
|
||||
|
||||
# rubocop:disable Layout/LineLength
|
||||
# rubocop:disable-next Layout/LineLength
|
||||
render turbo_stream: turbo_stream.replace(
|
||||
:account_delete_button,
|
||||
html: helpers.tag.p(I18n.t('your_account_will_be_permanently_deleted_within_2_months_please_contact_us_if_you_want_to_keep_your_account')) +
|
||||
helpers.tag.br +
|
||||
helpers.tag.p(I18n.t('your_email_address_has_been_released_immediately_you_can_now_be_added_to_your_company_team_without_waiting_for_the_deletion_period_to_end'))
|
||||
)
|
||||
# rubocop:enable Layout/LineLength
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -11,7 +11,7 @@ module Api
|
||||
before_action :set_noindex_headers
|
||||
before_action :set_security_headers
|
||||
|
||||
# rubocop:disable Metrics
|
||||
# rubocop:disable-next Metrics
|
||||
def show
|
||||
blob_uuid, purp, exp = ApplicationRecord.signed_id_verifier.verified(params[:signed_uuid])
|
||||
|
||||
@@ -53,7 +53,6 @@ module Api
|
||||
end
|
||||
end
|
||||
end
|
||||
# rubocop:enable Metrics
|
||||
|
||||
private
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ module Api
|
||||
render json: Submitters::SerializeForApi.call(@submitter, with_template: true, with_events: true, params:)
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics/MethodLength
|
||||
# rubocop:disable-next Metrics/MethodLength
|
||||
def update
|
||||
submission = @submitter.submission
|
||||
role = submission.template_submitters.find { |e| e['uuid'] == @submitter.uuid }['name']
|
||||
@@ -84,7 +84,6 @@ module Api
|
||||
|
||||
render json: { error: e.message }, status: :unprocessable_content
|
||||
end
|
||||
# rubocop:enable Metrics/MethodLength
|
||||
|
||||
def submitter_params
|
||||
submitter_params = params.key?(:submitter) ? params.require(:submitter) : params
|
||||
|
||||
@@ -30,7 +30,7 @@ module Mcp
|
||||
}
|
||||
}.freeze
|
||||
|
||||
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
||||
# rubocop:disable-next Metrics/AbcSize, Metrics/MethodLength
|
||||
def call
|
||||
account = current_user.account
|
||||
|
||||
@@ -87,6 +87,5 @@ module Mcp
|
||||
edit_url: edit_template_url(@template)
|
||||
)
|
||||
end
|
||||
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
||||
end
|
||||
end
|
||||
@@ -66,7 +66,7 @@ module Mcp
|
||||
}
|
||||
}.freeze
|
||||
|
||||
# rubocop:disable Metrics
|
||||
# rubocop:disable-next Metrics
|
||||
def call
|
||||
@template = Template.accessible_by(current_ability).find(mcp_params['template_id'])
|
||||
|
||||
@@ -115,6 +115,5 @@ module Mcp
|
||||
rescue Submissions::CreateFromSubmitters::BaseError => e
|
||||
render_tool_error(e.message)
|
||||
end
|
||||
# rubocop:enable Metrics
|
||||
end
|
||||
end
|
||||
@@ -1,9 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PasswordsController < Devise::PasswordsController
|
||||
# rubocop:disable Rails/LexicallyScopedActionFilter
|
||||
# rubocop:disable-next Rails/LexicallyScopedActionFilter
|
||||
skip_before_action :require_no_authentication, only: %i[edit update]
|
||||
# rubocop:enable Rails/LexicallyScopedActionFilter
|
||||
|
||||
around_action :with_browser_locale
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class PreviewDocumentPageController < ActionController::API
|
||||
File.open(file_path, File::RDWR | File::CREAT, 0o644) do |file|
|
||||
file.flock(File::LOCK_EX)
|
||||
|
||||
# rubocop:disable Style/ZeroLengthPredicate
|
||||
# rubocop:disable-next Style/ZeroLengthPredicate
|
||||
if file.size.zero?
|
||||
cleanup_stale_tempfiles
|
||||
|
||||
@@ -63,7 +63,6 @@ class PreviewDocumentPageController < ActionController::API
|
||||
else
|
||||
FileUtils.touch(file_path)
|
||||
end
|
||||
# rubocop:enable Style/ZeroLengthPredicate
|
||||
|
||||
file.flock(File::LOCK_UN)
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ ActiveSupport.on_load(:active_storage_attachment) do
|
||||
end
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics/BlockLength
|
||||
# rubocop:disable-next Metrics/BlockLength
|
||||
ActiveSupport.on_load(:active_storage_blob) do
|
||||
attribute :uuid, :string, default: -> { SecureRandom.uuid }
|
||||
attribute :io_data, :string, default: ''
|
||||
@@ -59,7 +59,6 @@ ActiveSupport.on_load(:active_storage_blob) do
|
||||
service.delete(key)
|
||||
end
|
||||
end
|
||||
# rubocop:enable Metrics/BlockLength
|
||||
|
||||
ActiveStorage::LogSubscriber.detach_from(:active_storage) if Rails.env.production?
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ end
|
||||
#
|
||||
# Use this hook to configure devise mailer, warden hooks and so forth.
|
||||
# Many of these configuration options can be set straight in your model.
|
||||
# rubocop:disable Metrics/BlockLength
|
||||
# rubocop:disable-next Metrics/BlockLength
|
||||
Devise.setup do |config|
|
||||
config.warden do |manager|
|
||||
manager.default_strategies(scope: :user).unshift(:two_factor_authenticatable)
|
||||
@@ -336,4 +336,3 @@ Devise.setup do |config|
|
||||
|
||||
ActiveSupport.run_load_hooks(:devise_config, config)
|
||||
end
|
||||
# rubocop:enable Metrics/BlockLength
|
||||
@@ -10,9 +10,8 @@ ActionView::Base.field_error_proc = proc do |html_tag, instance|
|
||||
|
||||
parsed_html_tag = Nokogiri::HTML::DocumentFragment.parse(html_tag)
|
||||
parsed_html_tag.children.add_class 'input-error'
|
||||
# rubocop:disable Rails/OutputSafety
|
||||
# rubocop:disable-next Rails/OutputSafety
|
||||
html_tag = parsed_html_tag.to_s.html_safe
|
||||
# rubocop:enable Rails/OutputSafety
|
||||
|
||||
result = html_tag
|
||||
|
||||
|
||||
@@ -72,9 +72,8 @@ module HexaPDF
|
||||
def terminal_field?
|
||||
kids = self[:Kids]
|
||||
|
||||
# rubocop:disable Rails/Blank
|
||||
# rubocop:disable-next Rails/Blank
|
||||
kids.nil? || kids.empty? || kids.none? { |kid| kid&.key?(:T) }
|
||||
# rubocop:enable Rails/Blank
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
|
||||
class AddIsFirstToCompletedSubmitters < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
# rubocop:disable Rails/ThreeStateBooleanColumn
|
||||
# rubocop:disable-next Rails/ThreeStateBooleanColumn
|
||||
add_column :completed_submitters, :is_first, :boolean
|
||||
# rubocop:enable Rails/ThreeStateBooleanColumn
|
||||
|
||||
add_index :completed_submitters, %i[account_id completed_at],
|
||||
where: 'is_first = TRUE',
|
||||
|
||||
+2
-2
@@ -111,7 +111,7 @@ module LoadIco
|
||||
and_scanline_stride = 0
|
||||
if has_and_mask
|
||||
and_mask_data_offset = xor_mask_data_offset + (image_pixel_height * xor_scanline_stride)
|
||||
and_scanline_stride = (((dib_width * 1) + 31) / 32) * 4
|
||||
and_scanline_stride = ((dib_width + 31) / 32) * 4
|
||||
end
|
||||
|
||||
flat_rgba_pixels = []
|
||||
@@ -128,7 +128,7 @@ module LoadIco
|
||||
if has_and_mask
|
||||
dib_io.seek(and_mask_data_offset + (y_dib_row * and_scanline_stride))
|
||||
and_mask_scanline_bytes = dib_io.read(and_scanline_stride)
|
||||
min_and_bytes_needed = ((dib_width * 1) + 7) / 8
|
||||
min_and_bytes_needed = (dib_width + 7) / 8
|
||||
return nil unless and_mask_scanline_bytes && and_mask_scanline_bytes.bytesize >= min_and_bytes_needed
|
||||
|
||||
(0...dib_width).each do |x_pixel|
|
||||
|
||||
@@ -75,7 +75,7 @@ module MarkdownToHtml
|
||||
html.presence || '<p></p>'
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics
|
||||
# rubocop:disable-next Metrics
|
||||
def parse_inline(text)
|
||||
context = []
|
||||
out = ''
|
||||
@@ -128,5 +128,4 @@ module MarkdownToHtml
|
||||
|
||||
(out + text[last..].to_s + flush.call).gsub('<a>', '[')
|
||||
end
|
||||
# rubocop:enable Metrics
|
||||
end
|
||||
+2
-4
@@ -86,7 +86,7 @@ class Pdfium
|
||||
end
|
||||
end
|
||||
|
||||
# rubocop:disable Naming/ClassAndModuleCamelCase
|
||||
# rubocop:disable-next Naming/ClassAndModuleCamelCase
|
||||
class FPDF_LIBRARY_CONFIG < FFI::Struct
|
||||
layout :version, :int,
|
||||
:m_pUserFontPaths, :pointer,
|
||||
@@ -95,7 +95,6 @@ class Pdfium
|
||||
:m_pPlatform, :pointer,
|
||||
:m_RendererType, :int
|
||||
end
|
||||
# rubocop:enable Naming/ClassAndModuleCamelCase
|
||||
|
||||
attach_function :FPDF_InitLibraryWithConfig, [:pointer], :void
|
||||
attach_function :FPDF_DestroyLibrary, [], :void
|
||||
@@ -234,7 +233,7 @@ class Pdfium
|
||||
typedef :int, :FPDF_BOOL
|
||||
typedef :pointer, :IPDF_JSPLATFORM
|
||||
|
||||
# rubocop:disable Naming/ClassAndModuleCamelCase
|
||||
# rubocop:disable-next Naming/ClassAndModuleCamelCase
|
||||
class FPDF_FORMFILLINFO_V2 < FFI::Struct
|
||||
layout :version, :int,
|
||||
:Release, :pointer,
|
||||
@@ -272,7 +271,6 @@ class Pdfium
|
||||
:FFI_OnFocusChange, :pointer,
|
||||
:FFI_DoURIActionWithKeyboardModifier, :pointer
|
||||
end
|
||||
# rubocop:enable Naming/ClassAndModuleCamelCase
|
||||
|
||||
attach_function :FPDFDOC_InitFormFillEnvironment, %i[FPDF_DOCUMENT pointer], :FPDF_FORMHANDLE
|
||||
attach_function :FPDFDOC_ExitFormFillEnvironment, [:FPDF_FORMHANDLE], :void
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
require 'puma/plugin'
|
||||
|
||||
# rubocop:disable Metrics
|
||||
# rubocop:disable-next Metrics
|
||||
Puma::Plugin.create do
|
||||
def start(launcher)
|
||||
return if ENV['LOCAL_REDIS_URL'].to_s.empty?
|
||||
@@ -68,4 +68,3 @@ Puma::Plugin.create do
|
||||
nil
|
||||
end
|
||||
end
|
||||
# rubocop:enable Metrics
|
||||
@@ -3,7 +3,7 @@
|
||||
require 'puma/plugin'
|
||||
require 'redis_client'
|
||||
|
||||
# rubocop:disable Metrics
|
||||
# rubocop:disable-next Metrics
|
||||
Puma::Plugin.create do
|
||||
def config(cfg)
|
||||
return if cfg.instance_variable_get(:@options)[:workers] <= 0
|
||||
@@ -73,4 +73,3 @@ Puma::Plugin.create do
|
||||
end
|
||||
end
|
||||
end
|
||||
# rubocop:enable Metrics
|
||||
@@ -32,7 +32,7 @@ module ReplaceEmailVariables
|
||||
|
||||
module_function
|
||||
|
||||
# rubocop:disable Metrics
|
||||
# rubocop:disable-next Metrics
|
||||
def call(text, submitter:, tracking_event_type: 'click_email', html_escape: false, sig: nil)
|
||||
text = replace(text, TEMPLATE_NAME, html_escape:) do
|
||||
(submitter.template || submitter.submission.template || submitter.submission).name
|
||||
@@ -94,7 +94,6 @@ module ReplaceEmailVariables
|
||||
|
||||
text.tr(ESCAPED_BRACES, '{}')
|
||||
end
|
||||
# rubocop:enable Metrics
|
||||
|
||||
def build_documents_links_text(submitter, sig = nil)
|
||||
url_options = build_url_options_for(submitter)
|
||||
|
||||
@@ -13,7 +13,7 @@ module SendWebhookRequest
|
||||
|
||||
module_function
|
||||
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
# rubocop:disable-next Metrics/AbcSize
|
||||
def call(webhook_url, event_uuid:, event_type:, record:, data:, attempt: 0)
|
||||
uri = parse_uri(webhook_url.url)
|
||||
|
||||
@@ -53,7 +53,6 @@ module SendWebhookRequest
|
||||
rescue Faraday::Error => e
|
||||
handle_error(webhook_event, attempt:, error_message: e.message&.truncate(100))
|
||||
end
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
|
||||
def parse_uri(url)
|
||||
URI(url)
|
||||
|
||||
@@ -14,7 +14,7 @@ module Submissions
|
||||
|
||||
module_function
|
||||
|
||||
# rubocop:disable Metrics
|
||||
# rubocop:disable-next Metrics
|
||||
def call(submission, submitters = nil, params = {}, with_events: true, with_documents: true, with_values: true,
|
||||
expires_at: Accounts.link_expires_at(Account.new(id: submission.account_id)))
|
||||
submitters ||= submission.submitters.preload(documents_attachments: :blob, attachments_attachments: :blob)
|
||||
@@ -62,7 +62,6 @@ module Submissions
|
||||
|
||||
json
|
||||
end
|
||||
# rubocop:enable Metrics
|
||||
|
||||
def build_status(submission, submitters)
|
||||
if submitters.any?(&:declined_at?)
|
||||
|
||||
@@ -21,7 +21,7 @@ module Submissions
|
||||
signature[:SubFilter] = :'ETSI.RFC3161'
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics
|
||||
# rubocop:disable-next Metrics
|
||||
def sign(io, byte_range)
|
||||
digest = OpenSSL::Digest.new(HASH_ALGORITHM)
|
||||
|
||||
@@ -59,7 +59,6 @@ module Submissions
|
||||
|
||||
OpenSSL::ASN1::GeneralizedTime.new(Time.now.utc).to_der
|
||||
end
|
||||
# rubocop:enable Metrics
|
||||
|
||||
def build_payload(digest)
|
||||
req = OpenSSL::Timestamp::Request.new
|
||||
|
||||
+1
-2
@@ -197,7 +197,7 @@ module Submitters
|
||||
end
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics
|
||||
# rubocop:disable-next Metrics
|
||||
def current_submitter_order?(submitter)
|
||||
submission = submitter.submission
|
||||
|
||||
@@ -228,7 +228,6 @@ module Submitters
|
||||
submitter.nil? || submitter.viewer? || submitter.completed_at?
|
||||
end
|
||||
end
|
||||
# rubocop:enable Metrics
|
||||
|
||||
def build_document_filename(submitter, blob, filename_format)
|
||||
return blob.filename.to_s if filename_format.blank?
|
||||
|
||||
@@ -19,7 +19,7 @@ module Submitters
|
||||
|
||||
module_function
|
||||
|
||||
# rubocop:disable Metrics
|
||||
# rubocop:disable-next Metrics
|
||||
def call(template, values, submitter_name: nil, role_names: nil, for_submitter: nil, throw_errors: false,
|
||||
add_fields: false, purpose: nil)
|
||||
fields =
|
||||
@@ -85,7 +85,6 @@ module Submitters
|
||||
|
||||
[normalized_values, attachments, new_fields]
|
||||
end
|
||||
# rubocop:enable Metrics
|
||||
|
||||
def normalize_value(field, value)
|
||||
if field['type'] == 'checkbox'
|
||||
|
||||
@@ -384,7 +384,7 @@ module Submitters
|
||||
end.exclude?(false)
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics
|
||||
# rubocop:disable-next Metrics
|
||||
def check_field_condition(condition, submitter_values, fields_uuid_index)
|
||||
value = submitter_values[condition['field_uuid']]
|
||||
field = fields_uuid_index[condition['field_uuid']]
|
||||
@@ -437,7 +437,6 @@ module Submitters
|
||||
true
|
||||
end
|
||||
end
|
||||
# rubocop:enable Metrics
|
||||
|
||||
def replace_default_variables(value, attrs, submission, with_time: false, field: nil)
|
||||
return value if value.in?([true, false]) || value.is_a?(Numeric) || value.is_a?(Array)
|
||||
|
||||
@@ -4,7 +4,7 @@ module Templates
|
||||
module ReplaceAttachments
|
||||
module_function
|
||||
|
||||
# rubocop:disable Metrics
|
||||
# rubocop:disable-next Metrics
|
||||
def call(template, params = {}, extract_fields: false)
|
||||
documents, = Templates::CreateAttachments.call(template, params, extract_fields:)
|
||||
submitter = template.submitters.first
|
||||
@@ -60,6 +60,5 @@ module Templates
|
||||
|
||||
documents
|
||||
end
|
||||
# rubocop:enable Metrics
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user