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

Add a Cppcheck step #1345

Merged
merged 8 commits into from Nov 13, 2014
Merged

Add a Cppcheck step #1345

merged 8 commits into from Nov 13, 2014

Conversation

benallard
Copy link
Contributor

No description provided.

@krf
Copy link
Contributor

krf commented Nov 11, 2014

Heya. Sorry for chiming in -- I've just seen this PR through IRC.

This looks nice already, but I'd be glad if you could make this a bit more flexible:

  • Add a source=["."] () parameter for defining the list of files or paths for cppcheck
  • Add an extra_args=[] (similar to the SVN step's 'extra_args') where one can pass additional options to cppcheck

Makes sense? Other opinions?

@sa2ajj
Copy link
Contributor

sa2ajj commented Nov 11, 2014

@krf do not be sorry, all feedback is welcome!

@benallard
Copy link
Contributor Author

Glad you like it !

It's quite easy to override the complete command parameter. this way it allow you to also change the path to cppcheck, or specify only a few messages that you'd like to enable ...

If we want to add some special support for the other parameter, then we'd have to add support for those ones also ... I'm not sure where to draw the line between the extra_args, and the customization args ...

I'd be glad to implement it if we come to a sensible agreement !

@benallard
Copy link
Contributor Author

The minimum I should do is to add in the doc that customization of the command parameter is possible.

@sa2ajj
Copy link
Contributor

sa2ajj commented Nov 11, 2014

I think extra_args is a good first step.

Once we understand (by users' feedback) what common options are there, we could provide them as explicit parameters.

@benallard
Copy link
Contributor Author

Should we put the --inconclusive as default for extra_args ?

I.e.: When someone overrides extra_args, and want inconclusive, he need to explicitly give it ?

@krf
Copy link
Contributor

krf commented Nov 11, 2014

Well, the reason I'm proposing both is that command already contains a path: ".". You cannot get rid off that by just passing extra_args. source is the most important options to cppcheck, after all, thus I think it makes sense to parameterize that one.

@benallard
Copy link
Contributor Author

What about enable=all, should it also be put as default for extra_args ?

@sa2ajj
Copy link
Contributor

sa2ajj commented Nov 11, 2014

re inconclusive -- this seems to be a good candidate for user-facing options.

@benallard
Copy link
Contributor Author

Decided to put my whole parameters as extra_args. The downside of this is that it is not possible to override the whole command by giving command as parameter.

if 'source' in kwargs:
self.source = kwargs['source']
del kwargs['source']
self.extra_args = ['--enable=all', '--inconclusive']
Copy link
Member

Choose a reason for hiding this comment

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

why dont you put those parameters as constructors params? with None as default.
Also, you probably want to put those params as renderables

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed on the renderables.

I will set the default for extra_args to [], and add a enable parameter (default to nothing: default for cppcheck), and a Boolean inconclusive parameter (default to False: don't set the param).

Copy link
Member

Choose a reason for hiding this comment

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

beware it is not advised to put [] in default arguments of params, it preferable to default to None, and do

if p is None
   p = []

http://docs.python-guide.org/en/latest/writing/gotchas/#mutable-default-arguments

Copy link

Choose a reason for hiding this comment

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

+1

@tardyp
Copy link
Member

tardyp commented Nov 11, 2014

👍 except for the weird optional params constructor.

@benallard
Copy link
Contributor Author

Fixed the parameters. Should be fine now.

@benallard
Copy link
Contributor Author

I don't think we have trouble with enable passed as renderable as the str of a renderable returns its content, so that it can be nested (like I do there). Or do I have to add a str(r) for r in self.enable in my join call ?

@benallard
Copy link
Contributor Author

Anyway, test should tell ...

@benallard
Copy link
Contributor Author

Added test for renderables, removed enable from the renderables

@tardyp
Copy link
Member

tardyp commented Nov 12, 2014

👍

@benallard
Copy link
Contributor Author

This is good to go, travis is (now) happy, just tell me if I forgot any comment.

sa2ajj pushed a commit that referenced this pull request Nov 13, 2014
@sa2ajj sa2ajj merged commit 038a8de into buildbot:master Nov 13, 2014
@benallard benallard deleted the cppcheck branch November 14, 2014 11:00
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

5 participants