Skip to content

Commit 283e984

Browse files
authored
chore(ci): fix lint, brakeman, and test command (#34)
* chore(ci): fix lint, brakeman, and test command - Rubocop: auto-corrected Layout/HashAlignment in ConnectionScoreCalculator and its spec. - Brakeman: rewrote Person.with_upcoming_events to use integer-encoded month*100+day instead of an interpolated tuple IN clause. Same semantics, no string interpolation, resolves the weak SQL-injection warning. - CI test job: project uses RSpec; switched the runner from �[1mUnrecognized command "test" (�[1;4mRails::Command::UnrecognizedCommandError�[m�[1m)�[m (Minitest) to /home/brian/.rbenv/versions/3.4.8/bin/ruby -I/home/brian/.rbenv/versions/3.4.8/lib/ruby/gems/3.4.0/gems/rspec-core-3.13.6/lib:/home/brian/.rbenv/versions/3.4.8/lib/ruby/gems/3.4.0/gems/rspec-support-3.13.7/lib /home/brian/.rbenv/versions/3.4.8/lib/ruby/gems/3.4.0/gems/rspec-core-3.13.6/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb ............................*........................................................................................................ Pending: (Failures listed here are expected and do not affect your suite's status) 1) User add some examples to (or delete) /home/brian/projects/saber/spec/models/user_spec.rb # Not yet implemented # ./spec/models/user_spec.rb:4 Finished in 0.62195 seconds (files took 0.32583 seconds to load) 133 examples, 0 failures, 1 pending. These checks have been failing since M5; M5 backend likely merged via admin bypass. Landing this first so M6 frontend PR #33 can rebase onto green main. * chore(deps): bump nokogiri 1.19.2 → 1.19.3 - Patches GHSA-c4rq-3m3g-8wgx (High, CSS selector tokenizer regex backtracking) and GHSA-v2fc-qm4h-8hqv (Medium, XSLT memory leak). - Surfaced by `bin/bundler-audit` in the scan_ruby CI job, which was already failing alongside the other three issues in this PR. - Transitive update only — no `Gemfile` change.
1 parent 875ae7f commit 283e984

5 files changed

Lines changed: 22 additions & 21 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020

2121
- name: Scan for common Rails security vulnerabilities using static analysis
2222
run: bin/brakeman --no-pager
23-
23+
2424
- name: Scan for known security vulnerabilities in gems used
2525
run: bin/bundler-audit
26-
26+
2727
lint:
2828
runs-on: ubuntu-latest
2929
env:
@@ -87,4 +87,6 @@ jobs:
8787
DATABASE_URL: postgres://postgres:postgres@localhost:5432
8888
# RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
8989
# REDIS_URL: redis://localhost:6379/0
90-
run: bin/rails db:test:prepare test
90+
run: |
91+
bin/rails db:test:prepare
92+
bin/rails spec

Gemfile.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,17 +173,17 @@ GEM
173173
net-protocol
174174
net-ssh (7.3.2)
175175
nio4r (2.7.5)
176-
nokogiri (1.19.2-aarch64-linux-gnu)
176+
nokogiri (1.19.3-aarch64-linux-gnu)
177177
racc (~> 1.4)
178-
nokogiri (1.19.2-aarch64-linux-musl)
178+
nokogiri (1.19.3-aarch64-linux-musl)
179179
racc (~> 1.4)
180-
nokogiri (1.19.2-arm-linux-gnu)
180+
nokogiri (1.19.3-arm-linux-gnu)
181181
racc (~> 1.4)
182-
nokogiri (1.19.2-arm-linux-musl)
182+
nokogiri (1.19.3-arm-linux-musl)
183183
racc (~> 1.4)
184-
nokogiri (1.19.2-x86_64-linux-gnu)
184+
nokogiri (1.19.3-x86_64-linux-gnu)
185185
racc (~> 1.4)
186-
nokogiri (1.19.2-x86_64-linux-musl)
186+
nokogiri (1.19.3-x86_64-linux-musl)
187187
racc (~> 1.4)
188188
orm_adapter (0.5.0)
189189
ostruct (0.6.3)

app/models/person.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@ class Person < ApplicationRecord
2525

2626
scope :with_upcoming_events, -> {
2727
today = Date.today
28-
upcoming = (today...(today + UPCOMING_DAYS_WINDOW)).map { |d| [ d.month, d.day ] }
29-
placeholders = upcoming.map { "(?, ?)" }.join(", ")
28+
upcoming_keys = (today...(today + UPCOMING_DAYS_WINDOW)).map { |day| day.month * 100 + day.day }
3029
joins(:important_dates)
31-
.where("(important_dates.month, important_dates.day) IN (#{placeholders})", *upcoming.flatten)
30+
.where("important_dates.month * 100 + important_dates.day IN (?)", upcoming_keys)
3231
.distinct
3332
}
3433

app/services/connection_score_calculator.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
class ConnectionScoreCalculator
22
RING_SCORE = {
3-
"inner_circle" => 4,
4-
"network" => 3,
5-
"community" => 2,
3+
"inner_circle" => 4,
4+
"network" => 3,
5+
"community" => 2,
66
"acquaintances" => 1,
7-
"stranger" => 1
7+
"stranger" => 1
88
}.freeze
99

1010
TWO_WEEKS = 14

spec/services/connection_score_calculator_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
RSpec.describe ConnectionScoreCalculator do
44
def baseline_person(**overrides)
55
create(:person,
6-
ring: :stranger,
7-
score_source: :manual,
8-
importance_score: 1,
9-
reciprocity_score: 1,
10-
shared_values_score: 1,
6+
ring: :stranger,
7+
score_source: :manual,
8+
importance_score: 1,
9+
reciprocity_score: 1,
10+
shared_values_score: 1,
1111
**overrides
1212
)
1313
end

0 commit comments

Comments
 (0)