Available Rules#

You are now ready to get started developing your own styles. All you need now are a list of the available rules.

Language-agnostic Rules#

Some rules are widely applicable regardless of source language.

class stylist.rule.TrailingWhitespace

Examines the text for white space at the end of lines. This includes lines which consist entirely of white space.

Fortran Rules#

Rules relating to Fortran source code.

class stylist.fortran.AutoCharArrayIntent

Checks that all automatically assigned character arrays used as subroutine or function arguments have intent(in) to avoid writing outside the given array.

class stylist.fortran.ForbidUsage(name, exceptions=())

Checks that no attempt is made to use the specific module unless it is in one of the excepted modules.

Parameters:
  • name (str) – Name of module to forbid.

  • exceptions (Sequence[Union[str, Pattern]]) – names (or name patterns) in which module may be used.

class stylist.fortran.FortranCharacterset

Traps any characters which do not fall in the list of those allowed in Fortran source. This takes into account the fact that there is no restriction on what may appear in comments or strings.

class stylist.fortran.IntrinsicModule

Catches cases where an intrinsic module is used with the “intrinsic” keyword ommitted.

class stylist.fortran.KindPattern(*, integer=None, real=None)

Ensures kind names match a specified pattern.

Patterns are set only for integer and real data types however Fortran supports many more. Logical and Complex for example. For those cases a default pattern of “.*” is used to accept anything.

Parameters:
  • integer (Union[str, Pattern, None]) – Regular expression which integer kinds must match.

  • real (Union[str, Pattern, None]) – Regular expression which real kinds must match.

class stylist.fortran.LabelledDoExit

Catches cases where a “do” construct is exited but not explicitly named.

class stylist.fortran.MissingImplicit(require_everywhere=False)

Catches cases where code blocks which could have an implicit statement don’t.

Parameters:

require_everywhere (Optional[bool]) – By default the rule checks only in places which require an implicit statement. Set this argument to check everywhere an implicit could exist.

class stylist.fortran.MissingIntent

Catches cases where a function or subroutine’s dummy arguments don’t have specified intent.

class stylist.fortran.MissingOnly(ignore=None)

Catches cases where a “use” statement is present but has no “only” clause.

Parameters:

ignore (Optional[List[str]]) – List of module names which are not required to have an “only” clause.

class stylist.fortran.MissingPointerInit

Catches cases where a pointer is declared without being initialised.

class stylist.fortran.NakedLiteral(integers=True, reals=True)

Checks that all literal values have their kind specified.

Checking of integers and reals are controlled separately so you can have one and not the other.