veragem 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +230 -34
  3. data/Gemfile.lock +254 -0
  4. data/README.md +143 -48
  5. data/lib/veragem/citation.rb +116 -0
  6. data/lib/veragem/generator.rb +105 -56
  7. data/lib/veragem/license.rb +27 -0
  8. data/lib/veragem/name.rb +110 -48
  9. data/lib/veragem/options.rb +116 -30
  10. data/lib/veragem/project.rb +200 -39
  11. data/lib/veragem/questions.rb +163 -0
  12. data/lib/veragem/summary.rb +62 -0
  13. data/lib/veragem/version.rb +2 -1
  14. data/lib/veragem.rb +12 -3
  15. data/plugins.rb +4 -0
  16. data/sig/veragem.rbs +151 -23
  17. data/template/.gitattributes +3 -0
  18. data/template/.githooks/pre-commit +2 -3
  19. data/template/.github/PULL_REQUEST_TEMPLATE.md +2 -1
  20. data/template/.github/dependabot.yml +4 -8
  21. data/template/.github/image-registries.sh +4 -3
  22. data/template/.github/workflows/dependabot-automerge.yml +29 -34
  23. data/template/.github/workflows/dependency-review.yml +19 -15
  24. data/template/.github/workflows/image.yml +65 -14
  25. data/template/.github/workflows/links.yml +35 -0
  26. data/template/.github/workflows/nix.yml +3 -3
  27. data/template/.github/workflows/release.yml +135 -22
  28. data/template/.github/workflows/ruby-ci.yml +31 -9
  29. data/template/.github/workflows/security.yml +15 -9
  30. data/template/.github/workflows/style-check-cocogitto.yml +3 -4
  31. data/template/.github/workflows/style-check-dprint.yml +10 -10
  32. data/template/.gitignore +5 -0
  33. data/template/.mutineer.yml +28 -0
  34. data/template/.rubocop.yml +49 -10
  35. data/template/.simplecov.erb +10 -0
  36. data/template/.yard-lint.yml +386 -0
  37. data/template/.yardopts +2 -0
  38. data/template/AGENTS.md.erb +76 -38
  39. data/template/CITATION.cff.erb +50 -0
  40. data/template/CODE_OF_CONDUCT.md.erb +1 -1
  41. data/template/CONTRIBUTING.md.erb +107 -48
  42. data/template/Gemfile +10 -7
  43. data/template/README.md.erb +12 -12
  44. data/template/Rakefile +167 -31
  45. data/template/Steepfile.erb +1 -1
  46. data/template/bin/setup +2 -0
  47. data/template/cliff.toml +40 -23
  48. data/template/dprint.json +1 -6
  49. data/template/flake.lock +3 -3
  50. data/template/flake.nix +25 -10
  51. data/template/lib/%path%/cli.rb.erb +19 -15
  52. data/template/lib/%path%/version.rb.erb +1 -1
  53. data/template/lib/%path%.rb.erb +3 -1
  54. data/template/sig/%path%.rbs.erb +1 -1
  55. data/template/test/test_%underscored%.rb.erb +4 -3
  56. data/template/test/test_cli.rb.erb +37 -12
  57. data/template/test/test_helper.rb.erb +15 -7
  58. metadata +16 -4
  59. data/template/.github/workflows/rubocop-autocorrect.yml +0 -114
@@ -1,13 +1,17 @@
1
- # A release tag, v<version> (`rake bump`, then `rake release`), publishes the gem: checked and built
2
- # once, pushed to RubyGems through Trusted Publishing (no API key stored), then its GitHub release
3
- # of the same file, its notes the release's section of CHANGELOG.md (release-notes.sh). Trusted
4
- # Publishing needs, once, a (pending) trusted publisher on rubygems.org naming this repository,
5
- # this workflow (release.yml) and the `release` environment.
1
+ # A release tag, v<version> (`rake bump`, then `rake release`), publishes the gem: checked, then
2
+ # built and signed once, pushed to RubyGems through Trusted Publishing (no API key stored) with its
3
+ # Sigstore attestation, then its GitHub release of the same file, its notes the release's section of
4
+ # CHANGELOG.md (release-notes.sh). Trusted Publishing needs, once, a (pending) trusted publisher on
5
+ # rubygems.org naming this repository, this workflow (release.yml) and the `release` environment.
6
6
  #
