From f4ffee37001c34af85b1ecc19078f17be99bf72e Mon Sep 17 00:00:00 2001 From: taitus Date: Thu, 13 Feb 2025 16:06:05 +0100 Subject: [PATCH] Add and apply Lint/RedundantSafeNavigation RuboCop rule We've tested the updated behavior in RuboCop 1.69, found a new offense, and corrected it. --- .rubocop.yml | 3 +++ app/controllers/legislation/annotations_controller.rb | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index 0747bb2e7..2fa6f89b3 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -311,6 +311,9 @@ Lint/NonAtomicFileOperation: Lint/ParenthesesAsGroupedExpression: Enabled: true +Lint/RedundantSafeNavigation: + Enabled: true + Lint/RedundantStringCoercion: Enabled: true diff --git a/app/controllers/legislation/annotations_controller.rb b/app/controllers/legislation/annotations_controller.rb index ccc577320..f7289d9ff 100644 --- a/app/controllers/legislation/annotations_controller.rb +++ b/app/controllers/legislation/annotations_controller.rb @@ -101,7 +101,7 @@ class Legislation::AnnotationsController < Legislation::BaseController def convert_ranges_parameters annotation = params[:legislation_annotation] - if annotation && annotation[:ranges]&.is_a?(String) + if annotation && annotation[:ranges].is_a?(String) params[:legislation_annotation][:ranges] = JSON.parse(annotation[:ranges]) end rescue JSON::ParserError