We're trying to update our style guide (using google's guide as a starting point) and I'm currently in the middle of a debate with my colleagues about column limits. I believe we're all in agreement that they're generally a good thing, however I'm upset that a string (or simple string template) assignment would necessarily be split (with concatenation operators and new lines) if we enforced this style rule.
For example, I have a simple string assignment for a feedback message that is ~250 characters long which would now get broken up into several lines. I am of the opinion that any modern editors with word-wrap should handle this fine, and the result would actually be more readable. Some thoughts to consider:
- Enforcing this means we would be adding unnecessary (some may say trivial) run-time operations, but I can't help but feel that things like these add up.
- Adding
" + [line break][indent]"
in the middle of a long string is IMO more detrimental to readability than just letting it continue on and word wrap. - Long string assignments such as my feedback message I feel resemble more closely books, emails, or news articles, rather than loops, conditionals, and function calls. Most places that deal with natural language (not code) on a screen don't enforce maximum line lengths, they just word-wrap and the scroll bar gets shorter or longer.
- Is it worth making an exception on lines where the last item is a long string?
- Should long strings (or strings in general) be moved off into a separate file/directory, where this particular rule is not enforced? (Such as is the case for some internationalization translation files)
Is there a general consensus on this topic, or is it just not worth debating and I should move on to "more important" things? Am I in the minority by thinking this way?