Questions tagged [hooks]
14 questions
50
votes
9 answers
Is it a good practice to run unit tests in version control hooks?
From the technical point of view it is possible to add some pre/post push hooks which will run unit tests before allowing some specific commit to be merged to remote default branch.
My question is - is it better to keep unit tests in build pipeline…

shabunc
- 2,424
- 2
- 20
- 27
26
votes
3 answers
What should plugins use: hooks, events or something else?
Consider an app that allows plugins to react to its program flow.
I know 2 ways to achieve this: hooks and events
1. Hooks
Use calls to empty functions inside the main program flow. These functions can be overriden by plugins.
For example, Drupal…

Stas Bichenko
- 3,689
- 4
- 24
- 32
10
votes
3 answers
When are hooks the right design choice?
I've worked on a large Rails app where the use of ActiveRecord callbacks was rampant and harrowing. Saving a record often had unexpected side-effects and it was a challenge to reason about the system.
At the same time, I've seen hooks used to good…

ivan
- 309
- 2
- 6
5
votes
3 answers
Patterns to allow for versatile data-flow hooks in Javascript
I have an application where I'd like to add ways for external modules/components to hook during the processes and data-flow and perform actions/modify data.
For the first requirement—performing actions—I assume the best pattern would be to emit…

Sunyatasattva
- 440
- 3
- 9
5
votes
1 answer
Driving Linux input events from serial device
I'd like to build a RaspberryPi-based device that can communicate with my Linux laptop over USB (don't think it matters, but I'll be using a custom made USB dongle that has an FTDI chip on it, and my laptop will have the FTDI drivers installed on…

smeeb
- 4,820
- 10
- 30
- 49
4
votes
9 answers
Should I be enforcing lint rules on feature branches?
I am working on a project and I typically setup precompile git hooks for things like linting and testing. I recently had some consultants we use complain about requiring lint on every commit. Their response is they commit as they go and they want to…

Jose Gleeson
- 71
- 2
3
votes
1 answer
What's a good strategy to go about registering 2-step hotkeys?
User32.dll exposes a RegisterHotKey function, to register, well, hotkeys:
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool RegisterHotKey(IntPtr hWnd, IntPtr id, uint fsModifiers, uint…

Mathieu Guindon
- 1,720
- 16
- 33
2
votes
1 answer
Is using Microsoft Hooks an ethical process for getting non sensitive Information
So we have an application that I am not ready to describe in full before we take it to the market, but I will give the details necessary.
We currently have an application that takes a snapshot of an active window of a particular application based on…

RSon1234
- 131
- 3
2
votes
1 answer
Is it possible to run a git hook that is executed when adding a file?
I'm planning to set up a client side git hook to force a commit to fail if any file in the commit contains the text "donotcommit".
Is it possible to hook the execution of "git add", such that I can run a shell script at the time files are added, and…

dgnuff
- 189
- 6
2
votes
1 answer
Development approach for GUI application sharing on X
I'm curious about developing a simple system for GUI application sharing between users on a single computer, which uses Xorg (or perhaps any modern form of X11 display). I'd like user Alice to be able to authorize user Bob to view and control a…

Chris Robison
- 21
- 2
1
vote
0 answers
How to run the Unit Test on Master branch using hook before merging the incoming changes of other branches
We have project which have more than 500 unit test and run for hours through Jenkins CI pipeline. In case there is failure of single UNIT test we need to kick off the build job again. I want to run the Unit Test job in Jenkins before merging the…

Isthatyou
- 19
- 2
1
vote
2 answers
In a web application, are Hooks and Event Subscriptions the same thing?
When I look at at some PHP applications, they typically have hooks. Drupal and Wordpress are examples. When I look at an application from the .NET world like Orchard or Umbraco, one subscribes to events.
On the other hand, I saw Drupal also has…

johnny
- 3,669
- 3
- 21
- 35
0
votes
2 answers
Are hooks really subsumed by Slim Framework middleware?
I've been using the Slim Framework (v2) for a little while now to develop my user management system.
They recently released Slim 3, and according to the upgrade guide,
Slim v3 no longer has the concept of hooks. Hooks were removed as they…

alexw
- 329
- 1
- 10
-2
votes
2 answers
What is the best way to run untrusted hooks/plugins?
I'm building a data processing system where users can submit hooks to execute on incoming data.
The hooks are untrusted and should execute in a sandbox with access only to a limited API that I expose – essentially like a DSL. Ideally, users write…

Benjamin Egelund-Müller
- 107
- 4