[PATCH] D108765: [docs] Fix documentation of clang-format BasedOnStyle type

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 30 12:03:28 PDT 2021


HazardyKnusperkeks added a comment.

In D108765#2972159 <https://reviews.llvm.org/D108765#2972159>, @FederAndInk wrote:

> And again, I don't really understand if we are allowed or not to pull in a dependency such as pluralizer or inflect, this would be another idea

My Python knowledge is very limited, but if it runs out of the box, or with very limited required user action with a reasonably new Python (if Python 2 can be reasonably new is another question), I think it would be fine.



================
Comment at: clang/docs/tools/dump_format_style.py:9
 import re
+import inspect
+import subprocess
----------------
I think these should be sorted.


================
Comment at: clang/docs/tools/dump_format_style.py:18
+PLURAL_FILE = os.path.join(os.path.dirname(__file__), 'plurals.txt')
+subprocess.check_call(['git', 'checkout', '--', PLURAL_FILE])
+plurals = set(open(PLURAL_FILE).read().splitlines())
----------------
So you would add a plurals.txt in git and make the change visible through git diff? What about just reordering? I.e. `Strings` is on line 2, but after a change in line 1. Maybe sort the output?

I'm not against this procedure, but also not in favor. :)


================
Comment at: clang/docs/tools/dump_format_style.py:26
 
+def register_plural(singular: str, plural: str):
+  if plural not in plurals:
----------------
FederAndInk wrote:
> MyDeveloperDay wrote:
> > This failed for me with invalid syntax
> Oh, ok, sorry, I might be using to recent python features, I'll remove type specifier, what is the recommended python version to use?
> Oh, ok, sorry, I might be using to recent python features, I'll remove type specifier, what is the recommended python version to use?

That **I** can not answer. I run
```$ python --version
Python 3.9.5
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108765/new/

https://reviews.llvm.org/D108765



More information about the cfe-commits mailing list