Notifysend report to show desktop notifications #39

Merged
merged 4 commits into from Aug 14, 2012

Projects

None yet

2 participants

@cweiske
cweiske commented Jul 11, 2012

A new Codesniffer report that shows a short popup message on your desktop. Very useful when phpcs is automatically executed when saving a file.

@gsherwood
Member

I have no way I can currently test this and I'm not sure what conventions are used in these messages currently.

Can I trust that you have tested this thoroughly?
Are there version or OS requirements that need to be considered for notify-send (needed for the PHPCS docs)?
Should the path to notify-send actually be a PHP_CodeSniffer config setting?
Anything else I should be aware of?

@cweiske
cweiske commented Jul 23, 2012

Hello Greg,

I have no way I can currently test this and I'm not sure what
conventions are used in these messages currently.
It shows an information message stating that all is fine when no
errors+warnings have been found, and an error message with the number
of warnings+errors if there are some.

Can I trust that you have tested this thoroughly?
It works for me for a week now.

Are there version or OS requirements that need to be considered for
notify-send (needed for the PHPCS docs)?
notify-send is standard on all linux desktops AFAIK.

Should the path to notify-send actually be a PHP_CodeSniffer config setting?
That'd be a good option, but I don't know how to do that. Could you
give me a hin?

Anything else I should be aware of?
I'd like to make e.g. the timeout configurable, but didn't know how to
pass config options. Enlighten me :)

Regards/Mit freundlichen Grüßen
Christian Weiske

-=≡ Geeking around in the name of science since 1982 ≡=-

@gsherwood
Member

The config stuff in PHPCS is very basic. You just go ahead and use config vars in the code and handle defaults. So something like:

$path = PHP_CodeSniffer::getConfigData('notifysend_path');
if ($path === null) {
// Try default path, or maybe throw an exception telling them to set the path.
}

Same would go for the timeout:
$timeout = PHP_CodeSniffer::getConfigData('notifysend_timeout');
if ($timeout === null) {
$timeout = 3000;
}

You set those config vars like this:
phpcs --config-set notifysend_path /path/to/notify-send
phpcs --config-set notifysend_timeout 5000

@cweiske
cweiske commented Jul 25, 2012

I've implemented the configuration options now.

Screenshots:
all fine
error

@gsherwood gsherwood merged commit 655fb64 into squizlabs:master Aug 14, 2012
@gsherwood
Member

Found a linux box at work to try this one and it worked great. Thanks for the contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment