This is an archive of the discontinued LLVM Phabricator instance.

[NFC] Tidy up spelling, grammar, and inconsistencies in clang-tidy documentation
ClosedPublic

Authored by salman-javed-nz on Oct 22 2021, 8:27 PM.

Details

Summary
  • Fix spelling and grammatical mistakes found across the .rst files.
  • Standardize to US English spelling for words such as "behavior" and "specialization".
  • Remove repeated words, e.g. "for a a larger user input".
  • Standardize spelling of "e.g." and "i.e."
  • Replace curly quote characters (‘ ’ “ ”) with standard straight ones (' "). Replace en-dash () with standard hyphen (-). In both cases, the latter is used more often in the doc files and is easier to type.
  • Change double spaces after commas and periods to single space.
  • Ensure there is a empty line at the end of each .rst file.

Diff Detail

Event Timeline

salman-javed-nz requested review of this revision.Oct 22 2021, 8:27 PM
salman-javed-nz updated this revision to Diff 381701.

Change double spaces after commas and periods to single space.

Replace curly quote characters (‘ ’ “ ”) with standard straight ones (' ").
Replace en-dash () with standard hyphen (-).
In both cases, the latter is used more often in the doc files and is easier to type.

Standardize spelling of "e.g." and "i.e."

Remove repeated words, e.g. "for a a larger user input".

Standardize to US English spelling for words such as "behavior" and "specialization".

Fix spelling and grammatical mistakes found across the .rst files.

// end of patch

salman-javed-nz added a comment.EditedOct 22 2021, 8:35 PM

A collection of minor corrections that I don't think deserve separate commits.

It shouldn't take much congitive load to review it all as one patch.
In any case, I have used Phabricator's "Update Revision" feature to break out the change into smaller chunks, so you can easily see the changes at each stage.

Pre-merge checks failing because patch cannot be applied.
Therefore recreating patch to fix this.

kazu accepted this revision.Oct 22 2021, 11:35 PM

LGTM. Thanks for fixing the docs!

This revision is now accepted and ready to land.Oct 22 2021, 11:35 PM

Thanks for the review.
Are you able to commit for me?

Salman Javed <mail@salmanjaved.org>

Thank you very much.

This revision was landed with ongoing or failed builds.Oct 23 2021, 12:07 AM
This revision was automatically updated to reflect the committed changes.

Awesome @salman-javed-nz , thanks for fixing the docs! May I ask how did you create these "smaller commits"? It's very nice to click on each of them and see only what changed. I believe I followed your same procedure (use the "Update Revision" thingy) but it always displays the full commit with all changes, so it's hard to see what each new update did.

Awesome @salman-javed-nz , thanks for fixing the docs! May I ask how did you create these "smaller commits"? It's very nice to click on each of them and see only what changed. I believe I followed your same procedure (use the "Update Revision" thingy) but it always displays the full commit with all changes, so it's hard to see what each new update did.

I created a patch for each my commits on my local disk like so:

git show HEAD -U999999 > HEAD.patch
git show HEAD~1 -U999999 > HEAD~1.patch
git show HEAD~2 -U999999 > HEAD~2.patch
  (and so on...)

I uploaded them one by one through Phab's web interface. This process is just something I stumbled though myself that worked for me.

I wouldn't be surprised if arcanist has something that makes this easier, but I don't use it so I wouldn't know.

Definitely an improvement! I looked at all the changed places and found some more improvements you can make. I don't need to see this again, though.

The only disimprovement I found was "Jaro–Winkler" becoming "Jaro-Winkler".

clang-tools-extra/docs/clang-tidy/Contributing.rst
444–445

Naïve grammar fix:

It may also be necessary to restrict the header files from which warnings are displayed using the ``-header-filter`` flag.

But, better, active-voice fix:

You can also use the ``-header-filter`` flag to silence warnings from certain header files.
clang-tools-extra/docs/clang-tidy/checks/abseil-no-internal-dependencies.rst
9

What is "you mention it"? Should this just say "mention it"? but even then, I don't know the technical definition of "mention" in this context.

clang-tools-extra/docs/clang-tidy/checks/android-cloexec-pipe2.rst
6–7

Should pipe2() and O_CLOEXEC be double-backticked here? I think so.

clang-tools-extra/docs/clang-tidy/checks/boost-use-to-string.rst
10

s/floating points/floating-point types/

clang-tools-extra/docs/clang-tidy/checks/bugprone-easily-swappable-parameters.rst
122

s/variants/variants,/

157

This letter is at the beginning of a sentence, so E.g. is correct. Arguably. It is a sentence fragment. ;)
Perhaps:

The heuristics suppress the easily-swappable-parameters warning for pairs of parameters that:
* Are used together in the same expression, such as ``f(a, b)`` or ``a < b``.
* Are passed in the same argument position to the same function, such as ``f(a, 1)`` and ``f(b, 1)``, as long as both of those expressions call the same overload ``f(SomeT, int)``.

This section definitely needs better examples.

clang-tools-extra/docs/clang-tidy/checks/bugprone-implicit-widening-of-multiplication-result.rst
11

This is useful mainly when

clang-tools-extra/docs/clang-tidy/checks/bugprone-not-null-terminated-result.rst
64

Here and line 68: "is could be safe" doesn't make sense, but I'm not sure what is meant. My guess is that the writer is trying to refer to a set of functions, the "could-be-safe functions," like:

If we're in C++, and the new function is a could-be-safe function, and the destination array is...

but I haven't found whether the notion of "could-be-safe" functions is actually defined anywhere.

clang-tools-extra/docs/clang-tidy/checks/bugprone-suspicious-string-compare.rst
17
Checks that the results of comparison functions (e.g. ``strcmp``) are...
clang-tools-extra/docs/clang-tidy/checks/bugprone-too-small-loop-variable.rst
28–29
The ``doSomething`` function works for ``items.size() < 32767``, but has undefined behavior for larger vectors.

Also, const std::vector& needs to be const std::vector<int>&; CTAD isn't allowed on function parameters.

clang-tools-extra/docs/clang-tidy/checks/concurrency-mt-unsafe.rst
15

Sentence-initial letter should be capitalized. Again, sentence fragment.

Note that using some thread-unsafe functions may be still valid in
concurrent programming if only a single thread is used; for example, ``setenv(3)``.
However, some functions may track global state which
would be clobbered by subsequent (non-parallel, but concurrent) calls to
a related function. For example, the following code suffers from unprotected
accesses to global state:
clang-tools-extra/docs/clang-tidy/checks/hicpp-signed-bitwise.rst
7

implementation-defined

clang-tools-extra/docs/clang-tidy/checks/misc-throw-by-value-catch-by-reference.rst
19

Unicode

clang-tools-extra/docs/clang-tidy/checks/modernize-loop-convert.rst
139

pair. The function

142

s/ranges::reverse_view/std::views::reverse/
C++20 ranges::reverse_view is not a function, and won't (quite) do the right thing (compared to views::reverse) if you pass it something that's already reversed.

clang-tools-extra/docs/clang-tidy/checks/modernize-replace-disallow-copy-and-assign-macro.rst
17

s/a code/code/

clang-tools-extra/docs/clang-tidy/checks/modernize-use-auto.rst
119

s/improving/to improve/ here and line 152

clang-tools-extra/docs/clang-tidy/checks/openmp-use-default-none.rst
21

clause; no diagnostic. ?

clang-tools-extra/docs/clang-tidy/checks/readability-magic-numbers.rst
12–13
* `C++ Core Guideline ES.45: Avoid "magic constants"; use symbolic constants <https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-magic>`_
* `High Integrity C++ Rule 5.1.1: Use symbolic names instead of literal values in code <http://www.codingstandard.com/rule/5-1-1-use-symbolic-names-instead-of-literal-values-in-code/>`_
clang-tools-extra/docs/clang-tidy/checks/readability-suspicious-call-argument.rst
115

Here, "Jaro–Winkler" is correct and "Jaro-Winkler" is wrong.
Ditto "Sørensen–Dice" below.
If there's a markdown equivalent, that still renders an en-dash –, and you want to use that instead, OK. But just changing the punctuation to an ASCII hyphen-dash isn't right. (I notice you didn't change Sørensen to Sorensen, so the goal definitely wasn't a pure ASCII-fication of these files.)

Definitely an improvement! I looked at all the changed places and found some more improvements you can make. I don't need to see this again, though.

Thanks for the suggestions. Good spotting.

My commit was addressing the low hanging fruit - obvious issues like spelling mistakes and missing words.
To get the documentation to a state where it reads well from start to finish will require a deeper inspection, which I am happy to do over the coming days.