Use CodeNarc for code quality check

I add the codenarc plugin to run code quality checks using CodeNarc. 
Then I fix a lot of problems reported by this tool.