CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • tab cleanliness in source?
Pages: [1]

Author Topic: tab cleanliness in source?  (Read 700 times)

sdague

  • I’m new here
  • *
  • Posts: 17
  • Karma: 0
  • CiviCRM version: 4.1
  • CMS version: Drupal 6
  • MySQL version: 5.1.58
  • PHP version: 5.3
tab cleanliness in source?
February 19, 2012, 07:56:36 am
I'm using git-svn to work on patches for issues I find in civicrm, but I'm running into an issue that when I go to save things I'm getting a lot of unrelated changes on lines. It appears to be emacs cleaning up tabs and converting them to 4 spaces.

It would be really good if the source code was consistent here, so that creating patches didn't also create other noise. Most indents seem to be 4 spaces, but there are areas where it's 2, and lines where it's tabs. Is there a pointer to a style guideline for the source code? Is there a cleanup effort planned in the future?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: tab cleanliness in source?
February 19, 2012, 01:05:17 pm

If there are files you see this anomaly please let us know and we'll clean it up

we've avoided going down the path of strict coding standards and are a bit loosey-goosey with it.
lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

sdague

  • I’m new here
  • *
  • Posts: 17
  • Karma: 0
  • CiviCRM version: 4.1
  • CMS version: Drupal 6
  • MySQL version: 5.1.58
  • PHP version: 5.3
Re: tab cleanliness in source?
February 19, 2012, 03:39:44 pm
The three or four files that I've opened all had a few lines that were this way. Attached is a list of all the files (gzipped to get under the size requirement) in the source tree with hard tab characters in them, and the number of times they were found. I'd ignore the packages directory, as that's 3rd party code, but the rest should probably be cleaned up. I generated this with 'grep -c -I -r "^V<TAB>" * | grep -v ":0"'  (the ^V<TAB> is a litteral ctrl-v followed by the tab character in the shell) on a Linux machine.

If you wanted to automatically fix a file (assuming 4 spaces is what the indent is supposed to be) you could do the following on a Linux machine:

perl -pi -e 's/\t/    /g' FILENAME

and I think ...

grep -l -r -I "^V<TAB>" * | xargs perl -pi -e 's/\t/    /g'

Would get you a mass cleanup in one go.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • tab cleanliness in source?

This forum was archived on 2017-11-26.