Comments (9)
Sounds good to me.
On Tue, Aug 20, 2013 at 8:49 AM, bartnijssen [email protected]:
I suggest that we adopt some standard for VIC code formatting for a few
reasons:a) a mixture of tabs and spaces is currently used for code indentation,
which depending on the individual users editor settings (tab size, etc.)
makes for code that is very hard to read.b) a lot of the code has trailing whitespace that some editors will auto
remove (again depending on user settings). This leads to non-significant
whitespace changes in the code, which in turn result in harder to read
diffs in version control (since you may have to plow through many
whitespace changes).Rather than coming up with a long list of code format requirements, I
suggest using a code formatting tool: uncrustifyhttp://uncrustify.sourceforge.net/,
which everyone would run with a standard configuration file (which itself
will be included in the VIC git repo), before committing changes.My suggestion is to implement this as part of VIC 5 rather than 4.2, to
avoid a gazillion whitespace changes in 4.2. VIC 5 will be a major change
anyway. I can make my configuration file available.â
Reply to this email directly or view it on GitHubhttps://github.com//issues/48
.
from vic.
I just ran a test of uncrustify with a standard configuration file on the VIC source code directory and I really like how the code looks. I also agree that we should wait to implement this until a major release (5.0) because this could change many lines of code (my test changed about 80%).
from vic.
Yes, also see this link for my version of the config file for C. I tweaked
it a bit.
Bart
https://www.dropbox.com/s/4xb2ycs2izpjy9w/uncrustify_c.cfg
On Tue, Aug 20, 2013 at 12:30 PM, Joe Hamman [email protected]:
I just ran a test of uncrustify with a standard configuration filehttp://uncrustify.sourceforge.net/default.cfgon the VIC source code directory and I really like how the code looks. I
also agree that we should wait to implement this until a major release
(5.0) because this could change many lines of code (my test changed about
80%).â
Reply to this email directly or view it on GitHubhttps://github.com//issues/48#issuecomment-22966766
.
from vic.
I am wasting way too much time on this. It turns out it is actually rather difficult to make the code look exactly the way I like. For example, should we make all the comments consistent (a lot of work and probably not worth it), all the lines a maximum width (I hate lines that scroll off-screen and prefer a max width of 80 for everyhting), etc. There are a lot of options in uncrustify and while some make things better in most cases, they make things worse in some cases.
The whole point of running uncrustify is a) to obtain readable code (in particular consistently indented and braced code) and b) to minimize the number of unnecessary commit that are basically just code formatting related.
I think using the uncrustify configuration file that is currently in the archive serves the purpose. Please take at the code in https://github.com/bartnijssen/VIC/tree/feature/issue_48 to see if you agree, so I can move on. This is probably not worth the time I am spending on it, since the indentation is the main issue for me.
In particular take a look at:
https://github.com/bartnijssen/VIC/blob/feature/issue_48/src/calc_surf_energy_bal.c
and browse some of the other files. Note that there is a setting to align on the '=' sign, but again this is difficult to get right in general.
By now I have played with the configuration file and reformatted the code about 20 times, but I am now back to where I started ...
from vic.
I think merges from 4.x to 5.x (which will happen frequently over the next few months during development) will actually be difficult (i.e. lots of conflict) if part of our code is before uncrustify and part of it is after. I almost wonder whether it would be quicker and less painless if we ran uncrustify with the same settings on all branches once and then simply move forward ..... The disadvantage is that files will show massive changes that have nothing to do with functionality.
Alternatively a) we do all development for the time being without the reformat and do it after the migration to 5.0 or b) one person keeps merging 4.x into 5.x from time to time. One possibility might be to follow b) and run uncrustify on the 4.x code before the merge into 5.x. Unfortunately I just tried this and it was not quite as clean as I would have hoped.
Basically I don't want to have to keep dealing with the formatting problem forever. If anyone has any suggestions or wants to take this one let me know. I am shelving it for now on my end and moving on.
from vic.
How about this: wait to do the uncrustify until the major code changes that are slated for 4.2 have been finished and merged into 5.0.
If I understand correctly, the major remaining changes on 4.2 are:
remove dist_prec - almost done
timeseries of veg params - almost done
from vic.
Good suggestion - let's go with that. Which means I'll shelve it for now and when the time comes we can just run uncrustify with the configuration that we already have.
On Mar 31, 2014, at 10:35 PM, Ted Bohn [email protected] wrote:
How about this: wait to do the uncrustify until the major code changes that are slated for 4.2 have been finished and merged into 5.0.
If I understand correctly, the major remaining changes on 4.2 are:
remove dist_prec - almost done
timeseries of veg params - almost doneâ
Reply to this email directly or view it on GitHub.
from vic.
I assume that uncrustifying 5.0 but not 4.2 might confuse automated merge tools. But presumably small changes like the other things slated for 4.2, or hotfixes, can be ported by hand...
from vic.
closed via #169
from vic.
Related Issues (20)
- Segmentation fault when running image driver with LAKES = TRUE (cells with and without lakes) HOT 1
- layer 0 mineral bulk density (0.77000) must be less than mineral soil density(0.57000) HOT 1
- New - Compile failure -- Resolved HOT 1
- ERROR: set_force_type.c:138: errno: None: Must supply netCDF variable name for WIND forcing file number 1
- [ERROR] ../../vic_run/src/CalcAerodynamic.c:119: errno: Numerical result out of range: Trunk space height below "center" of lower boundary
- Resloved--Can't Run vic_image.exe -g global,txt, and the error occured in the file of set_forcing_type.c HOT 1
- [QUESTION] Soil moisture fraction output with VIC v5
- Wpwp_FRACT MUST be <= Wcr_FRACT.
- multiple definition of 'xxx'; ... first defined here HOT 1
- Maximum Energy Error
- Clarification of forcing units HOT 1
- Why are there negative values in the sublimation of the snow in the canopy intercept in VIC 4.2.dīŧ
- Compilation error with VIC5.1.0: "collect2: error: ld returned 1 exit status" HOT 3
- Erroneous VIC version reporting in image driver?
- VIC Image Driver CPU Limited? Ways to increase memory use? HOT 1
- an error in docker_vic HOT 2
- Bug in classic driver in VIC 5.1.0, not able to read forcing data HOT 1
- Dose it include the both infiltration and saturation excess runoff mechanisms like Liang and Xie (2001)?
- VIC .4.2.d python script Run issues
- can user restart the VIC?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
đ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. đđđ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google â¤ī¸ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vic.