diff --git a/.rubocop.yml b/.rubocop.yml index 3d6578618..642d2073d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -27,9 +27,6 @@ Documentation: Style/Semicolon: AllowAsExpressionSeparator: true -Style/RedundantReturn: - Enabled: false - Style/ClassAndModuleChildren: Enabled: false diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f44dba58..8091de06b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Added flag to mail reports - Enabled AndOr rubocop style - Enabled BlockNesting rubocop metric +- Enabled RedundantReturn rubocop style ### Changed - Move users/form from projects to teams diff --git a/app/controllers/concerns/sidebar_controller.rb b/app/controllers/concerns/sidebar_controller.rb index fe2a9cbb4..55cebe3f8 100644 --- a/app/controllers/concerns/sidebar_controller.rb +++ b/app/controllers/concerns/sidebar_controller.rb @@ -7,7 +7,7 @@ def define_sidebar(sidebar) end def sidebar - return @sidebar + @sidebar end end end diff --git a/lib/tasks/i18n_missing_keys.rake b/lib/tasks/i18n_missing_keys.rake index 7439fa365..c2a575265 100644 --- a/lib/tasks/i18n_missing_keys.rake +++ b/lib/tasks/i18n_missing_keys.rake @@ -43,7 +43,7 @@ class MissingKeysFinder end output_missing_keys(missing_keys) - return missing_keys + missing_keys end def add_missing_key(missing_keys, key, locale, skip) @@ -75,18 +75,18 @@ class MissingKeysFinder end def collect_keys(scope, translations) - full_keys = [] - translations.to_a.each do |key, translation| - next if translation.nil? - - new_scope = scope.dup << key - if translation.is_a?(Hash) - full_keys += collect_keys(new_scope, translation) - else - full_keys << new_scope.join('.') + [].tap do |full_keys| + translations.to_a.each do |key, translation| + next if translation.nil? + + new_scope = scope.dup << key + if translation.is_a?(Hash) + full_keys += collect_keys(new_scope, translation) + else + full_keys << new_scope.join('.') + end end end - return full_keys end # Returns true if key exists in the given locale