7
7
  # Least privilege, as RubyGems' Trusted Publishing advises, after PyPI's security model: the
8
- # build, which runs the checks and the gemspec, writes nothing but its artifacts and mints no key;
9
- # only the RubyGems job can mint one, with nothing checked out and no Gemfile or Rakefile loaded;
10
- # only the release job can write the repository.
8
+ # checks, which load the bundle's gems, write nothing; the build, apart from them, loads no bundle,
9
+ # so no tool's gem touches the file published; its path and digest, job outputs no later job can
10
+ # rewrite, name the one file signed, pushed and released, checked first; the signing job, which runs
11
+ # Sigstore's action, signs as this workflow outside the environment the publisher names, so it
12
+ # mints no key; only the RubyGems job can mint one, with nothing checked out, no Gemfile or Rakefile
13
+ # loaded and no action but the artifacts' download, setup-ruby's and the credentials'; only the
14
+ # release job can write the repository.
11
15
  name: Release
12
16
 
13
17
  on:
@@ -17,8 +21,8 @@ on:
17
21
  permissions: {}
18
22
 
19
23
  jobs:
20
- build:
21
- name: Check and build
24
+ check:
25
+ name: Check
22
26
  runs-on: ubuntu-latest
23
27
  permissions:
24
28
  contents: read
@@ -35,25 +39,60 @@ jobs:
35
39
 
36
40
  - name: The gems, from Gemfile.lock
37
41
  # installed afresh, not restored from bundler-cache: a cache any run on main can write is
38
- # never an input to the gem published
42
+ # never an input to a release
39
43
  env:
40
44
  BUNDLE_FROZEN: "true"
41
45
  run: bundle install
42
46
 
43
- - name: RuboCop, Steep, the tests
47
+ - name: RuboCop, Steep, the tests, yard-lint
44
48
  run: bundle exec rake
45
49
 
50
+ build:
51
+ name: Build
52
+ needs: check
53
+ runs-on: ubuntu-latest
54
+ permissions:
55
+ contents: read
56
+ outputs:
57
+ gem: ${{ steps.build.outputs.gem }}
58
+ sha256: ${{ steps.build.outputs.sha256 }}
59
+ notes: ${{ steps.build.outputs.notes }}
60
+ steps:
61
+ - name: Checkout
62
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
63
+ with:
64
+ persist-credentials: false
65
+
66
+ - name: Set up Ruby
67
+ uses: ruby/setup-ruby@7f797815d8adceb1c412e7abefdd1ab4abc47a5f # v1.335.0
68
+ with:
69
+ ruby-version: "4.0"
70
+ bundler: none
71
+
46
72
  - name: Build the gem, and its notes
73
+ id: build
74
+ # RubyGems' own build, the gemspec alone: the same files as Bundler's `rake build`
47
75
  run: |
48
76
  set -euo pipefail
49
- version="$(ruby -e 'puts Gem::Specification.load(Dir["*.gemspec"].first).version')"
77
+ gemspec="$(ruby -e 'print Dir["*.gemspec"].first')"
78
+ version="$(ruby -e 'print Gem::Specification.load(ARGV[0]).version' "$gemspec")"
50
79
  if [[ $GITHUB_REF_NAME != "v$version" ]]; then
51
80
  echo "::error::$GITHUB_REF_NAME, but the gemspec's version is $version" >&2
52
81
  exit 1
53
82
  fi
