numenta / nupic.core-legacy

Implementation of core NuPIC algorithms in C++ (under construction)
http://numenta.org
GNU Affero General Public License v3.0
272 stars 276 forks source link

Adopt or implement a `lint` tool and write rules to validate and ensure conventions #70

Open utensil opened 10 years ago

utensil commented 10 years ago

As @breznak suggested at https://github.com/numenta/nupic.core/issues/41#issuecomment-39838146 and http://lists.numenta.org/pipermail/nupic-hackers_lists.numenta.org/2014-April/000521.html :

nupic.core should adopt or implement a lint tool and write rules to validate and ensure conventions .

rhyolight commented 10 years ago

:+1: Help wanted.

rhyolight commented 10 years ago

(By the way, Marek is @breznak!)

utensil commented 10 years ago

@rhyolight commented 2 hours ago

(By the way, Marek is @breznak!)

Aha! :wink:

utensil commented 10 years ago

As @breznak suggested in https://github.com/numenta/nupic.core/pull/71#issuecomment-40406141:

It'd be nice having it run as a github "check hook" http://stackoverflow.com/questions/2574416/testing-of-coding-and-naming-conventions-of-c-c-code

Also cc @david-ragazzi

utensil commented 10 years ago

At least we have the following two tools for linting:

They are good at detecting code defects(which is definitely useful), but neither of them or the other tools I can find can check style stuff like the following(mentioned in C Coding Guide ):

rcrowder commented 10 years ago

Plus Google's http://google-styleguide.googlecode.com/svn/trunk/cpplint/cpplint.py that enforces Google C++ Style Guide http://google-styleguide.googlecode.com/svn/trunk/cppguide.html

Also, looking at Vera++ https://bitbucket.org/verateam/vera/wiki/Home

Not sure how these would work automatically with github hooks? Are we just after a report from the lint?

utensil commented 10 years ago

Vera++ looks awesome!

rcrowder commented 9 years ago

To see the extent of Lint changes I've done a quick pass over src/ using Vera++ My feature branch below has .vera files alongside the cpp, hpp, c, and h files.

https://github.com/rcrowder/nupic.core/tree/70-adding-lint/src

I used the rules supplied, no custom rules or transformations used. Just -nofail and -nodup options (see vera.bat).

The majority of the changes are expected. Doesn't seem like too much work to handle this initially. Then find some way to add it to a CI build and report any issues back into the tooling system?

At some point comparison passes with an other lint tools needs to be made. Such as with cpplint.py or Cppcheck.

CC @breznak @david-ragazzi

rhyolight commented 9 years ago

@rcrowder Before adding this to CI, let's make sure developers can run in a git pre-commit hook. Do you know how to set that up?

rcrowder commented 9 years ago

@rhyolight I have seen that, but not tried it out. I'll leave that branch up, but going to finish the windows port first. Most of the issues found by Vera++ are fairly trivial changes. Something for a newbie maybe..

utensil commented 8 years ago

I understand I haven't been able to work on nupic.core lately and I'm not sure when would I be able to work on this issue, but after I saw https://github.com/numenta/nupic.core/pull/890#issuecomment-239029920 , I found this old issue and assigned this to myself (thanks to the multiple-assignee feature) and I do have some related work lately involving cppcheck and coverity(related to #61 ).

And this issue is also related to #945