Proposal to remove /tags file from CVS control

Proposal to remove /tags file from CVS control

David Mudrák -
回帖数:11
Core developers的头像 Documentation writers的头像 Moodle HQ的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像 Plugins guardians的头像 Testers的头像 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/' 

回复David Mudrák

Re: Proposal to remove /tags file from CVS control

Tim Hunt -
Core developers的头像 Documentation writers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像
I agree.

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

Re: Proposal to remove /tags file from CVS control

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. 微笑

I agree that every developer has his/her own ways of working.
回复David Mudrák

Re: Proposal to remove /tags file from CVS control

Martin Dougiamas -
Core developers的头像 Documentation writers的头像 Moodle HQ的头像 Particularly helpful Moodlers的头像 Plugin developers的头像 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.
回复Martin Dougiamas

Re: Proposal to remove /tags file from CVS control

David Mudrák -
Core developers的头像 Documentation writers的头像 Moodle HQ的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像 Plugins guardians的头像 Testers的头像 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.)
回复Martin Dougiamas

Re: Proposal to remove /tags file from CVS control

Petr Skoda -
Core developers的头像 Documentation writers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像
I never used these, what is required to build this file? Could we just distribute some sh script that builds it instead?
回复Petr Skoda

Re: Proposal to remove /tags file from CVS control

Iñaki Arenaza -
Core developers的头像 Documentation writers的头像 Peer reviewers的头像 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.
回复Iñaki Arenaza

Re: Proposal to remove /tags file from CVS control

Tim Hunt -
Core developers的头像 Documentation writers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像
Can't we put it in contrib?
回复Tim Hunt

Re: Proposal to remove /tags file from CVS control

Iñaki Arenaza -
Core developers的头像 Documentation writers的头像 Peer reviewers的头像 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 微笑

Saludos.
Iñaki.
回复Iñaki Arenaza

Re: Proposal to remove /tags file from CVS control

Martin Dougiamas -
Core developers的头像 Documentation writers的头像 Moodle HQ的头像 Particularly helpful Moodlers的头像 Plugin developers的头像 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.

回复Iñaki Arenaza

Re: Proposal to remove /tags file from CVS control

David Mudrák -
Core developers的头像 Documentation writers的头像 Moodle HQ的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像 Plugins guardians的头像 Testers的头像 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.