Project

General

Profile

Feature #44396 » 0001-Fix-the-RuboCop-offenses-in-lib-redmine-export-pdf.r.patch

Go MAEDA, 2026-08-29 07:50

View differences:

.rubocop_todo.yml
# ForbiddenIdentifiers: __id__, __send__
Naming/MethodName:
Exclude:
- 'lib/redmine/export/pdf.rb'
- 'lib/redmine/scm/adapters/cvs_adapter.rb'
- 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
- 'test/helpers/application_helper_test.rb'
......
- 'app/models/user.rb'
- 'app/models/version.rb'
- 'config/initializers/10-patches.rb'
- 'lib/redmine/export/pdf.rb'
- 'lib/redmine/menu_manager.rb'
- 'lib/redmine/plugin.rb'
- 'lib/redmine/wiki_formatting/textile/formatter.rb'
......
- 'app/helpers/repositories_helper.rb'
- 'app/models/query.rb'
- 'db/migrate/022_serialize_possibles_values.rb'
- 'lib/redmine/export/pdf.rb'
- 'lib/redmine/field_format.rb'
- 'lib/redmine/scm/adapters/abstract_adapter.rb'
- 'lib/redmine/scm/adapters/bazaar_adapter.rb'
......
Exclude:
- 'app/controllers/admin_controller.rb'
- 'lib/redmine/configuration.rb'
- 'lib/redmine/export/pdf.rb'
- 'lib/redmine/wiki_formatting.rb'
- 'lib/redmine/wiki_formatting/textile/redcloth3.rb'
- 'test/unit/default_data_test.rb'
lib/redmine/export/pdf.rb
module Redmine
module Export
module PDF
# The camel cased methods below follow the RBPDF API and cannot be renamed.
# rubocop:disable-next Naming/MethodName
class ITCPDF < RBPDF
include Redmine::I18n
attr_accessor :footer_date
......
style.delete!('I') if family.to_s.casecmp('dejavusansmono') == 0
super
end
alias_method :set_font, :SetFont
alias set_font SetFont
def fix_text_encoding(txt)
RDMPdfEncoding::rdm_from_utf8(txt, "UTF-8")
RDMPdfEncoding.rdm_from_utf8(txt, "UTF-8")
end
def formatted_text(text)
......
if atta
return atta.diskfile
# rubocop:disable Lint/DuplicateBranch
elsif %r{/attachments/download/(?<id>[^/]+)/} =~ attrname and
atta = @attachments.find{|a| a.id.to_s == id} and
atta.readable? and atta.visible?
elsif %r{/attachments/download/(?<id>[^/]+)/} =~ attrname &&
(atta = @attachments.find{|a| a.id.to_s == id}) &&
atta.readable? && atta.visible?
return atta.diskfile
# rubocop:enable Lint/DuplicateBranch
elsif %r{/attachments/thumbnail/(?<id>[^/]+)/(?<size>\d+)} =~ attrname and
atta = @attachments.find{|a| a.id.to_s == id} and
atta.readable? and atta.visible?
elsif %r{/attachments/thumbnail/(?<id>[^/]+)/(?<size>\d+)} =~ attrname &&
(atta = @attachments.find{|a| a.id.to_s == id}) &&
atta.readable? && atta.visible?
return atta.thumbnail(size: size)
else
return nil
......
end
def get_sever_url(url)
if !empty_string(url) and url.start_with?('/')
if !empty_string(url) && url.start_with?('/')
Setting.host_name.split('/')[0] + url
else
url
(1-1/2)