Is there a PEP8 for Julia?

Is there a Guide to “pretty” Julia code yet? Meaning somehting similar to PEP8 and PEP250 (was it that numbers) from python?

Also: is there a linter for Atom / Juno yet?

Greetings!

6 Likes

https://github.com/johnmyleswhite/Style.jl was referenced for some time, i don’t know the current status.

2 Likes

I should really update that. At this point, I would tend to go with the Julia one: http://docs.julialang.org/en/stable/manual/style-guide/

5 Likes

There is a lint package:

but I haven’t heard anything about integration with Juno.

1 Like

I am also interested of the topic. I did some searching and found this issue:
https://github.com/JuliaEditorSupport/atom-language-julia/issues/8

If I understood correctly, it was almost working already.

I ended up doing the package myself:
https://github.com/TeroFrondelius/linter-julia
It’s not yet published, but if someone wants to test drive, there are basic functionalities in place.

3 Likes

FYI, for others finding this question years later, all of the packages have not been updated for a year. This is somewhat expected, given Julia just when through a big version jump and isn’t used by enough Big Corporate Teams to worry by minutia like:

  • How may line-breaks to put between module/functions/imports?
  • Spacing around operators
  • Formatting of type annotations
  • Docstring format

However, I’m still replying to this topic to get notified when the community decides this is a priority.

Personally I find PEP8 overly restrictive and pretty annoying, though I do think having a standardized doc-string format is a really good idea, so a big +1 to that.

3 Likes

I too tend to find such guides a bit overly restrictive, and I think it shifts focus from far more important factors (writing clean, DRY, reusable, maintainable code).

For the latter, there’s the Julia Style Guide.

When it comes to formatting, I think the General Formatting Guidelines for Julia code contributions are great, not too restrictive.

2 Likes

Anything new in this area?

About a general style guide or a formatting tool? There is no ecosystem-wide style guide, there are some different guides. As a formatting tool there is JuliaFormatter.jl, which supports some those styles. I believe it’s also integrated in some IDEs like the Julia VS Code plugin

5 Likes

Some popular guides include BlueStyle and YASGuide.

2 Likes