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

Support underscores in class and definitions names in puppetParser #1904

Closed
wants to merge 4 commits into from

Conversation

ahakanbaba
Copy link
Contributor

No description provided.

masatake and others added 4 commits October 4, 2018 16:38
@ahakanbaba
Copy link
Contributor Author

@masatake I have added ontop of your commit here
Please take a look.
In this PR I have renamed the test directories too. If you have a strong preference in the unit test directory names, I can rename them however you like.

/tmp/multipledefineo_netw_o input.pp /^ file { "\/tmp\/multipledefineo_netw_o": content => "two" }$/;" resource line:16 language:PuppetManifest scope:definition:o_ne::tw_o end:16
o_ne::two_ input.pp /^define o_ne::two_ {$/;" definition line:19 language:PuppetManifest end:21
/tmp/multipledefineo_netwo_ input.pp /^ file { "\/tmp\/multipledefineo_netwo_": content => "two" }$/;" resource line:20 language:PuppetManifest scope:definition:o_ne::two_ end:20
t input.pp /^t { 't': }$/;" resource line:23 language:PuppetManifest end:23
Copy link
Contributor Author

@ahakanbaba ahakanbaba Oct 5, 2018

Choose a reason for hiding this comment

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

This is probably another bug's indication.
In the source file 5 different resources have been declared.

t { 't': }
one_ { 'one_': }
on_e { 'on_e': }
o_ne::tw_o { 'o_ne::tw_o': }
o_ne::two_ { 'o_ne::two_': }

But this tag file only mentions one of them.
I suspect there is another regular expression somewhere missing the "_" char.

@masatake if you point me to the right direction I can also fix that in another PR.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 84.882% when pulling f2703d5 on ahakanbaba:master into d080788 on universal-ctags:master.

@ahakanbaba
Copy link
Contributor Author

Both of the new input.pp files are OK puppet syntax:

puppet-classname.d (master)]$ puppet apply --noop input.pp
Notice: Compiled catalog for hbaba.dev.box.net in environment production in 0.12 seconds
Notice: /Stage[main]/T/File[/tmp/multipleclasst]/ensure: current_value absent, should be file (noop)
Notice: Class[T]: Would have triggered 'refresh' from 1 events
Notice: /Stage[main]/One_/File[/tmp/multipleclassone_]/ensure: current_value absent, should be file (noop)
Notice: Class[One_]: Would have triggered 'refresh' from 1 events
Notice: /Stage[main]/On_e/File[/tmp/multipleclasson_e]/ensure: current_value absent, should be file (noop)
Notice: Class[On_e]: Would have triggered 'refresh' from 1 events
Notice: /Stage[main]/O_ne::Tw_o/File[/tmp/multipleclasso_netw_o]/ensure: current_value absent, should be file (noop)
Notice: Class[O_ne::Tw_o]: Would have triggered 'refresh' from 1 events
Notice: /Stage[main]/O_ne::Two_/File[/tmp/multipleclasso_netwo_]/ensure: current_value absent, should be file (noop)
Notice: Class[O_ne::Two_]: Would have triggered 'refresh' from 1 events
Notice: Stage[main]: Would have triggered 'refresh' from 5 events
Notice: Applied catalog in 0.11 seconds

and:

puppet-definitionname.d (master)]$ puppet apply --noop input.pp
Notice: Compiled catalog for hbaba.dev.box.net in environment production in 0.10 seconds
Notice: /Stage[main]/Main/T[t]/File[/tmp/multipledefinet]/ensure: current_value absent, should be file (noop)
Notice: T[t]: Would have triggered 'refresh' from 1 events
Notice: /Stage[main]/Main/One_[one_]/File[/tmp/multipledefineone_]/ensure: current_value absent, should be file (noop)
Notice: One_[one_]: Would have triggered 'refresh' from 1 events
Notice: /Stage[main]/Main/On_e[on_e]/File[/tmp/multipledefineon_e]/ensure: current_value absent, should be file (noop)
Notice: On_e[on_e]: Would have triggered 'refresh' from 1 events
Notice: /Stage[main]/Main/O_ne::Tw_o[o_ne::tw_o]/File[/tmp/multipledefineo_netw_o]/ensure: current_value absent, should be file (noop)
Notice: O_ne::Tw_o[o_ne::tw_o]: Would have triggered 'refresh' from 1 events
Notice: /Stage[main]/Main/O_ne::Two_[o_ne::two_]/File[/tmp/multipledefineo_netwo_]/ensure: current_value absent, should be file (noop)
Notice: O_ne::Two_[o_ne::two_]: Would have triggered 'refresh' from 1 events
Notice: Class[Main]: Would have triggered 'refresh' from 5 events
Notice: Stage[main]: Would have triggered 'refresh' from 1 events
Notice: Applied catalog in 0.08 seconds

@ahakanbaba
Copy link
Contributor Author

@masatake Could you take a look at this at your convenience please ?

@masatake
Copy link
Member

masatake commented Oct 6, 2018

I got following output for the input

[jet@localhost]~/var/ctags% ./ctags  --sort=no -o - foo.pp
t	foo.pp	/^t { 't': }$/;"	r
one_	foo.pp	/^one_ { 'one_': }$/;"	r
on_e	foo.pp	/^on_e { 'on_e': }$/;"	r
o_ne::tw_o	foo.pp	/^o_ne::tw_o { 'o_ne::tw_o': }$/;"	r
o_ne::two_	foo.pp	/^o_ne::two_ { 'o_ne::two_': }$/;"	r

wiith following change:

diff --git a/optlib/puppetManifest.ctags b/optlib/puppetManifest.ctags
index c5ab0c7c..ccb0254b 100644
--- a/optlib/puppetManifest.ctags
+++ b/optlib/puppetManifest.ctags
@@ -152,8 +152,8 @@
 #
 # block
 #
---_mtable-regex-PuppetManifest=blockStart/@?::[a-zA-Z0-9:]+[ \t\n]*\{//{tenter=resourceBlock}
---_mtable-regex-PuppetManifest=blockStart/@?[a-zA-Z][a-zA-Z0-9:]*[ \t\n]*\{//{tenter=resourceBlock}
+--_mtable-regex-PuppetManifest=blockStart/@?::[a-zA-Z0-9:_]+[ \t\n]*\{//{tenter=resourceBlock}
+--_mtable-regex-PuppetManifest=blockStart/@?[a-zA-Z][a-zA-Z0-9:_]*[ \t\n]*\{//{tenter=resourceBlock}

@masatake
Copy link
Member

masatake commented Oct 6, 2018

By the way, it is a really bad idea using master branch as the "from" branch for making a pull request.
See https://git-scm.com/book/en/v2/Git-Branching-Branching-Workflows

@masatake
Copy link
Member

masatake commented Oct 6, 2018

Could you put "PuppetManifest:" as the prefix for the commit logs?

@ahakanbaba
Copy link
Contributor Author

By the way, it is a really bad idea using master branch as the "from" branch for making a pull request.
See https://git-scm.com/book/en/v2/Git-Branching-Branching-Workflows

You are right. I will not use ahakanbaba:master again.

@ahakanbaba
Copy link
Contributor Author

Closed in favor of #1906
There the commits are squashed and proper branch naming is used.
I will carry the open conversations from here to #1906

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.

3 participants