54
- # into pkg/, as Bundler's gem tasks build it
55
- bundle exec rake build
83
+ mkdir pkg
84
+ gem="pkg/${gemspec%.gemspec}-$version.gem"
85
+ gem build "$gemspec" --output "$gem"
56
86
  .github/release-notes.sh CHANGELOG.md "$version" > notes.md
87
+ # assigned first: a failing command substitution inside echo's arguments would not stop
88
+ # the step
89
+ sha256="$(sha256sum "$gem")"
90
+ notes="$(sha256sum notes.md)"
91
+ {
92
+ echo "gem=$gem"
93
+ echo "sha256=$sha256"
94
+ echo "notes=$notes"
95
+ } >> "$GITHUB_OUTPUT"
57
96
 
58
97
  - name: Keep the gem
59
98
  uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
@@ -69,9 +108,40 @@ jobs:
69
108
  path: notes.md
70
109
  if-no-files-found: error
71
110
 
111
+ sign:
112
+ name: Sign
113
+ needs: build
114
+ runs-on: ubuntu-latest
115
+ permissions:
116
+ id-token: write # Sigstore's certificate: this workflow's identity, which RubyGems checks
117
+ steps:
118
+ - name: The build's gem
119
+ uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
120
+ with:
121
+ name: gem
122
+ path: pkg/
123
+
124
+ - name: Sign
125
+ # Sigstore's action, which writes the bundle beside the gem (<gem>.sigstore.json), and
126
+ # RubyGems takes any v0.3 bundle that verifies (rubygems.org's Pusher). The code that can
127
+ # sign as this workflow: the action pinned and moved by Dependabot, its sigstore-python with
128
+ # it (hash-pinned requirements), but not the uv it installs first, uv's newest
129
+ # (setup/create-venv.sh). A bad one can fail the push, not change the gem (its digest) nor
130
+ # add one: the jobs after it take the build's path alone
131
+ uses: sigstore/gh-action-sigstore-python@790bc6befb9d733738f18d8f895854b453640ec9 # v3.5.0
132
+ with:
133
+ inputs: ${{ needs.build.outputs.gem }}
134
+
135
+ - name: Keep the attestation
136
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
137
+ with:
138
+ name: attestation
139
+ path: pkg/*.sigstore.json
140
+ if-no-files-found: error
141
+
72
142
  rubygems:
73
143
  name: RubyGems
74
- needs: build
144
+ needs: [build, sign]
75
145
  runs-on: ubuntu-latest
76
146
  environment:
77
147
  name: release
@@ -84,19 +154,41 @@ jobs:
84
154
  name: gem
85
155
  path: pkg/
86
156
 
157
+ - name: Its attestation
158
+ uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
159
+ with:
160
+ name: attestation
161
+ path: pkg/
162
+
163
+ - name: The build's gem, unchanged
164
+ # its artifact replaceable by a later job of the run (the signing job's code): its digest is
165
+ # the build's output
166
+ env:
167
+ SHA256: ${{ needs.build.outputs.sha256 }}
168
+ run: sha256sum --check --strict <<< "$SHA256"
169
+
170
+ - name: Set up Ruby
171
+ # the runner image's RubyGems predates `gem push --attestation`
172
+ uses: ruby/setup-ruby@7f797815d8adceb1c412e7abefdd1ab4abc47a5f # v1.335.0
173
+ with:
174
+ ruby-version: "4.0"
175
+ bundler: none
176
+
87
177
  - name: Trusted Publishing's API key
88
178
  uses: rubygems/configure-rubygems-credentials@dc5a8d8553e6ee01fc26761a49e99e733d17954a # v2.1.0
89
179
 
90
180
  - name: Push
91
- # the runner image's RubyGems: no other action in the one job that can mint a key
92
- run: gem push pkg/*.gem
181
+ # RubyGems verifies the attestation, and shows the gem's provenance
182
+ env:
183
+ GEM: ${{ needs.build.outputs.gem }}
184
+ run: gem push "$GEM" --attestation "$GEM.sigstore.json"
93
185
 
94
186
  release:
95
187
  name: GitHub release
96
- needs: rubygems
188
+ needs: [build, rubygems]
97
189
  runs-on: ubuntu-latest
98
190
  permissions:
99
- contents: write
191
+ contents: write # the release, and its tags read
100
192
  steps:
101
193
  - name: The build's gem
102
194
  uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
@@ -109,9 +201,30 @@ jobs:
109
201
  with:
110
202
  name: notes
111
203
 
204
+ - name: The build's gem and notes, unchanged
205
+ # as the RubyGems job checks the gem
206
+ env:
207
+ SHA256: ${{ needs.build.outputs.sha256 }}
208
+ NOTES: ${{ needs.build.outputs.notes }}
209
+ run: printf '%s\n' "$SHA256" "$NOTES" | sha256sum --check --strict
210
+
112
211
  - name: Release
113
212
  env:
114
213
  GH_TOKEN: ${{ github.token }}
214
+ GEM: ${{ needs.build.outputs.gem }}
115
215
  run: |
116
- gh release create "$GITHUB_REF_NAME" pkg/*.gem --repo "$GITHUB_REPOSITORY" --verify-tag \
117
- --title "$GITHUB_REF_NAME" --notes-file notes.md
216
+ set -euo pipefail
217
+ # GitHub's latest release is the highest final one, as image.yml's `latest` is: by default,
218
+ # GitHub makes each new release the latest, a patch to an older line too
219
+ highest="$(gh api "repos/$GITHUB_REPOSITORY/git/matching-refs/tags/v" --paginate \
220
+ --jq '.[].ref | ltrimstr("refs/tags/v")' \
221
+ | { grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' || true; } | sort -V | tail -n 1)"
222
+ version="${GITHUB_REF_NAME#v}"
223
+ latest=false
224
+ if [[ $version == "$highest" ]]; then latest=true; fi
225
+ # a pre-release as RubyGems reads one: a letter in its version (Gem::Version#prerelease?)
226
+ prerelease=false
227
+ if [[ $version =~ [a-zA-Z] ]]; then prerelease=true; fi
228
+ gh release create "$GITHUB_REF_NAME" "$GEM" --repo "$GITHUB_REPOSITORY" --verify-tag \
229
+ --title "$GITHUB_REF_NAME" --notes-file notes.md --latest="$latest" \
230
+ --prerelease="$prerelease"
@@ -1,13 +1,13 @@
1
- # The Ruby checks, `bundle exec rake` (RuboCop, Steep, the tests with their coverage gate), on each
2
- # Ruby the matrix lists, the gems installed from Gemfile.lock; then TypeProf's verdict, advisory.
1
+ # The Ruby checks, `bundle exec rake` (RuboCop, Steep, the tests with their coverage gate,
2
+ # yard-lint), on each Ruby the matrix lists, on Linux, macOS and Windows, the gems installed from
3
+ # Gemfile.lock; then TypeProf's verdict, advisory. Beside them, the mutation test of every line: a
4
+ # change to the tests alone weakens them, and has no changed line to mutate.
3
5
  # nix.yml runs the flake's checks: the Nix format, the shell, the workflows, the package.
4
6
  name: Ruby CI
5
7
 
6
8
  on:
7
9
  push:
8
10
  branches: [main]
9
- # every pull request, whatever it touches: a path-filtered workflow never reports, and a
10
- # required check that never reports blocks the merge
11
11
  pull_request:
12
12
  workflow_dispatch:
13
13
 
@@ -22,13 +22,18 @@ permissions:
22
22
 
23
23
  jobs:
24
24
  checks:
25
- name: Checks (Ruby ${{ matrix.ruby }})
26
- runs-on: ubuntu-latest
25
+ name: Checks (Ruby ${{ matrix.ruby }}, ${{ matrix.os }})
26
+ runs-on: ${{ matrix.os }}
27
27
  strategy:
28
28
  fail-fast: false
29
29
  matrix:
30
+ os: [ubuntu-latest, macos-latest, windows-latest]
30
31
  # the gemspec's required_ruby_version, and each newer Ruby once released
31
32
  ruby: ["4.0"]
33
+ # Windows' default is PowerShell: the scripts below are bash, Git for Windows' there
34
+ defaults:
35
+ run:
36
+ shell: bash
32
37
  steps:
33
38
  - name: Checkout
34
39
  uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -42,15 +47,14 @@ jobs:
42
47
  ruby-version: ${{ matrix.ruby }}
43
48
  bundler-cache: true
44
49
 
45
- - name: RuboCop, Steep, the tests
46
- # RuboCop's offences as annotations too, on a pull request's lines (its github formatter)
50
+ - name: RuboCop, Steep, the tests, yard-lint
47
51
  env:
48
52
  RUBOCOP_OPTS: --format progress --format github
49
53
  run: bundle exec rake
50
54
 
51
55
  - name: RuboCop's safe corrections, as a patch
52
56
  # a failed run's: what `rake rubocop:autocorrect` changes, in the run's summary, to
53
- # `git apply` (a Dependabot bump's, rubocop-autocorrect.yml commits)
57
+ # `git apply` -- a Dependabot bump's too, which a failed run keeps from auto-merging
54
58
  if: failure()
55
59
  run: |
56
60
  bundle exec rake rubocop:autocorrect || true
@@ -60,3 +64,21 @@ jobs:
60
64
 
61
65
  - name: TypeProf (advisory)
62
66
  run: bundle exec rake typeprof
67
+
68
+ mutation:
69
+ name: Mutation
70
+ runs-on: ubuntu-latest
71
+ steps:
72
+ - name: Checkout
73
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
74
+ with:
75
+ persist-credentials: false
76
+
77
+ - name: Set up Ruby
78
+ uses: ruby/setup-ruby@7f797815d8adceb1c412e7abefdd1ab4abc47a5f # v1.335.0
79
+ with:
80
+ ruby-version: "4.0"
81
+ bundler-cache: true
82
+
83
+ - name: mutineer, every line
84
+ run: bundle exec rake mutation
@@ -1,23 +1,29 @@
1
- # bundler-audit: Gemfile.lock against the Ruby Advisory Database -- daily, on demand, and when the
2
- # lock changes (`rake audit`). A finding fails the run, notified to the workflow's creator (or
3
- # whoever last changed its cron: docs.github.com, "Notifications for workflow runs"). GitHub
4
- # disables a public repository's schedule after 60 days without activity ("Events that trigger
5
- # workflows"): Dependabot alerts, the repository's setting, watch the lock without one.
1
+ # bundler-audit: Gemfile.lock against the Ruby Advisory Database -- daily, on demand, on every pull
2
+ # request and when main's lock changes (`rake audit`). A finding fails the run, notified to the
3
+ # workflow's creator (or whoever last changed its cron: docs.github.com, "Notifications for
4
+ # workflow runs"). GitHub disables a public repository's schedule after 60 days without activity
5
+ # ("Events that trigger workflows"): Dependabot alerts, the repository's setting, watch the lock
6
+ # without one.
6
7
  name: Security
7
8
 
8
9
  on:
9
10
  schedule:
10
- - cron: "0 0 * * *" # daily, midnight UTC
11
+ - cron: "23 3 * * *" # daily, 03:23 UTC: off the hour and midnight, when GitHub delays runs
11
12
  workflow_dispatch:
12
13
  push:
13
14
  branches: [main]
14
15
  paths:
15
16
  - "Gemfile.lock"
16
17
  - ".github/workflows/security.yml"
18
+ # every pull request, whatever it touches: a check that always reports can be required, and
19
+ # so gate a bump's auto-merge on the advisories
17
20
  pull_request:
18
- paths:
19
- - "Gemfile.lock"
20
- - ".github/workflows/security.yml"
21
+
22
+ # a pull request's newest run cancels its older ones; any other run, a group of its own: every
23
+ # commit on main checked (in a shared group, a pending run gives way to the newest: the default)
24
+ concurrency:
25
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
26
+ cancel-in-progress: true
21
27
 
22
28
  permissions:
23
29
  contents: read
@@ -1,9 +1,8 @@
1
1
  name: Conventional Commits Check
2
2
 
3
- # On a push, the whole history rather than `--from-latest-tag`: with no tag
4
- # yet, cog stops "unable to get any tag" -- every new project's first push.
5
- # A pull request's title too: a squash merge of two or more commits makes the
6
- # title the commit, and so a changelog entry -- checked again when edited.
3
+ # On a push, the whole history, not `--from-latest-tag`: with no tag yet (a new project's first
4
+ # push), cog stops "unable to get any tag". A pull request's title too, checked again when edited:
5
+ # a squash merge of two or more commits makes the title the commit, and so a changelog entry.
7
6
 
8
7
  on:
9
8
  push:
@@ -1,4 +1,4 @@
1
- # The action installs dprint's latest release, attested; the formatting is
1
+ # dprint as flake.lock's nixpkgs has it (the dev shell's version), fetched alone; the formatting is
2
2
  # the plugins', pinned in dprint.json.
3
3
  name: Dprint Formatting Checks
4
4
 
@@ -6,17 +6,16 @@ on:
6
6
  push:
7
7
  branches: [main]
8
8
  paths:
9
- # dprint.json's plugins' extensions, markdown and toml, no more: one
10
- # no plugin handles (yaml, json, Dockerfile) only schedules runs that
11
- # check nothing. Add a plugin there and its extensions here together,
12
- # each its own entry: path filters have no brace expansion {a,b}.
9
+ # dprint.json's plugins' extensions (markdown, toml), no more: one no plugin handles (yaml,
10
+ # json, Dockerfile) only schedules runs that check nothing. Add a plugin there and its
11
+ # extensions here together, each its own entry: path filters have no brace expansion {a,b}.
13
12
  - "**/*.md"
