Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Strict mode' needs a rethink #8

Closed
LiamPattinson opened this issue Jan 22, 2024 · 0 comments · Fixed by #15
Closed

'Strict mode' needs a rethink #8

LiamPattinson opened this issue Jan 22, 2024 · 0 comments · Fixed by #15

Comments

@LiamPattinson
Copy link
Collaborator

There is currently a 'strict' mode which has the effect on turning on additional rules that may be controversial:

  • Insisting that use some_module is instead use some_module, only: ...
  • Tell the user off if they put implicit none in a module, and then also put it in contained functions.

A more recent addition also strengthens some rules:

  • There's a rule that catches accidental loss of precision in statements like real(dp), parameter :: pi = 3.14159265358979, and recommends correcting it to real(dp), parameter :: pi = 3.14159265358979_dp. It only triggers if the floating point literal has at least 6 significant figures. Under strict mode, it will also complain if you type 2.0 instead of 2.0_dp, as this may have serious consequences if you call something like sqrt(2.0) when you intended sqrt(2.0_dp)*.
  • The line length rule allows the user to set any preferred line length they want. Under strict mode, it caps this to 132 characters, as this is the maximum set by the Fortran standard. However, most modern compilers allow users to bypass this.

An issue with this model is that users may only want a selection of rules to be stricter, but the --strict flag changes the behaviour of all rules with a strict option. It may be better to implement per-rule strictness controls, or to do away with the two-tiered strictness idea entirely. I would argue for the two rules above that the non-strict interpretations aren't safe anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant