Styles — Stylist 0.3.dev1 documentation

# Styles

Styles are defined in a configuration file by `stylist.style.Style` objects.

## Extending an Existing Style

To add a new rule to an existing style just add an instance of the rule class to the constructor argument list. You may need to modify the `import` statements to make it available for use.

For instance:

     from stylist.fortran import (FortranCharacterset,
    -                             MissingImplicit)
    +                             MissingImplicit,
    +                             MissingOnly)
     from stylist.rule import TrailingWhitespace
     from stylist.style import Style

     lfric = Style(
                   FortranCharacterset(),
                   TrailingWhitespace(),
    -              MissingImplicit()
    +              MissingImplicit(),
    +              MissingOnly(ignore=['pfunit_mod', 'xios'])
                  )

## Adding a New Style

As intimated above, this a simple matter of creating a new style object variable.

     from stylist.fortran import (FortranCharacterset,
                                  MissingImplicit,
                                  MissingOnly)
     from stylist.rule import TrailingWhitespace
     from stylist.style import Style

     lfric = Style(
                   FortranCharacterset(),
                   TrailingWhitespace(),
                   MissingImplicit(),
                   MissingOnly(ignore=['pfunit_mod', 'xios'])
                  )

    +special = Style(FortranCharacterset(),
    +                TrailingWhitespace(),
    +                MissingImplicit())