Skip to content

Commit 52b8e82

Browse files
committed
fixed all linting issues
1 parent d648f99 commit 52b8e82

16 files changed

Lines changed: 4444 additions & 1579 deletions

File tree

.cspell/project-words.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
ankane
2+
appender
3+
appenders
24
autorun
35
bindir
46
binstub
@@ -10,6 +12,7 @@ creds
1012
dalli
1113
favicons
1214
gettime
15+
goodjob
1316
Healthcheck
1417
Honeybadger
1518
hotwire
@@ -21,6 +24,7 @@ LogStruct
2124
metaprogramming
2225
nilable
2326
optparse
27+
parseable
2428
pentester
2529
pentesters
2630
procs

lib/log_struct/formatter.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,12 @@ def generate_json(data)
210210
sig { params(array: T::Array[T.untyped]).returns(T::Boolean) }
211211
def looks_like_backtrace?(array)
212212
return false if array.empty?
213-
213+
214214
# Check if most elements look like backtrace lines (file.rb:123 or similar patterns)
215215
backtrace_like_count = array.first(5).count do |element|
216216
element.is_a?(String) && element.match?(/\A[^:\s]+:\d+/)
217217
end
218-
218+
219219
# If at least 3 out of the first 5 elements look like backtrace lines, treat as backtrace
220220
backtrace_like_count >= 3
221221
end

lib/log_struct/integrations/good_job.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module Integrations
3535
# ## Configuration:
3636
# The integration is automatically enabled when GoodJob is detected and
3737
# LogStruct configuration allows it. It can be disabled by setting:
38-
#
38+
#
3939
# ```ruby
4040
# config.integrations.enable_goodjob = false
4141
# ```
@@ -44,7 +44,7 @@ module GoodJob
4444
extend IntegrationInterface
4545

4646
# Set up GoodJob structured logging
47-
#
47+
#
4848
# This method configures GoodJob to use LogStruct's structured logging
4949
# by replacing the default logger and subscribing to job events.
5050
#
@@ -70,8 +70,8 @@ def self.setup(config)
7070
def self.configure_logger
7171
return unless defined?(::GoodJob)
7272

73-
# Use T.unsafe to avoid Sorbet errors with external constants
74-
goodjob_module = T.unsafe(Object.const_get("GoodJob"))
73+
# Use direct reference to avoid const_get - GoodJob is guaranteed to be defined here
74+
goodjob_module = T.unsafe(GoodJob)
7575

7676
# Replace GoodJob.logger with our structured logger if GoodJob is available
7777
if goodjob_module.respond_to?(:logger=)
@@ -108,4 +108,4 @@ def self.subscribe_to_notifications
108108
private_class_method :subscribe_to_notifications
109109
end
110110
end
111-
end
111+
end

