From 86519996f91992b8c6bcb58eb32544e06a2eea38 Mon Sep 17 00:00:00 2001 From: fatkodima Date: Wed, 20 Jul 2022 22:25:23 +0300 Subject: [PATCH] Enable `Style/RedundantCondition` cop --- .rubocop.yml | 4 ++++ .../connection_adapters/postgresql/schema_statements.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index 5bbdd114470..81bd763e059 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -266,6 +266,10 @@ Style/ColonMethodCall: Style/TrivialAccessors: Enabled: true +# Prefer a = b || c over a = b ? b : c +Style/RedundantCondition: + Enabled: true + Performance/BindCall: Enabled: true diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb index 6ea900c9a24..89446d78cf7 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb @@ -297,7 +297,7 @@ module ActiveRecord end end - query_value("SELECT setval(#{quote(quoted_sequence)}, #{max_pk ? max_pk : minvalue}, #{max_pk ? true : false})", "SCHEMA") + query_value("SELECT setval(#{quote(quoted_sequence)}, #{max_pk || minvalue}, #{max_pk ? true : false})", "SCHEMA") end end