#240 Whitespace formatting

Future
closed
nobody
Check (274)
5
2015-10-22
2003-07-11
Tim Tyler
No

While there are RFEs for blank lines and indentation,
there isn't yet one for generic formatting of whitespace.

Unwanted spaces have a way of creeping in during copy
and paste operations - and it is easy to omit hitting the
space bar.

Checkstyle can act as a complement to code formatting
tools - indicating when they need to be applied.

Most formatters can be configured to control the
number of blank spaces before and after various
constructs - and I think Checkstyle should be able
to check for the same sorts of thing.

As an example to start with, one obvious check
in this area is a:
"MaximumNumberOfConsecutiveSpaces" check.

Most formatters are inclined to swallow up multiple
consecutive spaces.

I think this check should be applied outside comments
and should ignore spaces at the beginnings of lines.
That puts it outside the capabilities of the existing
generic regexp check - though it may be possible to
implement in that way in the future.

The next most obvious checks in this area seem to me
to be:
"NumberOfSpacesBeforeToken" and
"NumberOfSpacesAfterToken".

One slight complication here is that these checks
would probably be best disabled if the token
occurs at the very start or end of a line - but otherwise
implementation appears straightforward.

Discussion

  • Roman Ivanov

    Roman Ivanov - 2015-10-22
    • status: open --> closed
    • Group: --> Future
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks