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

Added a short circuit check #237

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

ideasasylum
Copy link

I'm not sure if this is generally useful but I've found it very important. This checks for accidental short-circuits often used in debugging, e.g. Rails views, to force a particular state.

Statements like,

if true || something
if false && something

can be used when developing to force a particular condition but they're almost certainly an error if committed to Git.

I based this check & tests on the debugger check so I hope I haven't missed anything.

Based on the 'debugger' check, this checks for accidental short-circuits often used in debugging.

```
if true && something
if false && something
```
@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 96.279% when pulling 4fe1a95 on ideasasylum:master into 860ce02 on jish:master.

@mpapis
Copy link
Collaborator

mpapis commented Apr 20, 2016

oh, I missed to update readme, there is now easy way to create external plugins => https://github.com/jish/pre-commit/blob/master/lib/pre-commit/cli.rb#L31 - maybe try to make it an external plugin and we can add it to https://github.com/pre-commit-plugins/ and list it in the readme :)

code itself LGTM

@dannysmith
Copy link

@ideasasylum Did you ever make a plugin out of this?

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.

4 participants