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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
linting hash value and complexity
ulfertsb1d83fb119d7
diff --git a/app/contracts/work_packages/base_contract.rb b/app/contracts/work_packages/base_contract.rbindex 4d2212faa73..ca623df39b0 100644--- a/app/contracts/work_packages/base_contract.rb+++ b/app/contracts/work_packages/base_contract.rb@@ -205,7 +205,7 @@ module WorkPackagesdef validate_enabled_type# Checks that the issue can not be added/moved to a disabled type- if type_context_changed? && !model.project.types.include?(model.type)+ if type_context_changed? && model.project.types.exclude?(model.type)errors.add :type_id, :inclusionendend@@ -313,9 +313,7 @@ module WorkPackagesenddef validate_duration_matches_dates- return unless model.start_date && model.due_date && model.duration-- calculated_duration = model.due_date - model.start_date + 1+ return unless calculated_duration && model.durationif calculated_duration > model.durationerrors.add :duration, :smaller_than_dates@@ -343,7 +341,7 @@ module WorkPackagesenddef principal_visible?(id, list)- list.exists?(id: id)+ list.exists?(id:)enddef start_before_soonest_start?@@ -364,7 +362,7 @@ module WorkPackagesenddef category_not_of_project?- model.category && !model.project.categories.include?(model.category)+ model.category && model.project.categories.exclude?(model.category)enddef status_changed?@@ -434,5 +432,11 @@ module WorkPackagesdef already_in_readonly_status?model.readonly_status? && !model.status_id_changeend++ def calculated_duration+ return nil unless model.due_date && model.start_date++ model.due_date - model.start_date + 1+ endendend