Avoid [x;;] notation in formatted code

Open Beginner friendly
#422 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
julia
Domain
tooling

Research direction

Start by inspecting .dev/climaformat.jl and searching the repository for [x;;]-style one-by-one matrix literals. Replace affected cases with the suggested fill(x, 1, 1) form, then run the formatter and the tests that currently break to confirm the result remains a 1×1 matrix.

Written by the indexing model from the issue text.

Description

Issue

It appears that the following fails the julia-formatter .dev/climaformat.jl

x = 3.0
one_by_one_mat = [x;;]

Instead, julia formatter will convert this to

x = 3.0
one_by_one_mat = [x] # <- no longer a matrix!

Which breaks tests.

Temporary solution

As this seems to be a funk in the JuliaFormatter package rather than the wrapper, I'd advise replacing it with

x = 3.0
one_by_one_mat = fill(x,1,1)
Dominant language
Julia
Stars
90
Forks
16
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

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.

More from CliMA/CalibrateEmulateSample.jl

All issues in CliMA/CalibrateEmulateSample.jl

Similar issues

More Julia issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.