trixi-framework / trixi-framework/TrixiParticles.jl

Bikeshedding: Error messages and comments

Open
#133 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion
Dominant language
Julia
Stars
83
Forks
24
Avg merge
8d 18h
Merged PRs (30d)
3

Description

I'm sorry for the major bikeshedding, but let's settle this once and for all to avoid future bikeshedding in PRs.

How do we want error messages to look like?

  1. Should the first word be capitalized or not?
  2. Punctuation: When the message is just one sentence or a sentence fragment, should we end it with a period or exclamation mark, or no punctuation?

In Julia, sentence fragments starting with lowercase and no punctuation seem to be preferred:
grafik

julia> Dict{1,2 ,3 }
ERROR: too many parameters for type

julia> if 4
       end
ERROR: TypeError: non-boolean (Int64) used in boolean context

julia> sqrt(-1)
ERROR: DomainError with -1.0:
sqrt will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).
Stacktrace:
 [1-2] ⋮ internal
     @ Base.Math, Unknown
   [3] sqrt(x::Int64)
     @ Base.Math ./math.jl:1372
Use `err` to retrieve the full stack trace.

julia> f()
ERROR: UndefVarError: f not defined

julia> Int(1e100)
ERROR: InexactError: Int64(1.0e100)
Stacktrace:
   [1] Int64(x::Float64)
     @ Base ./float.jl:788

julia> x = []; x[1]
ERROR: BoundsError: attempt to access 0-element Vector{Any} at index [1]
Stacktrace:
   [1] getindex(A::Vector{Any}, i1::Int64)
     @ Base ./array.jl:924

But not consistent outside of base:

julia> using sfdljoisdf
ERROR: ArgumentError: Package sfdljoisdf not found in current path.
- Run `import Pkg; Pkg.add("sfdljoisdf")` to install the sfdljoisdf package.

Same for comments, while we're at it:

  1. Should comments start with a lowercase letter?
  2. Should sentence fragments end with a period?
  3. Should full sentences end with a period? (Of course, when the comment consists of multiple sentences, we end all of them with a period.)

My personal opinion (when I say no opinion, I still want us to pick one and use it consistently):

  • No opinion about starting error messages with lower or upper case.
  • No opinion about ending without punctuation or with a period, but I am strongly against exclamation marks (too aggressive).
  • I prefer starting comments with an uppercase letter.
  • I prefer no punctuation for comments unless there are multiple sentences, in which case I end all of them with a period. (I prefer not to add periods after links to avoid breaking the link when copying it.)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. Start by reading the issue and its discussion, then survey the project's existing error messages and comments; done means the project has an agreed, documented convention that can be applied consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
developer-experience
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.