Proposal to remove /tags file from CVS control

Proposal to remove /tags file from CVS control

by David Mudrák -
Number of replies: 11
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
This is a proposal to remove /tags file from CVS control. Basically, the file is used by ctags utility to jump to a function definition. Here are some reasons:
  • tags file is useful for developers only. Developer should be able to easily create their own tags file if they want to use it. Which is something they need to do anyway, especially when adding or modifying new functions/methods/classes.
  • tags file in CVS does not seem to be updated regularly. Currently, in HEAD, it is 2 months old.
  • Developers may prefer their own settings of what will be tagged by ctags utility. Again, they need to re-create the file manually anyway
  • Locally re-created tags file is likely to be in conflict during update
  • It generally causes conflicts for those using git mirror of the source code base
Conclusion: tags is useful mainly for developers. Developers have to re-create it locally, anyway. Locally generated file is likely to run into conflict.

Hint:
$ cat ~/public_html/moodle-head/Makefile
all : cscope ctags
cscope :
 find `pwd` -type f -name '*.php' > cscope.files
 cscope -b
ctags :
 ctags -R --languages=php --regex-PHP='/(public |static |abstract |protected |private )+function ([^ (]*)/\2/f/' 

Average of ratings: -
In reply to David Mudrák

Re: Proposal to remove /tags file from CVS control

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I agree.

(However, Martin D uses tags himself, and we must allow him some personal whims.)
In reply to David Mudrák

Re: Proposal to remove /tags file from CVS control

by Mihai Sucan -
Being a GSOC student the first thing I did was to generate my own tags, for quicker code browsing. I was surprised that the tags file is in the tree. smile

I agree that every developer has his/her own ways of working.
In reply to David Mudrák

Re: Proposal to remove /tags file from CVS control

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Tags are useful for sysadmins looking at code too, not just developers.

We do need to improve the updating. Anyone can do this, but we should probably make moodle.org do it daily or so.
In reply to Martin Dougiamas

Re: Proposal to remove /tags file from CVS control

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
But if users are capable of using tags, they should be able to create them localy, right? It is really annoying to have tags file permanently marked as having local modifications (when comparing branches etc.)
In reply to Martin Dougiamas

Re: Proposal to remove /tags file from CVS control

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I never used these, what is required to build this file? Could we just distribute some sh script that builds it instead?
In reply to Petr Skoda

Re: Proposal to remove /tags file from CVS control

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
You can use the 'ctags' command to build a vi-compatible tags file, or 'etags' to build a emacs-compatible tags file. You may also need a bit of shell scripting to specify the files you are interested in and exclude the ones you are not.

Saludos.
Iñaki.
In reply to Iñaki Arenaza

Re: Proposal to remove /tags file from CVS control

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Can't we put it in contrib?
In reply to Tim Hunt

Re: Proposal to remove /tags file from CVS control

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
It's been ages since I used ctags, and I see it already has all the options to recurse directories and exclude files based on patterns, so it's as simple as using ctags (the Exuberant Ctags version from http://ctags.sourceforge.net, packaged in Debian/Ubuntu as 'exuberant-ctags') from the moodle directory with (everything in a single line, may appear wrapped here):


ctags --format=2 --languages=PHP --PHP-kinds=cidf --recurse=yes --exclude=tags --exclude="config*.php" --exclude="lang/*" --exclude="install/lang/*"


to create a vi-compatible tags file excluding the config*.php files at $CFG->dirroot and the language files.

To do the same for an emacs-compatible file:


ctags -e --format=2 --languages=PHP --PHP-kinds=cidf --recurse=yes --exclude=tags --exclude="config*.php" --exclude="lang/*" --exclude="install/lang/*"


Maybe we could add it MoodleDocs, instead of puting a single line script in contrib smile

Saludos.
Iñaki.
Average of ratings:Useful (1)
In reply to Iñaki Arenaza

Re: Proposal to remove /tags file from CVS control

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
OK I'll nuke the tags file, and add a tags.txt instead. MDL-19728

I used this invocation to avoid some problems that we had in the past with some of the newer PHP code:


ctags -R --languages=php --exclude="CVS" --php-kinds=f --regex-PHP='/abstract class ([^ ]*)/\1/c/' --regex-PHP='/interface ([^ ]*)/\1/c/' --regex-PHP='/(public |static |abstract |protected |private )+function ([^ (]*)/\2/f/'


This (and any of the other ctags strings above) don't work on the BSD ctags which comes with Mac OS X so we need a different solution there.

Average of ratings:Useful (1)
In reply to Iñaki Arenaza

Re: Proposal to remove /tags file from CVS control

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
Hi Iñaki,

yes, the latest version 5.7 already includes PHP5 regexps. However, there are known problems that it also wrongly tags places like
/**
 * this is abstract class and will be tagged as "and"
 */

I have published a patch for ctags-5.7 so you can recompile and fix it on your own. This behaviour is extremly annoying if you use taglist extension of vim.