I need to find extra line breaks in the code. For example, if after } more than 1 line break, then highlight warning . Here is what I tried:

 TAGS="TODO:|FIXME:" echo "searching ${SRCROOT} for ${TAGS}" find "${SRCROOT}" \( -name "*.h" -or -name "*.m" \) -print0 | xargs -0 `egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning:\$1/"` TAGS2="\s+$" echo "searching ${SRCROOT} for ${TAGS2}" find "${SRCROOT}" \( -name "*.h" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS2).*\$" | perl -p -e "s/($TAGS2)/ warning\$1/" 

The first script highlights all the TODO: and FIXME: in the code, but I just can’t understand how to write the second script correctly so that it highlights more than 1 line break after } .

  • Try this: TAGS="TODO:|FIXME:|[\n]{2,}" - Alexander
  • and you can ask what you are doing? type code style check? - Max Mikheyenko
  • @MaxMikheyenko yes, I got to work as a juna, I have a lot of extra newlines in every merj and I get minuses for it, I decided to try to write a script that will highlight them with red warningas :) - Nick Axenov
  • Well, you know :) then maybe objclean.com can help it really costs 10 rubles - Max Mikheyenko
  • @MaxMikheyenko Well, I’ll still try to write my own script :) Since I’m not attentive only to extra newlines. - Nick Axenov

0