lib/log_struct/integrations/good_job/log_subscriber.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class LogSubscriber < ::ActiveSupport::LogSubscriber
4141
sig { params(event: T.untyped).void }
4242
def enqueue(event)
4343
job_data = extract_job_data(event)
44-
44+
4545
log_entry = LogStruct::Log::GoodJob.new(
4646
event: Event::Enqueue,
4747
level: Level::Info,
@@ -64,7 +64,7 @@ def enqueue(event)
6464
sig { params(event: T.untyped).void }
6565
def start(event)
6666
job_data = extract_job_data(event)
67-
67+
6868
log_entry = LogStruct::Log::GoodJob.new(
6969
event: Event::Start,
7070
level: Level::Info,
@@ -82,11 +82,11 @@ def start(event)
8282
logger.info(log_entry)
8383
end
8484

85-
# Job completed successfully event
85+
# Job completed successfully event
8686
sig { params(event: T.untyped).void }
8787
def finish(event)
8888
job_data = extract_job_data(event)
89-
89+
9090
log_entry = LogStruct::Log::GoodJob.new(
9191
event: Event::Finish,
9292
level: Level::Info,
@@ -110,7 +110,7 @@ def finish(event)
110110
sig { params(event: T.untyped).void }
111111
def error(event)
112112
job_data = extract_job_data(event)
113-
113+
114114
log_entry = LogStruct::Log::GoodJob.new(
115115
event: Event::Error,
116116
level: Level::Error,
@@ -134,7 +134,7 @@ def error(event)
134134
sig { params(event: T.untyped).void }
135135
def schedule(event)
136136
job_data = extract_job_data(event)
137-
137+
138138
log_entry = LogStruct::Log::GoodJob.new(
139139
event: Event::Schedule,
140140
level: Level::Info,
@@ -166,7 +166,7 @@ def extract_job_data(event)
166166
# Basic job information
167167
if job
168168
data[:job_id] = job.job_id if job.respond_to?(:job_id)
169-
data[:job_class] = job.job_class if job.respond_to?(:job_class)
169+
data[:job_class] = job.job_class if job.respond_to?(:job_class)
170170
data[:queue_name] = job.queue_name if job.respond_to?(:queue_name)
171171
data[:arguments] = job.arguments if job.respond_to?(:arguments)
172172
data[:priority] = job.priority if job.respond_to?(:priority)
@@ -210,7 +210,7 @@ def calculate_wait_time(execution)
210210
return nil unless execution.created_at && execution.performed_at
211211

212212
(execution.performed_at - execution.created_at).to_f
213-
rescue => e
213+
rescue
214214
# Return nil if calculation fails
215215
nil
216216
end
@@ -225,4 +225,4 @@ def logger
225225
end
226226
end
227227
end
228-
end
228+
end

lib/log_struct/integrations/good_job/logger.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Logger < LogStruct::SemanticLogger::Logger
3333
define_method(level) do |message = nil, payload = nil, &block|
3434
# Extract basic job context from thread-local variables
3535
job_context = {}
36-
36+
3737
if Thread.current[:good_job_execution]
3838
execution = Thread.current[:good_job_execution]
3939
if execution.respond_to?(:job_id)
@@ -62,12 +62,12 @@ class Logger < LogStruct::SemanticLogger::Logger
6262
message: message || (block ? block.call : "")
6363
}
6464
)
65-
65+
6666
# Pass the struct to SemanticLogger
6767
super(log_struct, payload, &nil)
6868
end
6969
end
7070
end
7171
end
7272
end
73-
end
73+
end

lib/log_struct/log/good_job.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module Log
2828
# - Thread and process information
2929
#
3030
# ## Usage Examples:
31-
#
31+
#
3232
# ```ruby
3333
# # Job execution logging
3434
# LogStruct::Log::GoodJob.new(
@@ -148,4 +148,4 @@ def serialize(strict = true)
148148
end
149149
end
150150
end
151-
end
151+
end

lib/log_struct/semantic_logger/formatter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module SemanticLogger
2020
# - **Type-optimized paths**: Fast serialization for common data types
2121
# - **Zero-copy operations**: Minimal memory allocation during serialization
2222
#
23-
# ### Memory Efficiency
23+
# ### Memory Efficiency
2424
# - **Object reuse**: Formatter instances are reused across log calls
2525
# - **Lazy evaluation**: Only processes data that will be included in output
2626
# - **Efficient buffering**: Optimal buffer sizes for JSON generation

lib/log_struct/semantic_logger/setup.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def self.determine_filter
177177
#
178178
# ## Benefits of Complete Logger Replacement:
179179
# - **Consistent performance**: All Rails components benefit from SemanticLogger speed
180-
# - **Unified formatting**: All logs use the same structured JSON format
180+
# - **Unified formatting**: All logs use the same structured JSON format
181181
# - **Centralized configuration**: Single point of control for all logging
182182
# - **Complete compatibility**: Maintains all Rails.logger API contracts
183183
#

site/app/docs/comparison/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ function ComparisonTable() {
234234
return (
235235
<Minus className="w-5 h-5 text-yellow-600 dark:text-yellow-500 mx-auto" />
236236
);
237-
return <span className="text-xs">{value}</span>;
237+
return <span className="text-xs">{String(value)}</span>;
238238
};
239239

240240
return (

site/lib/__tests__/codeExamples.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, expect, beforeAll } from '@jest/globals';
1+
// Jest globals are available in test environment without explicit import
22
import fs from 'fs';
33
import path from 'path';
44
import {

0 commit comments

Comments
 (0)