google / google/keep-sorted

Feature Request: skip_last_lines (in addition to skip_lines=x)

Open
#80 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
403
Forks
36
Avg merge
4h 24m
Merged PRs (30d)
1

Description

When running keep-sorted in our ruby code base, we have the following syntax that wraps arrays

```ruby
# keep-sorted start
SOME_ARRAY = %w[
AAA
BBB
CCC
].freeze
# keep-sorted end
```

**We are unable to nest the `# keep-sorted start/end` within the array because of the `%w`. E.g. this is incorrect**
```ruby
SOME_ARRAY = %w[
# keep-sorted start
AAA
BBB
CCC
# keep-sorted end
].freeze
```

What we're doing as somewhat of a workaround, which we believe is effectively sorting the last row `].freeze` as well (which would be incorrect)

```ruby
# keep-sorted start skip_lines=1 block=yes
SOME_ARRAY = %w[
AAA
BBB
CCC
].freeze
# keep-sorted end

```

The feature request is to add a syntax that allows something like this:

```ruby
# keep-sorted start skip_lines=1 skip_last_lines=1 block=yes
SOME_ARRAY = %w[
AAA
BBB
CCC
].freeze
# keep-sorted end
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.