14
13
  - "**/*.markdown"
15
14
  - "**/*.toml"
16
15
  - ".github/workflows/style-check-dprint.yml"
17
16
  - "dprint.json"
18
- # every pull request, whatever it touches: a path-filtered workflow never
19
- # reports, and a required check that never reports blocks the merge
17
+ # every pull request, whatever it touches: a path-filtered workflow does not report on one
18
+ # outside its paths, and a required check that does not report blocks the merge
20
19
  pull_request:
21
20
 
22
21
  # a pull request's newest run cancels its older ones; any other run, a group of its own: every
@@ -38,7 +37,8 @@ jobs:
38
37
  with:
39
38
  persist-credentials: false
40
39
 
40
+ - name: Install Nix
41
+ uses: cachix/install-nix-action@75c75c31ebece974e48ebc36b4ad125bd97bd97b # v31.11.3
42
+
41
43
  - name: Dprint format check
42
- uses: dprint/check@7dc032d8874778fc024f6f9b4a7e6d896782c330 # v2.5
43
- with:
44
- config-path: dprint.json
44
+ run: nix run --inputs-from . nixpkgs#dprint -- check
data/template/.gitignore CHANGED
@@ -10,3 +10,8 @@
10
10
  # Nix's build links, direnv's cache
11
11
  /result*
