intel/dml-language-server

Implement rules for tracking naming conventions for identifiers, variables, methods, types, device and object names

Opened this issue · 0 comments

Implement capability for the lint module to report recommended style guide conventions on naming for identifiers of all kinds.

General
  • NN1 In absence of other rules, identifiers are written in lower case letters, words separated by underscores
  • NN2 Do not append a number as a general method to create new identifiers, other than in very special circumstances
Method names
  • NM1 Methods that are executed primarily for their side-effect should be named after what they do. Methods executed for their return value should be named after what they return. If the method is a predicate (returning a boolean value), it should be named after the condition when it returns a true value
Variable and object names
  • NV1 Variables should be named after what they contain, not from the variable or its type. The more local a variable is, the shorter can be its name. Use long, descriptive names for top-level names; use short names in local scopes. Names more frequently used can also be shorter
  • NV2 In particular, do not use tmp or ptr in identifiers; it is rare that it is needed to point out that a variable contains a temporary value or a pointer
  • NV3 Do not prefix names with an article, such as an_object or the_score
Type names
  • NT1 Typedef names should end in _t. Typedef structs unless only used locally