I recently joined a company, and we use RuboCop as the static code analysis tool.
I created a script to run RuboCop in the files I worked on. For the newly created files is fine, but when I modify an existing one sometimes triggers a lot of changes in lines that I dit not introduced.
this is the script:
#!/bin/bash
cd $HOME/Documents/repos/{projectName}
files=`git status --porcelain | awk '{ print $2 }'`
for f in $files;
do
rubocop -a $f
done
Is there any way I can modify this script to check only the lines that have changed?
Thanks.