12
12
  /.direnv
13
+ /.ruby-lsp/
14
+ # mutineer's coverage map (`rake mutation`), lychee's cache (`rake links`)
15
+ /.mutineer/
16
+ /.lycheecache
17
+ /.yardoc/
@@ -0,0 +1,28 @@
1
+ # mutineer (`rake mutation`): every operator, not its default five; a minute a mutant, as a test that
2
+ # starts a process can take tens of seconds, and a mutant over the limit counts as neither caught
3
+ # nor survived. A surviving mutant fails the run: the score, of the mutants the tests reach and
4
+ # not ignored, is 100%.
5
+ operators:
6
+ - arithmetic
7
+ - comparison
8
+ - boolean_connector
9
+ - boolean_literal
10
+ - statement_removal
11
+ - return_nil
12
+ - literal_mutation
13
+ - condition_negation
14
+ - string_literal
15
+ - regex
16
+ - collection_method
17
+ - safe_navigation
18
+ - range
19
+ - negation_removal
20
+ - chain_link
21
+ - call_to_receiver
22
+ - operand_removal
23
+ - array_literal
24
+ - condition_true
25
+ - condition_false
26
+ - operator_assignment
27
+ timeout: 60
28
+ threshold: 100
@@ -1,6 +1,10 @@
1
- # RuboCop's defaults, each new cop on as it ships, and its extensions for the tests, packaging (the
2
- # gem as distributions build it), performance and the Rakefile. The Ruby version is the gemspec's
3
- # required_ruby_version.
1
+ AllCops:
2
+ Exclude:
3
+ - "result*/**/*" # `nix build`'s links: the gem installed, which the project index would take for a second copy
4
+ NewCops: enable # pending cops on now, not only at the next major release
5
+ ProjectIndexIncludesGems: true # the bundle's gems' sources indexed too: under `bundle exec rubocop` alone
6
+ UseProjectIndex: true # the rubydex gem indexes the project: cops see across files (a method defined twice)
7
+
4
8
  plugins:
