From f88f5a457cb95dc22519aa33b527a73f198e92e8 Mon Sep 17 00:00:00 2001 From: Daniel Colson Date: Tue, 3 Apr 2018 20:50:00 -0400 Subject: Add custom RuboCop for `assert_not` over `refute` Since at least cf4afc4 we have preferred `assert_not` methods over `refute` methods. I have seen plenty of comments in PRs about this, and we have tried to fix it a few times (5294ad8, e45f176, 8910f12, 41f50be, d4cfd54, 48a183e, and 211adb4), but the `refute` methods keep sneaking back in. This custom RuboCop will take care of enforcing this preference, so we don't have to think about it again. I suspect there are other similar stylistic preferences that could be solved with some custom RuboCops, so I will definitely keep my eyes open. `assert_not` over `assert !` might be a good candidate, for example. I wasn't totally sure if `ci/custom_cops` was the best place to put this, but nothing else seemed quite right. At one point I had it set up as a gem, but I think custom cops like this would have limited value in another context. I want to see how code climate handles the new cops before autocorrecting the existing violations. If things go as expected, I will push another commit with those corrections. --- ci/custom_cops/bin/test | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 ci/custom_cops/bin/test (limited to 'ci/custom_cops/bin') diff --git a/ci/custom_cops/bin/test b/ci/custom_cops/bin/test new file mode 100755 index 0000000000..495ffec83a --- /dev/null +++ b/ci/custom_cops/bin/test @@ -0,0 +1,5 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +COMPONENT_ROOT = File.expand_path("..", __dir__) +require_relative "../../../tools/test" -- cgit v1.2.3