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

Programmatically check/enforce "agreed upon" style and conventions #6

Open
zbeekman opened this issue Jan 12, 2016 · 7 comments
Open

Comments

@zbeekman
Copy link
Member

AKA make a "linter" or style audit tool.

It would be great to be able to have a tool to check conformance of program source code to a set of style guides, as well as check for dubious constructs. Ideally such a tool would have the ability to include or exclude individual rules, and print warnings showing the offending constructs, their line number, and which file they are found in, along with an exit status to indicate success (no offenses) or failure. Additionally it would be wonderful to be able to add custom rules in a simple syntax, to allow projects that don't agree with the set of common guidelines we come up with to add their own.

Obviously, this is a very long term goal, and to a degree I may be putting the cart before the horse here: First we need to come to a consensus, or at least a compromise, of what the rules of style are, before we start thinking of ways to detect whether or not they are being violated.

Additionally we're going to need to consider how to implement such a tool: Do we need a full parser for the entire Fortran language, or could we do something more quick and dirty based on regular expressions etc.

Also, if we decide to create such a tool what language etc. should we use? We could use Fortran itself, however, even with some nice recent improvements like deferred length characters and reallocation on assignment, other languages, like Python, might be quicker and easier to implement such a tool.

@zbeekman zbeekman changed the title Programmatically check enforce "agreed upon" style and conventions Programmatically check/enforce "agreed upon" style and conventions Jan 12, 2016
@cmacmackin
Copy link
Collaborator

Not wanting to blow my own horn, but FORD might be useful for this. What
we could do is use it as a library to build up its internal model of the
code and then write another program with rules to analyze names etc. of
different entities. This would not be the only analysis we'd want to do,
as it would not be able to analyze things like line length and
indentation (that information is lost early on in its processing), but
it could be a good start.

On 12/01/16 12:23, Izaak Beekman wrote:

AKA make a "linter" or style audit tool.

It would be great to be able to have a tool to check conformance of
program source code to a set of style guides, as well as check for
dubious constructs. Ideally such a tool would have the ability to
include or exclude individual rules, and print warnings showing the
offending constructs, their line number, and which file they are found
in, along with an exit status to indicate success (no offenses) or
failure. Additionally it would be wonderful to be able to add custom
rules in a simple syntax, to allow projects that don't agree with the
set of common guidelines we come up with to add their own.

Obviously, this is a very long term goal, and to a degree I may be
putting the cart before the horse here: First we need to come to a
consensus, or at least a compromise, of what the rules of style are,
before we start thinking of ways to detect whether or not they are
being violated.

Additionally we're going to need to consider how to implement such a
tool: Do we need a full parser for the entire Fortran language, or
could we do something more quick and dirty based on regular
expressions etc.

Also, if we decide to create such a tool what language etc. should we
use? We could use Fortran itself, however, even with some nice recent
improvements like deferred length characters and reallocation on
assignment, other languages, like Python, might be quicker and easier
to implement such a tool.


Reply to this email directly or view it on GitHub
#6.

Chris MacMackin
cmacmackin.github.io http://cmacmackin.github.io

@zbeekman
Copy link
Member Author

@cmacmackin FORD is an incredibly useful and powerful tool. Using it as a library, or extracting logic from it could be a great way to bootstrap a linter/style audit tool.

@cmacmackin
Copy link
Collaborator

I'd have to think about it a bit more, but I think I'd prefer to fork
the useful parts of FORDs code rather than use it as a library. I'm not
sure that I'm willing to commit to maintaining an API for its internals.

On 12/01/16 12:32, Izaak Beekman wrote:

@cmacmackin https://github.com/cmacmackin FORD is an /incredibly
useful and powerful/ tool. Using it as a library, or extracting logic
from it could be a great way to bootstrap a linter/style audit tool.


Reply to this email directly or view it on GitHub
#6 (comment).

Chris MacMackin
cmacmackin.github.io http://cmacmackin.github.io

@szaghi
Copy link
Member

szaghi commented Jan 12, 2016

@zbeekman

AKA make a "linter" or style audit tool.

You are into my mind, confess! I am almost sure to have suggested such a thing into google group CLF without obtaining any interests 😢

@cmacmackin
Yes, I was also thinking to FORD (not only as a linter, I will in the future grab your secrets for FoBiS...).

However, I think @zbeekman is too futuristic: we have just started to discuss 😄

P.S. in only two posts I have learned a lot of slang:

  • putting the cart before the horse: in Italy we say ox instead of horse, maybe because Italy is slow and US fast...
  • blow my own horn: wonderful.

@zbeekman
Copy link
Member Author

However, I think @zbeekman is too futuristic: we have just started to discuss 😄

@szaghi yes I know this is a far out, pie in the sky proposal, but I think it helps motivate the conversation. I certainly don't expect to see any progress here in the immediate future.

@szaghi
Copy link
Member

szaghi commented Jan 12, 2016

@zbeekman I agree, I was just trying to teasing you 😄

@jacobwilliams
Copy link
Member

I also vote for a Fortran linter (something sorely needed). If it's based on FORD, then all the better!

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

No branches or pull requests

4 participants