ruby-syntax-tree / syntax_tree

Interact with the Ruby syntax tree
https://ruby-syntax-tree.github.io/syntax_tree/
MIT License
563 stars 54 forks source link

Comments in long call chains regressed in 6.2.0 #411

Open CvX opened 11 months ago

CvX commented 11 months ago

formatting in 6.1.1:

    keys =
      ApiKey
        .where(hidden: false)
        .includes(:user, :api_key_scopes)
        # Sort revoked keys by revoked_at and active keys by created_at
        .order("revoked_at DESC NULLS FIRST, created_at DESC")
        .offset(offset)
        .limit(limit)

formatting in 6.2.0 (includes() is split into multiple lines, the comment is now next to the ), . on its own line)

    keys =
      ApiKey
        .where(hidden: false)
        .includes(
          :user,
          :api_key_scopes,
        )# Sort revoked keys by revoked_at and active keys by created_at
        .
        order("revoked_at DESC NULLS FIRST, created_at DESC")
        .offset(offset)
        .limit(limit)

See the failing Dependabot PR: https://github.com/discourse/discourse/pull/23633 (that branch now also includes updated multiline lambda formatting)

levibuzolic commented 1 month ago

Have traced this back to this line of this change: https://github.com/ruby-syntax-tree/syntax_tree/commit/b3457654ee196f752c7c936b426a99f6888b1608#diff-4a62a987e00853ea4da04a58594e31564bc9afc77a1cbdf95f95493784360659R2852-R2855