kbenzie / git-cmake-format Goto Github PK
View Code? Open in Web Editor NEWStandardise code formating for cmake projects with git and clang-format
License: The Unlicense
Standardise code formating for cmake projects with git and clang-format
License: The Unlicense
Not all users will require the use of a .clang-format
file as they will be using one of the built in styles.
Add a CMake option to allow setting this value, default to file
.
When trying to amend a commit, I see the following error:
Traceback (most recent call last):
File "/Users/gegles/Workspaces/fasp.io/cmake/git-cmake-format/git-cmake-format.py", line 114, in <module>
if not isFormattable(FileName):
File "/Users/gegles/Workspaces/fasp.io/cmake/git-cmake-format/git-cmake-format.py", line 43, in isFormattable
if '' != Dir and '' != os.path.commonprefix([os.path.relpath(File), os.path.relpath(Dir)]):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 428, in relpath
raise ValueError("no path specified")
ValueError: no path specified
Probably need to support the script running with no actual files changed..
Right now git-cmake-format rejects commits where any tracked C/C++ file is improperly formatted. Here's an example:
> git status
Changes not staged for commit:
modified: foo.cpp
modified: bar.cpp
> git add foo.cpp
> git commit -m "Updated foo"
'bar.cpp' must be formatted, run the cmake target 'format'
I think it would be an easier work flow if I could still commit foo.cpp
even if bar.cpp
wasn't formatted.
Glancing at it, you could try adding --cached
to the flags passed to git in git-cmake-format.py/getEditedFiles()
Why git reset all files when the check fails? This is REALLY annoying.
Is it possible to exclude some files from the format checking / reformating? I typically use a vendor directory, which includes sources coming from 3rd parties, which should stay the way I received them.
What is the best way to implement such a feature? Do you have an idea?
There now exists a program called cmake-format
for auto-formatting CMake listfiles (written in Python: pip install cmake-format
and then run cmake-format
from the command line). The name of git-cmake-format
is a bit confusing under the circumstances since AFAICT it doesn't use cmake-format
:)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.