jaredgrubb / fit-clang-format

Helper tool to generate a best-fit "clang-format style" for your project
MIT License
9 stars 1 forks source link

program won't run #1

Open Stanzilla opened 6 years ago

Stanzilla commented 6 years ago
python3 /mnt/c/Users/Benjamin/VCS/Git/fit-clang-format
/usr/bin/python3: can't find '__main__' module in '/mnt/c/Users/Benjamin/VCS/Git/fit-clang-format'

any ideas?

/mnt/c/Users/Benjamin/VCS/Git/KVIrc master*
❯ python3 --version
Python 3.5.2

/mnt/c/Users/Benjamin/VCS/Git/KVIrc master*
❯ clang-format --version
clang-format version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)

next try was running the .py itself:

python3 /mnt/c/Users/Benjamin/VCS/Git/fit-clang-format/fit-clang-format.py
Traceback (most recent call last):
  File "/mnt/c/Users/Benjamin/VCS/Git/fit-clang-format/fit-clang-format.py", line 17, in <module>
    import styles
  File "/mnt/c/Users/Benjamin/VCS/Git/fit-clang-format/styles.py", line 159, in <module>
    'Standard': ['Cpp11', 'Cpp03', 'Auto'],
AttributeError: 'dict' object has no attribute 'iteritems'
jaredgrubb commented 6 years ago

I actually wrote this for Py2.7 and haven't tried under Py3, so I imagine it doesnt work. I'd be open to updating it though!

Stanzilla commented 6 years ago

Oh, that would be nice if you could put that in the readme?

I'm stuck here now:

/mnt/c/Users/Benjamin/VCS/Git/KVIrc master ⇡
❯ git clean -f

/mnt/c/Users/Benjamin/VCS/Git/KVIrc master ⇡
❯ python /mnt/c/Users/Benjamin/VCS/Git/fit-clang-format/fit-clang-format.py

=> Testing base styles to see which seems to fit best.
Checking out files: 100% (2323/2323), done.
  + (5335.13, 1071.00, 340.30): {'BasedOnStyle': 'LLVM'}
Traceback (most recent call last):
  File "/mnt/c/Users/Benjamin/VCS/Git/fit-clang-format/fit-clang-format.py", line 433, in <module>
    ], strictly_better=False)
  File "/mnt/c/Users/Benjamin/VCS/Git/fit-clang-format/fit-clang-format.py", line 188, in search
    with project.apply_temporary_style(style):
  File "/mnt/c/Users/Benjamin/VCS/Git/fit-clang-format/git.py", line 176, in apply_temporary_style
    raise ValueError("git repo is not clean")
ValueError: git repo is not clean

/mnt/c/Users/Benjamin/VCS/Git/KVIrc master ⇡ 34s
❯

since it generates a new .clang-format, they project can't actually be clean at that moment, can it?

Artoria2e5 commented 4 years ago

A way to go around it is by ignoring .clang-format for the time being by putting it in .gitignore. The is_dirty helper may benefit from having a filter that the other parts of the scripts are using.

Another good thing to have is to have an option to not use git for diffing instead. That calls for copying files (with reflink preferably), running our own gitignore-like rules, and feeding all that to difflib.

jaredgrubb commented 4 years ago

I'm open to using a different diff util; I trust and like git, so figured that was a good one.

Another option is to modify the scripts to ignore .clang-format files as part of their logic.