Skip to content

Add --add-plugin option and clobber when --plugin is used #860

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

Merged
merged 1 commit into from
May 11, 2016

Conversation

brasmusson
Copy link
Contributor

When using --plugin the plugins of that type defined from a different source is clobbered. Using -Dcucumber.options="--plugin pretty" would clobber the formatter/reporter plugins defined in @CucumberOptions. --add-plugin does not clobber any plugins defined from a different
source.

The rational for this PR is both consistency, other list type options do clobber, and it enables some use cases not possible today:

  • forcing one specific formatter to write to stdout on the CI system even when the users have specified another formatter to write to stdout in the @CucumberOptions (mailing list post)

When using --plugin the plugins of that type defined from a different
source is clobbered. Using -Dcucumber.options="--plugin pretty" would
clobber the formatter/reporter plugins defined in `@CucumberOptions`.
--add-plugin does not clobber any plugins defined from a different
source.
@@ -114,11 +115,11 @@ private void parse(List<String> args) {
parsedGlue.add(gluePath);
} else if (arg.equals("--tags") || arg.equals("-t")) {
parsedFilters.add(args.remove(0));
} else if (arg.equals("--plugin") || arg.equals("-p")) {
addPluginName(args.remove(0));
} else if (arg.equals("--plugin") || arg.equals("--add-plugin") || arg.equals("-p")) {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure I like renaming the semantics of -p to be --add-plugin now. This could be a suprise break for people who are currently using -p and expect that behavior to be the same.

Copy link
Member

Choose a reason for hiding this comment

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

Oh wait, you're changing the semantics of --plugin entirely! Hm. Same thought process applies. Since it's already released, should we use --add-plugin and have those semantics be different than the existing --plugin?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Between v1.1.4 and v1.1.5 the --glue and feature options was changed from "add" to clobber (5e3b0ea), so this kind of semantic change has been done on already released functionality before. And isn't it more surprising for people the --plugin behaves differently from all other list type options?

I know the rationale for the current behaviour of --plugin (#643 (comment)), but do think it makes thinks unnecessary hard on users that it is impossible to remove plugins defined in the @CucumberOptions annotation, without edit it in the source code. With this PR CucumberPro and others can use --add-plugin if they need the current behaviour, and the people the need the clobbering of plugins from the @CucumberOptions can do that too (and all list type options behave consistently).

@dkowis
Copy link
Member

dkowis commented May 25, 2015

That makes sense to me +1 for merging

@dkowis dkowis merged commit 0ac2df0 into cucumber:master May 11, 2016
@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants