Commit Graph

5 Commits

Author SHA1 Message Date
Jacopo 181cd299f9 Adds Rubocop rule for line break after guard clause
Adds a rubocop rule (with autocorrect) to ensure line break after guard clauses.
2017-11-16 17:58:29 +01:00
Sean McGivern d771719278 Speed up DeclarativePolicy::Runner#steps_by_score
There were a couple of things here:

1. If the state was already enabled, we don't need to check all the remaining
   steps - only those that can prevent the state. (An enable followed by an
   enable is a no-op.) This logic is in `#run`, but we still did the work of
   scoring and sorting the steps.
2. The sorting is known to be inefficient, but we can make it slightly more
   efficient by stopping once we have a step with zero score, as that means it's
   free.

Neither of these make this _fast_, especially when called lots of times - as we
do when there is lots of activity on an issue - but they do help some.
2017-10-04 13:50:05 +01:00
http://jneen.net/ 15bb6e1ed7 more eagerly bail when the state is prevented 2017-08-07 12:48:22 -07:00
http://jneen.net/ 8a167554a9 reduce iterations by keeping a count of remaining enablers
rather than iterating the whole remaining step set with
.all?(&:prevent?)
2017-08-07 12:36:13 -07:00
http://jneen.net/ 80d6e5bbd4 add a new DeclarativePolicy framework 2017-06-27 12:41:54 -07:00