Skip to content

CPP: Autoformat some untidy files#744

Merged
jbj merged 5 commits into
github:masterfrom
geoffw0:format
Jan 14, 2019
Merged

CPP: Autoformat some untidy files#744
jbj merged 5 commits into
github:masterfrom
geoffw0:format

Conversation

@geoffw0
Copy link
Copy Markdown
Contributor

@geoffw0 geoffw0 commented Jan 10, 2019

Auto-format some untidy CPP QL. This was mainly a learning exercise, I don't intend to make a deliberate attempt to continue this process with more files.

I had to make one manual correction (two comments that had been jammed together by the autoformatter), and there were some other files I tried this on that I wasn't satisfied with. I'm quite sure how much of this is due to glitches in the autoformatter, and how much is just stylistic differences I'm not used to yet.

@geoffw0 geoffw0 added the C++ label Jan 10, 2019
@geoffw0 geoffw0 requested a review from a team as a code owner January 10, 2019 16:36
@@ -11,6 +11,7 @@
import cpp

// See also InitialisationNotRun.ql and GlobalUseBeforeInit.ql
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this was a multi-line /* .. */ comment it would get the extra newline after it. Generally the autoformatter expects toplevel comments to be of the form /* .. */ and in-predicate comments to be // ....

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally tend to use // for most comments, unless either (1) it's going to be many lines or (2) I want to finish it before the end of the line. Of course use of qldoc comments /** .. */ frequently overrides this preference.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(in this case I believe the comments were originally written by someone else)

Comment thread cpp/ql/src/Critical/NotInitialised.ql Outdated

// See also InitialisationNotRun.ql and GlobalUseBeforeInit.ql

// Holds if s defines variable v (conservative)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ought to be qldoc, btw.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Updated.

Copy link
Copy Markdown
Contributor

@jbj jbj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement. @geoffw0 if you upgrade QL4E to the latest internal build and format these files again, it'll normalise parentheses. I don't know if you'll like that, but it should at least pull in the direction of consistency.

@jbj jbj merged commit 08db4cd into github:master Jan 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants