bouffalolab / bl_iot_sdk

BL602/BL702 SDK. Any technical topic, please access the following link.
http://bbs.bouffalolab.com
Apache License 2.0
267 stars 172 forks source link

HTML files: remove trailing spaces. #12

Closed robertlipe closed 4 years ago

YafeiJin commented 4 years ago

@robertlipe Thanks for your attentive check. Could you please share your method to clean? We would use it to check internally before the following release.

robertlipe commented 4 years ago

Sure. My primary way is to configure sublime and vim to just strip them on every save. I didn't exactly want to do that to 1100 files, so I wrote a clumsy one-liner that turned into a two-liner:

find . ( -name build_out -o -name toolchain -o -name 3rdparty ) -prune -o \ ( -name '.c' -o -name '.h' -o -name '.mk' -o -name '.py' -o -name Makefile -o -name '.ld' ) \ -exec gsed -i -E 's/[[:space:]]$//' {} \; \ -exec gsed -i -E 's/\r\n/\n/' {} \;

find . ( -name build_out -o -name toolchain -o -name 3rdparty ) -prune -o \ ( -name '.c' -o -name '.h' ) \ -exec bash -c 'expand -t 4 "$0" > /tmp/e && mv /tmp/e "$0" && chmod 0644 "$0";' {} \;

The version used in the HTML directory was different yet, but still recognizable from above. find . ( -name build_out -o -name toolchain -o -name 3rdparty ) -prune -o \ ( -name '.html' -o -name '.txt' -o -name '.svg' -o -name '.py' -o -name Makefile ) \ -exec gsed -i -E 's/[[:space:]]*$//' {} \; \ -exec gsed -i -E 's/\r\n/\n/' {} \;

If you want to get serious about them never slipping in again, use a git commit hook to look for and either reject or fix this on checkin so it doesn't happen again. Please do get internal developers to configure their editors to do this for them.

Thank you.

YafeiJin commented 4 years ago

Thanks for your detailed description. We will follow your guide for the future release.