Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit a8dae64

Browse files
authored
Refactor project code (#50)
* Remove YARD configuration file * Remove Bundler ecosystem config * Simplify EditorConfig * Remove CONTRIBUTING.md * Add ignored revs file * Update development Ruby to 2.7.8 * Ignore history files * Update RuboCop configuration * Update CI workflow * Add Publish workflow * Add IRB config file * Use IRB in console script * RuboCop: Style/StringLiterals * Refactor test suite * RuboCop: Layout/MultilineMethodCallIndentation * RuboCop: Performance/ChainArrayAllocation * RuboCop: Performance/ChainArrayAllocation Removing the grouping from `PARAMETERS_REGEXP_PATTERN` results in a flat array coming from the call to `scan`. The resulting matches are _nearly_ the same with the exception of whitespace (thus the new call to `strip` in the `map` call). This addresses the chain array allocation warning and simplifies the code _a little bit_. tbh I'm not sure why I'm using a negative lookbehind in the regular expression, but I'll have to trust myself from a couple years ago. :grimace: * Pass multiple headers to parse in spec * Disable Performance/ChainArrayAllocation inline * Fix indentation * Update ignored revs file * Update README * Update CHANGELOG and bump version
1 parent aa10f82 commit a8dae64

33 files changed

Lines changed: 241 additions & 254 deletions

.editorconfig

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# EditorConfig is awesome: https://EditorConfig.org
21
root = true
32

43
[*]
@@ -8,7 +7,3 @@ insert_final_newline = true
87
indent_size = 2
98
indent_style = space
109
trim_trailing_whitespace = true
11-
12-
[*.md]
13-
indent_size = 4
14-
indent_style = tab

.git-blame-ignore-revs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Since git version 2.23, git-blame has a feature to ignore certain commits.
2+
#
3+
# This file contains a list of commits that are not likely what you are looking
4+
# for in `git blame`. You can set this file as a default ignore file for blame
5+
# by running the following command:
6+
#
7+
# $ git config blame.ignoreRevsFile .git-blame-ignore-revs
8+
9+
512efa51fbac6687d90da2252b5dec91bf26e0cb
10+
580605ae8d72f5a9b1b6f9225c66c85c8f85e24f

.github/dependabot.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
version: 2
22

33
updates:
4-
- package-ecosystem: "bundler"
5-
directory: "/"
6-
schedule:
7-
interval: "weekly"
8-
assignees:
9-
- "jgarber623"
104
- package-ecosystem: "github-actions"
115
directory: "/"
126
schedule:

.github/workflows/ci.yml

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,15 @@
11
name: CI
22

3-
on: [push, pull_request]
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
workflow_call:
8+
workflow_dispatch:
49

510
jobs:
6-
analyze:
7-
name: Analyze
8-
permissions:
9-
contents: read
10-
security-events: write
11-
runs-on: ubuntu-latest
12-
steps:
13-
- uses: actions/checkout@v4
14-
- uses: github/codeql-action/init@v2
15-
with:
16-
languages: ruby
17-
- uses: github/codeql-action/analyze@v2
1811
lint:
1912
name: Lint
20-
permissions:
21-
contents: read
22-
security-events: write
2313
runs-on: ubuntu-latest
2414
steps:
2515
- uses: actions/checkout@v4
@@ -30,18 +20,16 @@ jobs:
3020
test:
3121
name: Test
3222
runs-on: ubuntu-latest
33-
env:
34-
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
23+
needs: lint
3524
strategy:
3625
fail-fast: false
3726
matrix:
38-
# See: https://github.com/actions/runner/issues/849
39-
ruby: [2.7, "3.0", 3.1]
27+
os: [macos-latest, ubuntu-latest]
28+
ruby: ["2.7", "3.0", "3.1", "3.2", "3.3"]
4029
steps:
4130
- uses: actions/checkout@v4
4231
- uses: ruby/setup-ruby@v1
4332
with:
4433
bundler-cache: true
4534
ruby-version: ${{ matrix.ruby }}
4635
- run: bundle exec rspec
47-
- uses: paambaati/codeclimate-action@v5.0.0

.github/workflows/publish.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
ci:
9+
name: CI
10+
uses: ./.github/workflows/ci.yml
11+
publish-to-rubygems:
12+
name: Publish to RubyGems
13+
needs: ci
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: ruby/setup-ruby@v1
18+
with:
19+
bundler-cache: true
20+
- run: |
21+
mkdir -p $HOME/.gem
22+
touch $HOME/.gem/credentials
23+
chmod 0600 $HOME/.gem/credentials
24+
printf -- "---\n:rubygems_api_key: ${{ secrets.RUBYGEMS_TOKEN }}\n" > $HOME/.gem/credentials
25+
- run: bundle exec rake release
26+
publish-to-github-packages:
27+
name: Publish to GitHub Packages
28+
permissions:
29+
contents: read
30+
packages: write
31+
needs: ci
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
- uses: ruby/setup-ruby@v1
36+
with:
37+
bundler-cache: true
38+
- run: |
39+
mkdir -p $HOME/.gem
40+
touch $HOME/.gem/credentials
41+
chmod 0600 $HOME/.gem/credentials
42+
printf -- "---\n:github: Bearer ${{ secrets.GITHUB_TOKEN }}\n" > $HOME/.gem/credentials
43+
- run: bundle exec rake release
44+
env:
45+
BUNDLE_GEM__PUSH_KEY: github
46+
RUBYGEMS_HOST: "https://rubygems.pkg.github.com/${{ github.repository_owner }}"

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
# Used by dotenv library to load environment variables.
1414
# .env
1515

16+
# Ignore history files.
17+
.irb_history
18+
.rdbg_history
19+
1620
# Documentation cache and generated files:
1721
/.yardoc/
1822
/_yardoc/
@@ -33,5 +37,5 @@ Gemfile.lock
3337
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
3438
.rvmrc
3539

36-
# Ignore cached RuboCop configuration files
37-
/.rubocop-*
40+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
41+
.rubocop-https?--*

.irbrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# frozen_string_literal: true
2+
3+
require "irb/completion"
4+
5+
IRB.conf[:AUTO_INDENT] = true
6+
IRB.conf[:HISTORY_FILE] = ".irb_history"
7+
IRB.conf[:SAVE_HISTORY] = 1000
8+
IRB.conf[:USE_AUTOCOMPLETE] = false
9+
10+
def clear
11+
system("clear")
12+
end

.rubocop.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
inherit_from:
2-
- https://raw.githubusercontent.com/jgarber623/rubocop-configs/main/.rubocop.gem.yml
2+
- https://github.com/jgarber623/rubocop-configs/raw/main/.rubocop.yml
3+
- https://github.com/jgarber623/rubocop-configs/raw/main/.rubocop-rspec.yml
34

5+
require:
6+
- rubocop-packaging
7+
8+
# Makes sure that Ruby source files have snake_case names.
49
Naming/FileName:
510
Exclude:
611
- lib/link-header-parser.rb

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.7.6
1+
2.7.8

.simplecov

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
formatters = SimpleCov::Formatter.from_env(ENV)
44

55
if RSpec.configuration.files_to_run.length > 1
6-
require 'simplecov-console'
6+
require "simplecov-console"
77

88
formatters << SimpleCov::Formatter::Console
99
end
1010

1111
SimpleCov.start do
12+
enable_coverage :branch
13+
1214
formatter SimpleCov::Formatter::MultiFormatter.new(formatters)
1315
end

0 commit comments

Comments
 (0)