Skip to main content

Extensible code style checker currently supporting Fortran, PSyclone DSL, etc

Project description

Stylist

Stylist is a code style checking tool built on a framework which supports multiple styles across multiple languages.

But aren't there many code style checking tools out there, why create a new one?

The simple reason is that few of them support Fortran, a language still in widespread use in the scientific computing domain. They can also tend towards the zealous when enforcing the "one true style" whereas long running science models tend to diverge quite radically in what they like, style-wise.

Large models also tend to be implemented using more than one language so a tool which is capable of understanding all of them would be welcomed by science developers.

Thus a tool was developed based on a framework which hopes to support ready extension and reconfiguration.

The project is still in its infancy so only a few rules have been implemented and only for Fortran. Stubs are provided to show how it might be extended to support C.

Find the project at https://github.com/MetOffice/stylist

Installation

Installation can be as simple as pip install stylist or conda install -c conda-forge stylist.

As always it is also possible to install from the project source by running python setup.py. The source may be obtained by downloading a tarball or by cloning the repository.

Usage

Stylist provides a command-line tool stylist for normal use. It can also be used as a package if you want to integrate it with another tool. Documentation regarding this second option is maintained in the project wiki.

On the Command Line

The command-line tool is not complicated to use:

stylist [-help] [-verbose] [-configuration FILENAME] [-style NAME] FILE ...

The only required arguments are one or more filenames. These are the files which will be checked. If a directory is specified then the tool will automatically descend into it checking all files which it recognises by extension.

If you want a running commentary of what the tool is doing then use the -verbose argument.

A configuration file may specified with -configuration . This file should be formatted as documented below.

The configuration may define several styles, in which case one can be chosen using the -style argument. If it is not then the first in the configuration file will be used.

Configuration File

The configuration file is in Windows .ini format.

The processing pipelines for different file types are specified in the file-pipe section. Each key is the file extension and the value a colon separated list of processors starting with the language. See stylist -help for a list of processors.

[file-pipe]
x90=fortran:pfp:fpp

Styles are defined in sections called style.<name>. In this section is expected a key rules with a comma separated list of rules as the value. These rules may take parameters which are presented in parenthesis.

[style.<name>]
rules = FortranCharacterset, KindPattern(integer='i_.*', real='r_.*')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stylist-0.2.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

stylist-0.2-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file stylist-0.2.tar.gz.

File metadata

  • Download URL: stylist-0.2.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.3 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.8

File hashes

Hashes for stylist-0.2.tar.gz
Algorithm Hash digest
SHA256 581bb33a86d7637cb54fcd8b3c572e52397d0dcb60d3c5fdb48755a6d88e566d
MD5 f4d451c46ce5e0b85d0471576ea44fdf
BLAKE2b-256 81dbd47e35b90c0ddd2862cb3d7c7ee254ee006fc50a0c589d38ab9d56db94b6

See more details on using hashes here.

File details

Details for the file stylist-0.2-py3-none-any.whl.

File metadata

  • Download URL: stylist-0.2-py3-none-any.whl
  • Upload date:
  • Size: 21.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.3 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.8

File hashes

Hashes for stylist-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 269c1228b03b32722c114254c1ba6621a7c27d4a86762ce18273b8b8eda1f145
MD5 3c6018ff6319cf309284282d259168b0
BLAKE2b-256 c92fe90bcd9db9b762faeebdba20a6164ae936e27e1aaab6cbeb99a92cfdc163

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page