5
9
  - rubocop-minitest
6
10
  - rubocop-packaging
@@ -11,14 +15,49 @@ inherit_mode:
11
15
  merge:
12
16
  - Exclude
13
17
 
14
- AllCops:
15
- NewCops: enable
16
- # `nix build`'s links: the gem installed, which the project index would take for a second copy
18
+ Gemspec/DependencyVersion:
19
+ Enabled: true
20
+
21
+ Layout/ClassStructure:
22
+ Enabled: true
23
+ ExpectedOrder:
24
+ - module_inclusion
25
+ - constants
26
+ - public_attribute_macros
27
+ - public_class_methods
28
+ - initializer
29
+ - public_methods
30
+ - protected_attribute_macros
31
+ - protected_methods
32
+ - private_attribute_macros
33
+ - private_class_methods
34
+ - private_methods
35
+ Categories:
36
+ attribute_macros:
37
+ - attr_accessor
38
+ - attr_reader
39
+ - attr_writer
40
+ module_inclusion:
41
+ - include
42
+ - prepend
43
+ - extend
44
+
45
+ Layout/EmptyLineAfterMultilineCondition:
46
+ Enabled: true
47
+
48
+ Layout/EndOfLine: # LF, as .gitattributes checks every text file out, Windows' too; `native` wants CRLF there
49
+ EnforcedStyle: lf
50
+
51
+ Layout/HeredocArgumentClosingParenthesis:
52
+ Enabled: true
53
+
54
+ Layout/LeadingCommentSpace:
55
+ AllowSteepAnnotation: true # Steep's inline annotations, `#: Type`, which have no space after the `#`
56
+
57
+ Style/TopLevelMethodDefinition: # a method on Object, everywhere; a script's helpers are its own
58
+ Enabled: true
17
59
  Exclude:
18
- - "result*/**/*"
19
- # the whole project indexed first (the rubydex gem), so the cops that can see across files do: a
20
- # method defined twice in two files, a constant reassigned in another
21
- UseProjectIndex: true
60
+ - Rakefile
22
61
 
23
62
  Style/StringLiterals:
24
63
  EnforcedStyle: double_quotes
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ # `rake test`'s coverage, started before the tests load lib/ (the Rakefile): every line, branch and
4
+ # method of lib/, a file the tests never load included (`cover`). But version.rb: the gemspec
5
+ # requires it, as Bundler reads the gemspec before coverage starts -- a constant alone.
6
+ SimpleCov.configure do
7
+ load_profile "strict"
8
+ cover "lib/**/*.rb"
9
+ skip "lib/<%= path %>/version.rb"
10
+ end