Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ For more options, read
fprettify -h
```

When cleaning up inline comments, `--strip-comments` removes superfluous whitespace in front of comment markers. Combine it with `--comment-spacing N` to specify how many spaces should remain between code and the trailing comment (default: 1).

## Editor integration

For editor integration, use
Expand Down
6 changes: 3 additions & 3 deletions fortran_tests/after/example.f90
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ program example_prog
do l = 1, 3
do i = 4, 5
do my_integer = 1, 1
do j = 1, 2
write (*, *) test_function(m, r, k, l) + i
end do
do j = 1, 2
write (*, *) test_function(m, r, k, l) + i
end do
end do
end do
end do
Expand Down
6 changes: 3 additions & 3 deletions fortran_tests/after/example_swapcase.f90
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ PROGRAM example_prog
DO l = 1, 3
DO i = 4, 5
DO my_integer = 1, 1
DO j = 1, 2
WRITE (*, *) test_function(m, r, k, l) + i
END DO
DO j = 1, 2
WRITE (*, *) test_function(m, r, k, l) + i
END DO
END DO
END DO
END DO
Expand Down
15 changes: 15 additions & 0 deletions fortran_tests/after/indent_single_line_if.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
subroutine format_params(param_indices, code)
integer, allocatable :: param_indices(:)
character(len=:), allocatable :: code
integer :: i
if (allocated(param_indices) .and. size(param_indices) > 0) then
code = code//"("
do i = 1, size(param_indices)
if (i > 1) code = code//", "
if (param_indices(i) > 0) then
code = code//"value"
end if
end do
code = code//")"
end if
end subroutine format_params
15 changes: 15 additions & 0 deletions fortran_tests/before/indent_single_line_if.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
subroutine format_params(param_indices, code)
integer, allocatable :: param_indices(:)
character(len=:), allocatable :: code
integer :: i
if (allocated(param_indices) .and. size(param_indices) > 0) then
code = code // "("
do i = 1, size(param_indices)
if (i > 1) code = code // ", "
if (param_indices(i) > 0) then
code = code // "value"
end if
end do
code = code // ")"
end if
end subroutine format_params
5 changes: 3 additions & 2 deletions fortran_tests/test_results/expected_results
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
example.f90 : f5b449553856f8e62b253402ed2189044554f53c9954aad045db44ff3c2d49b7
example.f90 : 39c6dc1e8111c867721ec3ab45a83ea0e7ef6c5b9bef8ff325bbb7816ba36228
RosettaCodeData/Task/100-doors/Fortran/100-doors-1.f : b44289edb55a75ca29407be3ca0d997119253d4c7adb5b3dfc1119944036ab0f
RosettaCodeData/Task/100-doors/Fortran/100-doors-2.f : 263122b2af3e3637a7dab0bc0216dec27d76068b7352e9ab85e420de625408be
RosettaCodeData/Task/24-game-Solve/Fortran/24-game-solve-1.f : 8927cfcfe15685f1513ed923b7ac38058358ec6586de83920679b537aa5b2d03
Expand Down Expand Up @@ -2177,7 +2177,7 @@ cp2k/src/xtb_coulomb.F : 0f3a97d48e2aa9883e052afaa9c0c834fcc1c00eeeab81df508e040
cp2k/src/xtb_matrices.F : e9b617ac1ec85b8bfb04c4030e67ac6a18d16586ad7252d112e4aa7bf0a10936
cp2k/src/xtb_parameters.F : 30320b3ecb2187e4a0f81bff8f27c5474e77b3ce7fe1c16a1de61c5eb69e7889
cp2k/src/xtb_types.F : a34cc5d2cd61bfa2c6194e0413e7772391a59e92add52e50d01e199897662b13
example_swapcase.f90 : 8dfac266553a438deb71e3faf5aeb97cd067a004c5cf61cda341237cd6328d55
example_swapcase.f90 : a674964b61e60ce4e11064880fe05555cb101d7e44079aecc1e02cf4d70899d0
where_forall.f90 : 11062d8d766cce036a0c2ed25ce3d8fe75fee47ab1e6566ec24c6b0043f6ffea
cp2k/src/almo_scf_lbfgs_types.F : 4dea88ca22891e587a0b0dc84b2067f23f453cdcb9afebf953b5b0237c4391db
cp2k/src/common/callgraph.F : 5a54e42c7a616eae001f8eb9dc1efe73d9eb92b353a763b1adfbec1e20c7179d
Expand Down Expand Up @@ -2265,3 +2265,4 @@ cp2k/src/xas_tdp_types.F : 728f382598e79fa0e7b3be6d88a3218fea45e19744bbe7bdaaa96
cp2k/src/xas_tdp_utils.F : 002dfdc6e9d5979516458b6f890950bd94df49e947633a7253b46be5f3fd7d61
cp2k/src/xc/xc_sr_lda.F : 094099ac92a6749028c004d37b7646e2af7de402ee5804de27192b56588cc7fe
cp2k/src/xtb_ehess.F : 45fe2c022760195affb0fd5155d865b6deac896cf6e6714e772bef04afad4be2
indent_single_line_if.f90 : 4f4c540d9783d9dbca9c5ef8819f34c5414ef73e61f76547a6c68c00fab21151
Loading