Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-5184

Remove check style restriction on brackets for one-line statements

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.8.0
    • None
    • None
    • None

    Description

      Drill's build currently enforces a check style rule that all control statements must have brackets. For example:

      if (true)
        doSomething();
      

      is perfectly valid Java: the construct with well-known semantics inherited from C.

      However, check style rejects the above. It must be:

      if (true) {
        doSomething();
        }
      

      Is this a good rule? Possibly. It may prevent the occasional bug. The real question is: is the benefit worth the cost? What is the cost? The cost is that developers tend to write legal Java code, do a build, wait for the build to fail, then must go back and fix code. The cost is thus x% of builds must be redone for trivial errors in check-style rules. In my own case, about half of builds fail because I'm in the habit of writing valid Java, not Drill-specific java...

      So, the question is, is the savings derived from avoiding some hypothetical bug worth the very real cost of reducing developer productivity?

      At the very least, make check-style issues into warnings to be ignored in development builds, cleaned up when preparing code for a PR.

      Attachments

        Activity

          People

            Unassigned Unassigned
            paul-rogers Paul Rogers
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: