Add new functionality to File.comment() and improve logic flow.

Review Request #11549 — Created March 23, 2021 and submitted — Latest diff uploaded

Information

ReviewBot
release-3.0.x

Reviewers

A couple of tools tack on column information and error codes in their
own way, without there being any consistency between the approaches.
Most completely throw out this information.

This attempts to add some consistency by adding error_code and
start_column parameters to File.comment(). This will modify the
text, appending column and error code information.

While in there, I've fixed up the flow of logic to avoid setting or
computing state that won't be used (for instance, line information when
we know we won't be commenting on any lines).

Unit tests were added for all file commenting conditions.

Unit tests pass on Python 2.7 and 3.x.

Commits

Files