Skip to main content

auto-formatter for modern fortran source code

Project description

License: GPL v3

fprettify is an auto-formatter for modern Fortran code that imposes strict whitespace formatting.

Features

  • Auto-indentation.

  • Line continuations are aligned with the previous opening delimiter (, [ or (/ or with an assignment operator = or =>. If none of the above is present, a default hanging indent is applied.

  • Consistent amount of whitespace around operators and delimiters.

  • Removal of extraneous whitespace and consecutive blank lines.

  • Works only for modern Fortran (Fortran 90 upwards).

  • Tested for editor integration.

  • By default, fprettify causes changes in the amount of whitespace only and thus preserves revision history.

Example

program demo
integer :: endif,if,else
endif=3; if=2
if(endif==2)then
endif=5
else=if+4*(endif+&
2**10)
else if(endif==3)then
print*,endif
endif
end program

⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩ fprettify ⇩⇩⇩⇩⇩⇩⇩⇩⇩⇩

program demo
   integer :: endif, if, else
   endif = 3; if = 2
   if (endif == 2) then
      endif = 5
      else = if + 4*(endif + &
                     2**10)
   else if (endif == 3) then
      print *, endif
   endif
end program

Usage

Autoformat file1, file2, … inplace by

fprettify file1, file2, ...

The default indent is 3. If you prefer something else, use --indent n argument. For more options, read

fprettify -h

For editor integration, use

fprettify --silent

For instance, with Vim, use fprettify with gq by putting the following commands in your .vimrc:

autocmd Filetype fortran setlocal formatprg=fprettify\ --silent

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

fprettify-0.3.1.tar.gz (15.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

fprettify-0.3.1-py2.py3-none-any.whl (19.2 kB view details)

Uploaded Python 2Python 3

fprettify-0.3.1-py2.7.egg (35.0 kB view details)

Uploaded Egg

File details

Details for the file fprettify-0.3.1.tar.gz.

File metadata

  • Download URL: fprettify-0.3.1.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for fprettify-0.3.1.tar.gz
Algorithm Hash digest
SHA256 8a6452fad3ee4520cefe936cfadb762fe9e53aabead7896889eac4fedf173cc3
MD5 707cded1394acdff3d14b29b1f610fb3
BLAKE2b-256 089fac5475e675ae8f15327f7b3edf435bf3d3a216b971f8347895fb961e36df

See more details on using hashes here.

File details

Details for the file fprettify-0.3.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for fprettify-0.3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bdf565056aa35d134126c78a7af6ebbea7aa0658ab3b8ca623e5278537296f85
MD5 e90a1808f10cca9d1624bd9824a6150c
BLAKE2b-256 3f80b61dc3491cc79bfdd8d98dce38193840d1f3067a7f8cb1c2c4959595b18c

See more details on using hashes here.

File details

Details for the file fprettify-0.3.1-py2.7.egg.

File metadata

  • Download URL: fprettify-0.3.1-py2.7.egg
  • Upload date:
  • Size: 35.0 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for fprettify-0.3.1-py2.7.egg
Algorithm Hash digest
SHA256 438010a346c1dacad89ffac34ca8e0bb6c57ec07f8a7e8c01afc0f2f28843b2e
MD5 31b0be042777ca411da00a1a738a0ef4
BLAKE2b-256 bb513d334880c2bcc2ec25a1da72358360c9c9a86d5827a2690574a680271247

See more details on using hashes here.

Supported by

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