1 / 16

ROOT Rule Checker

ROOT MEETING Jose Lo 22/04/2005. ROOT Rule Checker. What is Rule Checker. A software developed by Software Engineering Research Group at ITC-Irst. A tool that verifies automatically the coding conventions. ROOT coding conventions based on Taligent Rules. How to run the Rule Checker.

edita
Download Presentation

ROOT Rule Checker

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ROOT MEETING Jose Lo 22/04/2005 ROOT Rule Checker

  2. What is Rule Checker • A software developed by Software Engineering Research Group at ITC-Irst. • A tool that verifies automatically the coding conventions. • ROOT coding conventions based on Taligent Rules

  3. How to run the Rule Checker • To check all files • make check-all • To check one specific module (e.g. base) • make check-base • Will create a sub-directory “check” • Violations files in *.viol • To check one specific file • g++ -E -I... file.cxx > file.i • patch4alice.prl file.i • java rules.ROOT.RuleChecker file.i > file.viol

  4. Rules • RN 1 – Names should be chosen with care and should be meaningful. • RN 2 – In names that consist of more than one word: • The words are written together. • The first letter of the name can be lower case or capitalized (depends on the entity). • The first letters of the other words are always capitalized.

  5. Rules (cont.) • RN 3 – Types begin with a capital letter and end with '_t' • RN 4 – Base classes begin with 'T' • RN 6 – Enumeration types begin 'E' • RN 7 – Avoid Raw C types • RN 9 – Attributes begin with 'f' and functions begin with a capital letter

  6. Rules (cont.) • RN 10 – Static variables begin with 'g' • RN 11 – Static data members begin with 'fg' • RN 12 – Local variables and parameters begin with a lowercase word • RN 13 – Constants begin with 'k', including names of enumeration, constants and constants statics

  7. Table Table

  8. Example - RN3 RULE RN3 violated: @ Type begin with a capital letter and end with '_t' --> The Type: uuid_time_t in file TUUID.h does not start with a capital letter -------------------------------------------------- class TUUID { .... struct uuid_time_t { UInt_t high; UInt_t low; };

  9. Example - RN4 @ Classes name begin with "T" --> the Class: RStl does not start with a 'T' -------------------------------------------------- class Rstl { ...

  10. Example – RN 6 RULE RN6 violated: @ Enumeration types begin with"E" --> the enumerator: action [file: Match.cxx 40] does not start with "E" -------------------------------------------------- enum action { M_BOL = (0x8000 | '^'), M_EOL = (0x8000 | '$'), M_ANY = (0x8000 | '.'), ..... };

  11. Example - RN7 RULE RN7 violated: @ Avoid using C raw types --> the member data: n in class: TSystem in method: ExpandFileName() [TSystem.cxx 857] is a raw C type: int -------------------------------------------------- const char *TSystem::ExpandFileName(const char *fname) { .... int n, ier, iter, lx, ncopy;

  12. Example – RN 9 RULE RN9 violated: @ Member function names start with a capital --> the method: cd(const char *): Bool_t in class: TDirectory does not start with a capital -------------------------------------------------- Bool_t TDirectory::cd(const char *path) { ... }

  13. Example – RN 10 RULE RN10 violated: @ Static variables start with a prefix "g" @ applies to static variables in functions and global variables --> the static data member: framewasdrawn in class: null does not start with a prefix "g" -------------------------------------------------- void TView::ExecuteRotateView(Int_t event, Int_t px, Int_t py) { static Int_t system, framewasdrawn; ...

  14. Example – RN 11 RULE RN11 violated: @ Static data member names start with a prefix "fg" --> the static data member: s_objectTable in class: MemoryRegulator does not start with a prefix "fg" -------------------------------------------------- class MemoryRegulator : public TObject { .... static objmap_t s_objectTable;

  15. Example – RN 12 RULE RN12 violated: @ Local variables names start with a lower case letter --> the variable: X [file: TMath.cxx 987] in function: Voigt(Double_t, Double_t, Double_t, Int_t): Double_t does not start with a lower case letter -------------------------------------------------- Double_t TMath::Voigt(Double_t x, Double_t sigma, Double_t lg, Int_t R) { .... Double_t X, Y, K;

  16. Example – RN 13 RULE RN13 violated: @ Constant, including names in enumeration types @ and constant static start with a prefix "k" --> the constant: p1 [TMath.cxx 3237] does not start with a prefix "k" -------------------------------------------------- Double_t TMath::BesselI1(Double_t x) { .... const Double_t p1=0.5, p2=0.87890594, p3=0.51498869,

More Related