-
Notifications
You must be signed in to change notification settings - Fork 461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uniformize code syntax #128
Comments
Reported by malaterre on 2014-02-25 16:01:43
|
Reported by malaterre on 2014-03-03 16:13:44 |
Reported by detonin on 2014-03-04 21:37:25 |
Reported by malaterre on 2014-03-14 09:08:14 |
Reported by malaterre on 2014-03-14 14:05:42
|
Reported by malaterre on 2014-03-14 14:05:57 |
Reported by malaterre on 2014-03-14 14:06:42 |
Reported by mayeut on 2014-09-30 20:09:55 |
Indenting with tab characters (instead of spaces) is only an acceptable choice with a fixed tab width of 8 (that's the style used for Linux kernel code). I personally prefer indentation with spaces, either in steps of 4 (preferred, used for many free software projects) or 2. |
This tool might be useful here: http://astyle.sourceforge.net/ an automatic formatter. You can specify the style you would like, and it will run through all source code files and re-format. |
Yes. I can confirm that astyle works pretty good. |
I gave astyle a try and pushed the result on the "codingstyle" branch, together with the config file I used (see tools/cstyle/opj_astyle.cfg in that branch). Plan is to merge it into master once we agree on the config file. Btw, is it better to do this just before the release or just after ? Comments welcome. There was also uncrustify proposed by @malaterre a while ago. @mayeut Do you think it would be possible to add a test in Travis to run astyle with the opj config file (might be in dry-run mode (--dry-run option)), and return a failure if there is any file being marked as changed ? The idea would be to merge PR only if it meets opj coding style. |
My comments, all this is only a personal preference of course.
|
The new kid in town is clang format. It is also nicely packaged in Debian. |
@detonin, I suggest to start with existing pull requests which fix some smaller formatting issues (#678), then pull all other requests which are suitable for the next release, then make the release, and reformat the code at the beginning of the next release cycle. Existing pull request will usually need more or less re-basing when the whole code gets reformatted, therefore it is good to apply them before that action. I had a look on your astyle configuration and think that it is a good starting point. I tried this set of options:
In most cases it seems to give good results, but astyle is not perfect, so some options (for example |
personally, I am very excited to see this discussion. Providing consistent code is key to long term maintainability of a code base. |
You might be interested in the discussion here: vxl/vxl#164 |
See also discussion here : vxl/vxl#145 |
@rouault let's go for the QGIS/astyle way then :) |
Use an internal version of astyle (astyle 3.0). Scripts taken from QGIS. astyle.options from uclouvain#128 scripts/prepare-commit.sh can be used locally to automatically reformat edited files. Travis-CI will run scripts/verify-indentation.sh to verify committed files.
Use an internal version of astyle (astyle 3.0). Scripts taken from QGIS. astyle.options from uclouvain#128 scripts/prepare-commit.sh can be used locally to automatically reformat edited files. Travis-CI will run scripts/verify-indentation.sh to verify committed files.
Use an internal version of astyle (astyle 3.0). Scripts taken from QGIS. astyle.options from uclouvain#128 scripts/prepare-commit.sh can be used locally to automatically reformat edited files. Travis-CI will run scripts/verify-indentation.sh to verify committed files.
Use an internal version of astyle (astyle 3.0). Scripts taken from QGIS. astyle.options from uclouvain#128 scripts/prepare-commit.sh can be used locally to automatically reformat edited files. Travis-CI will run scripts/verify-indentation.sh to verify committed files.
Use an internal version of astyle (astyle 3.0). Scripts taken from QGIS. astyle.options from uclouvain#128 scripts/prepare-commit.sh can be used locally to automatically reformat edited files. Travis-CI will run scripts/verify-indentation.sh to verify committed files.
Use an internal version of astyle (astyle 3.0). Scripts taken from QGIS. astyle.options from uclouvain#128 scripts/prepare-commit.sh can be used locally to automatically reformat edited files. Travis-CI will run scripts/verify-indentation.sh to verify committed files.
Use an internal version of astyle (astyle 3.0). Scripts taken from QGIS. astyle.options from uclouvain#128 scripts/prepare-commit.sh can be used locally to automatically reformat edited files. Travis-CI will run scripts/verify-indentation.sh to verify committed files.
Use an internal version of astyle (astyle 3.0). Scripts taken from QGIS. astyle.options from uclouvain#128 scripts/prepare-commit.sh can be used locally to automatically reformat edited files. Travis-CI will run scripts/verify-indentation.sh to verify committed files.
Use an internal version of astyle (astyle 3.0). Scripts taken from QGIS. astyle.options from uclouvain#128 scripts/prepare-commit.sh can be used locally to automatically reformat edited files. Travis-CI will run scripts/verify-indentation.sh to verify committed files.
Use an internal version of astyle (astyle 3.0). Scripts taken from QGIS. astyle.options from uclouvain#128 scripts/prepare-commit.sh can be used locally to automatically reformat edited files. Travis-CI will run scripts/verify-indentation.sh to verify committed files.
See #919 |
Add mechanisms to reformat and check code style, and reformat whole codebase (#128)
Reformat: apply reformattin on .h files (#128)
Originally reported on Google Code with ID 128
Reported by detonin on 2012-02-20 16:22:14
The text was updated successfully, but these errors were encountered: