It seems to me that this is a new idea (since I did not find solutions or someone implemented it) ...
A shell script that automatically runs whenever you run git or something else that tells you if you forgot to remove any debugs or env development specific lines of code in your project.
For instance:
Often (in my Ruby projects) I will leave lines of code for outputting variables, e.g.
puts params.inspect
or
raise params.inspect
In addition, sometimes I will use different methods, so I can easily see the effects, for example, in cases, for example, using delayed_job, where I would rather name the method without delay during development.
Sometimes I forget to change these methods or forget to remove the call to raise params.inspect, and I will inadvertently press this code.
So, I thought, maybe the easiest solution was to add a comment to any such debug line, such as
raise params.inspect #debug
Essentially mark this line as a development / debug line. Then, in a shell script that runs before some other command, such as git commit, it can use awk or grep to search all the last modified files for this #debug comment and stop execution and warn you. However, I am not very versed in shell scripts, so I thought I would ask for help :)
source share