Skip to content

Commit

Permalink
Update RuboCop target version
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-kephart committed Dec 8, 2023
1 parent 96d52af commit e6aa0db
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ AllCops:
- /**/vendor/**/* # Exclude downloaded gem code in CI
NewCops: disable
SuggestExtensions: false
TargetRubyVersion: 2.7
TargetRubyVersion: 3.0

Lint/MissingSuper:
Enabled: false
Expand Down
10 changes: 4 additions & 6 deletions app/apps/plugins/front_cache/admin_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ def settings
end

def save_settings
current_site.set_meta('front_cache_elements', { paths: ((params[:cache][:paths] || []).delete_if do |a|
!a.present?
end || []),
posts: (params[:cache][:posts] || []),
post_types: (params[:cache][:post_type] || []),
skip_posts: (params[:cache][:skip_posts] || []),
current_site.set_meta('front_cache_elements', { paths: (params[:cache][:paths] || []).compact_blank || [],
posts: params[:cache][:posts] || [],
post_types: params[:cache][:post_type] || [],
skip_posts: params[:cache][:skip_posts] || [],
cache_login: params[:cache][:cache_login],
home: params[:cache][:home],
preserve_cache_on_restart: params[:cache][:preserve_cache_on_restart],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ def add_items
end

if params[:custom_items].present? # custom menu items
params[:custom_items].each do |_index, item|
params[:custom_items].each_value do |item|
type = item['kind'].present? ? item['kind'] : 'external'
item = @nav_menu.append_menu_item({ label: item['label'], link: item['url'], type: type })
items << item
end
end

if params[:items].present?
params[:items].each do |_index, item|
params[:items].each_value do |item|
item = @nav_menu.append_menu_item({ label: 'auto', link: item['id'], type: item['kind'] })
items << item
end
Expand Down
4 changes: 2 additions & 2 deletions app/decorators/camaleon_cms/post_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def the_thumb_url(default = nil)
if th.present?
th
else
(default || object.post_type.get_option('default_thumb',
nil) || h.asset_url('camaleon_cms/image-not-found.png'))
default || object.post_type.get_option('default_thumb',
nil) || h.asset_url('camaleon_cms/image-not-found.png')
end
end
alias the_image_url the_thumb_url
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/camaleon_cms/html_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ def cama_draw_pre_asset_contents
def cama_draw_custom_assets
cama_html_helpers_init unless @_assets_libraries.present?
libs = []
@_assets_libraries.each do |_key, assets|
@_assets_libraries.each_value do |assets|
libs += assets[:css] if assets[:css].present?
end
stylesheets = libs.uniq
css = stylesheet_link_tag(*stylesheets, media: 'all')

libs = []
@_assets_libraries.each do |_key, assets|
@_assets_libraries.each_value do |assets|
libs += assets[:js] if assets[:js].present?
end
javascripts = libs.uniq
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/camaleon_cms/short_code_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def shortcodes_init
return args[:shortcode] unless attrs.present?

cama_load_libraries(*attrs['data'].to_s.split(','))
return ''
''
},
"Permit to load libraries on demand, sample: [load_libraries data='datepicker,tinymce']")

Expand Down
2 changes: 1 addition & 1 deletion app/helpers/camaleon_cms/uploader_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def upload_file(uploaded_io, settings = {})
generate_thumb: true,
temporal_time: 0,
filename: begin
(cached_name || uploaded_io.original_filename)
cached_name || uploaded_io.original_filename
rescue StandardError
uploaded_io.path.split('/').last
end.cama_fix_filename,
Expand Down
2 changes: 1 addition & 1 deletion app/models/camaleon_cms/site.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def get_theme_slug
# return theme model with slug theme_slug for this site
# theme_slug: (optional) if it is null, this will return current theme for this site
def get_theme(theme_slug = nil)
themes.where(slug: (theme_slug || get_theme_slug), status: nil).first_or_create!
themes.where(slug: theme_slug || get_theme_slug, status: nil).first_or_create!
end

# return plugin model with slug plugin_slug
Expand Down
4 changes: 2 additions & 2 deletions app/models/concerns/camaleon_cms/custom_fields_read.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def get_field_values(_key, group_number = 0)
# puts res[0]['my_slug1'].first ==> "val 1"
def get_fields_grouped(field_keys)
res = []
custom_field_values.where(custom_field_slug: field_keys).order(group_number: :asc).group_by(&:group_number).each do |_group_number, group_fields|
custom_field_values.where(custom_field_slug: field_keys).order(group_number: :asc).group_by(&:group_number).each_value do |group_fields|
group = {}
field_keys.each do |field_key|
_tmp = []
Expand Down Expand Up @@ -243,7 +243,7 @@ def set_field_values(datas = {})

ActiveRecord::Base.transaction do
custom_field_values.delete_all
datas.each do |_index, fields_data|
datas.each_value do |fields_data|
fields_data.each do |field_key, values|
next unless values[:values].present?

Expand Down
2 changes: 1 addition & 1 deletion app/views/camaleon_cms/default_theme/sitemap.xml.builder
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ xml.urlset 'xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9' do
end
end

@r[:custom].each do |_key, item|
@r[:custom].each_value do |item|
xml.url do
xml.loc item[:url]
xml.lastmod item[:lastmod] || Date.today.to_s
Expand Down
2 changes: 1 addition & 1 deletion lib/ext/hash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def to_attr_url_format

# used for hash of objects
def find_by(val, attr = 'id')
each do |_key, p|
each_value do |p|
return p if p[attr].to_s == val.to_s
end
nil
Expand Down

0 comments on commit e6aa0db

Please sign in to comment.