Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

fix rubocop issues

Klaus Zanders3f20102c7be7
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 2823f88bb3b..7e518aa26ae 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -53,7 +53,7 @@ class ProjectsController < ApplicationController
:projects
end
- def index # rubocop:disable Format/AbcSize
+ def index # rubocop:disable Metrics/AbcSize
respond_to do |format|
format.html do
flash.now[:error] = @query.errors.full_messages if @query.errors.any?
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index b1d7ae1942c..2b962ae3107 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -29,13 +29,13 @@
require "digest/md5"
class Attachment < ApplicationRecord
- enum status: {
+ enum :status, {
uploaded: 0,
prepared: 1,
scanned: 2,
quarantined: 3,
rescan: 4
- }.freeze, _prefix: true
+ }, prefix: true
belongs_to :container, polymorphic: true
belongs_to :author, class_name: "User"
diff --git a/app/models/ldap_auth_source.rb b/app/models/ldap_auth_source.rb
index d6cd746c2ac..3a7b2ccce40 100644
--- a/app/models/ldap_auth_source.rb
+++ b/app/models/ldap_auth_source.rb
@@ -46,11 +46,11 @@ class LdapAuthSource < ApplicationRecord
prepend ::Mixins::UniqueFinder
- enum tls_mode: {
+ enum :tls_mode, {
plain_ldap: 0,
simple_tls: 1,
start_tls: 2
- }.freeze, _default: :start_tls
+ }, default: :start_tls
validates :tls_mode, inclusion: { in: tls_modes.keys }
validates :host, :port, :attr_login, presence: true
diff --git a/app/models/notification.rb b/app/models/notification.rb
index 65dff4c23ab..fdb4dad1293 100644
--- a/app/models/notification.rb
+++ b/app/models/notification.rb
@@ -43,8 +43,7 @@ class Notification < ApplicationRecord
shared: 12
}.freeze
- enum reason: REASONS,
- _prefix: true
+ enum :reason, REASONS, _prefix: true
belongs_to :recipient, class_name: "User"
belongs_to :actor, class_name: "User"
diff --git a/app/models/principal.rb b/app/models/principal.rb
index 20a0b51e10a..e8d1a444872 100644
--- a/app/models/principal.rb
+++ b/app/models/principal.rb
@@ -31,12 +31,12 @@ class Principal < ApplicationRecord
# Account statuses
# Disables enum scopes to include not_builtin (cf. Principals::Scopes::Status)
- enum status: {
+ enum :status, {
active: 1,
registered: 2,
locked: 3,
invited: 4
- }.freeze, _scopes: false
+ }, scopes: false
self.table_name = "#{table_name_prefix}users#{table_name_suffix}"
diff --git a/app/models/project.rb b/app/models/project.rb
index cb377c6b5ad..f2078192f3c 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -174,7 +174,7 @@ class Project < ApplicationRecord
scopes :activated_time_activity,
:visible_with_activated_time_activity
- enum status_code: {
+ enum :status_code, {
on_track: 0,
at_risk: 1,
off_track: 2,
diff --git a/app/models/query/timelines.rb b/app/models/query/timelines.rb
index 6b445283418..00076b708f9 100644
--- a/app/models/query/timelines.rb
+++ b/app/models/query/timelines.rb
@@ -30,7 +30,7 @@ module Query::Timelines
extend ActiveSupport::Concern
included do
- enum timeline_zoom_level: { days: 0, weeks: 1, months: 2, quarters: 3, years: 4, auto: 5 }
+ enum :timeline_zoom_level, { days: 0, weeks: 1, months: 2, quarters: 3, years: 4, auto: 5 }
validates :timeline_zoom_level, inclusion: { in: timeline_zoom_levels.keys }
serialize :timeline_labels, type: Hash