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

Make rubocop happier

Christophe Bliardfa83a52657e7
diff --git a/app/services/work_packages/set_attributes_service/pre_14_4_derive_progress_values.rb b/app/services/work_packages/set_attributes_service/pre_14_4_derive_progress_values.rb
index 852dcb7abd8..a1766f16c60 100644
--- a/app/services/work_packages/set_attributes_service/pre_14_4_derive_progress_values.rb
+++ b/app/services/work_packages/set_attributes_service/pre_14_4_derive_progress_values.rb
@@ -26,6 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
+# rubocop:disable Metrics/AbcSize
class WorkPackages::SetAttributesService
class Pre144DeriveProgressValues
attr_reader :work_package
@@ -148,7 +149,7 @@ class WorkPackages::SetAttributesService
# on the computation of it derived from the status's default done ratio
# and the estimated hours. If the estimated hours are unset, then also
# unset the remaining hours.
- # rubocop:disable Metrics/AbcSize,Metrics/PerceivedComplexity
+ # rubocop:disable Metrics/PerceivedComplexity
def update_remaining_hours
if WorkPackage.use_status_for_done_ratio?
update_remaining_hours_from_percent_complete
@@ -166,7 +167,7 @@ class WorkPackages::SetAttributesService
end
end
end
- # rubocop:enable Metrics/AbcSize,Metrics/PerceivedComplexity
+ # rubocop:enable Metrics/PerceivedComplexity
def estimated_hours_from_done_ratio_and_remaining_hours
remaining_ratio = 1.0 - ((work_package.done_ratio || 0) / 100.0)
@@ -182,3 +183,4 @@ class WorkPackages::SetAttributesService
end
end
end
+# rubocop:enable Metrics/AbcSize
diff --git a/spec/contracts/work_packages/base_contract_pre_14_4_without_percent_complete_edition_spec.rb b/spec/contracts/work_packages/base_contract_pre_14_4_without_percent_complete_edition_spec.rb
index 95d78a84c44..73c7c7d24b2 100644
--- a/spec/contracts/work_packages/base_contract_pre_14_4_without_percent_complete_edition_spec.rb
+++ b/spec/contracts/work_packages/base_contract_pre_14_4_without_percent_complete_edition_spec.rb
@@ -235,7 +235,7 @@ RSpec.describe WorkPackages::BaseContract, "pre 14.4 without percent complete ed
# Breaking abstraction here to avoid mocking hell.
# We might want to extract the assignable_... into separate
# objects.
- allow(contract)
+ allow(contract) # rubocop:disable RSpec/SubjectStub
.to receive(:new_statuses_allowed_from)
.with(work_package.status)
.and_return(new_statuses_scope)