Skip to content
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

Feature/uctags #2979

Merged
merged 7 commits into from
Nov 18, 2019
Merged

Feature/uctags #2979

merged 7 commits into from
Nov 18, 2019

Conversation

idodeclare
Copy link
Contributor

Hello,

Please consider for integration this patch to accommodate the recent Universal Ctags strictness of language definitions by running an additional ctags --list-languages during the verification stage and only declaring --langdef if required by the Ctags version.

I also switched away from the newly deprecated syntax --LANG-kinds to --kinds-LANG.

To aid initial debugging, I updated Indexer --help to show the Ctags command-line when an extra level of detail is requested. This changes --help --detailed to instead show more details when -h,--help is specified an increasing number of times. I'm open to suggestions if this seems clunky.

Thank you.

@tarzanek
Copy link
Contributor

:-) looks like you had fun Chris (and this PR is one more reason for us to start moving to scala/kotlin)
merging, thank you

@tarzanek tarzanek merged commit 3fb997b into oracle:master Nov 18, 2019
/**
* Represents a container for tests of {@link CtagsUtil}.
*/
@ConditionalRun(CtagsInstalled.class)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CtagsInstalled is basically RuntimeEnvironment.getInstance().validateUniversalCtags() which relies on CtagsUtil functionality which is the class under test. This sounds little bit fragile to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha I hadn't realized the convolution. Probably CtagsInstalled has outlived its usefulness, right?


/**
* Creates a new instance, and attempts to configure it from the
* environment.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably explain how it differs to Ctags() constructor and when/where to use it.

@vladak
Copy link
Member

vladak commented Nov 18, 2019

I wonder if all these addXYZSupport methods from Ctags class can be moved their respective XYZAnalyzerFactory classes (or maybe some other class type that will hold such info) so that they are there together with suffixes/magics etc. and collected from there similarly to how registerAnalyzer() works.

As it is currently, e.g. addKotlinSupport() duplicates the suffixes from KotlinAnalyzerFactory.

@vladak
Copy link
Member

vladak commented Nov 18, 2019

@tarzanek seriously, if you want to move to another language (for the Analyzers), finish #2660 first and then we can talk.

}

private void initialize() {
env.validateUniversalCtags();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a point of continuing if this returns False ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am thinking if we should be more strict w.r.t. ctags validation and just terminate the indexer right in the beginning if no valid ctags implementation is found.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the work done by initialize() is repeated in every worker which seems unnecessary given all of them will share the same configuration/argv.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indexer is already strict when ctags validation fails.

I probably should have added a call to validateUniversalCtags() to opengrok-web instead of putting it into Ctags.initialize(), since my intention anyway was to ensure Ctags operates for --webappCtags on the same as during indexing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the repetition of initialize(), we already minimize Ctags construction with CtagsObjectFactory, so a small bit of redundant initialization seemed harmless.

}
String arg = argv.get(i);
if (arg == null) {
result.append("UNDEFINED");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what will this do ? and how could it happen actually ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote that when Ctags initially had a setBinary() method and started with null binary. I retired that method in a subsequent commit but didn't remove the "UNDEFINED" handling.

@tarzanek
Copy link
Contributor

sorry for too quick merge - @idodeclare will you be able to address @vladak comments in a new PR?

@vladak
Copy link
Member

vladak commented Nov 18, 2019

Most of my comments relate to pre-existing stuff so should be part of distinct PR anyway.

@idodeclare
Copy link
Contributor Author

I wonder if all these addXYZSupport methods from Ctags class can be moved their respective XYZAnalyzerFactory classes (or maybe some other class type that will hold such info) so that they are there together with suffixes/magics etc. and collected from there similarly to how registerAnalyzer() works.

As it is currently, e.g. addKotlinSupport() duplicates the suffixes from KotlinAnalyzerFactory.

I like the idea of removing the suffix duplication, but I'm not sure how strong is the case to relocate the --regex definitions.

For a long time I thought it would be necessary to do such radical refactoring of Ctags in order to customize ctags operation when OpenGrok -A,--analyzer is used for suffix/prefix management. I recently realized that the Ctags LANG keywords are sufficient to coordinate ctags operation across OpenGrok classes — and #2963 was the result.

@idodeclare idodeclare deleted the feature/uctags branch November 19, 2019 01:44
@idodeclare idodeclare mentioned this pull request Nov 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants