Skip to content

Avoid [x;;] notation in formatted code #422

Open

Description

@odunbar

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)

Activity

  1. changed the title [-]Avoid [x;;] notation in src/[/-] [+]Avoid [x;;] notation in formatted code[/+] on May 18, 2026
  2. odunbar commented on May 25, 2026

    @odunbar
    MemberAuthor

    Solution

    Turns out this is just because julia formatter is outdated. Patching works. And maybe we should include this directory (and maybe docs/ in compat-helper

    One update would be:

    name: CompatHelper
    
    on:
      schedule:
        - cron: '0 0 * * *'
      workflow_dispatch:
    
    jobs:
      CompatHelper:
        runs-on: ubuntu-latest
    
        steps:
          - uses: actions/checkout@v4
    
          - uses: julia-actions/install-juliaup@v1
    
          - name: Install CompatHelper
            run: julia -e 'using Pkg; Pkg.add("CompatHelper")'
    
          - name: Run CompatHelper
            env:
              GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
              COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }}
            run: |
              julia -e '
                using CompatHelper
                CompatHelper.main(
                    subdirs=[
                        "",
                        "docs",
                        ".dev",
                    ]
                )
              '
  3. odunbar commented on May 25, 2026

    @odunbar
    MemberAuthor

    NB it turns out that maybe dependabot is the preferred tooling now over compathelper...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions