tailor icon indicating copy to clipboard operation
tailor copied to clipboard

Tailor disabling violations within source code is all or nothing

Open danimal opened this issue 8 years ago • 1 comments

Tailor Version: v0.10.0

Swift Version: Apple Swift version 2.2 (swiftlang-703.0.18.8 clang-703.0.31)

Platform (Mac/Linux/Windows/CI): Mac

Installation Method: Homebrew

Steps to Reproduce Issue

  1. Disable Tailor checking for a part of code with // tailor:off and // tailor:on(alternately use a single line comment at the end with // tailor:disable)
  2. All Tailor checks are disabled between the off and on or for the disable line.

Expected Behavior

Only specific checks would be disabled using code comments

Actual Behavior

All Tailor checks are disabled using code comments, limiting the effectiveness of commenting in code to disable checks. For example, using the clang compiler with Objective C a person can turn off specific checks with #pragma marks like so:

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-variable"

int a;

#pragma clang diagnostic pop

I would love to see something like this for Tailor where specific rules can be disabled:

// tailor:off upper-camel-case
class someName {

}
// tailor:on

or inline with disable:

func AnyFunctionCall() { // tailor:disable lower-camel-case
}

This way you can target very specifically the rules to exclude. This would also make sure if a line violated two or more rules the non-excluded rules would be reported too.

danimal avatar Aug 05 '16 20:08 danimal

Hey @danimal! We agree that this would be a really useful feature for Tailor, but we’re limited on bandwidth right now so we would appreciate contributions to implement it :)

adityatrivedi avatar Oct 05 '16 06:10 adityatrivedi