Skip to content

Commit

Permalink
Merge pull request #498 from crystal-ameba/dont-use-thread-mutex
Browse files Browse the repository at this point in the history
Misc refactors
  • Loading branch information
Sija authored Nov 17, 2024
2 parents 0e8ead1 + 37a4c14 commit eb3cae0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/ameba/config.cr
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class Ameba::Config
property? autocorrect = false

# Returns a filename if reading source file from STDIN.
property stdin_filename : String? = nil
property stdin_filename : String?

@rule_groups : Hash(String, Array(Rule::Base))

Expand Down
4 changes: 4 additions & 0 deletions src/ameba/formatter/base_formatter.cr
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ module Ameba::Formatter

# Callback that indicates when source inspection is started.
# A corresponding source is passed as an argument.
#
# WARNING: This method needs to be MT safe
def source_started(source : Source); end

# Callback that indicates when source inspection is finished.
# A corresponding source is passed as an argument.
#
# WARNING: This method needs to be MT safe
def source_finished(source : Source); end

# Callback that indicates when inspection is finished.
Expand Down
2 changes: 1 addition & 1 deletion src/ameba/formatter/dot_formatter.cr
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Ameba::Formatter
include Util

@started_at : Time::Span?
@mutex = Thread::Mutex.new
@mutex = Mutex.new

# Reports a message when inspection is started.
def started(sources)
Expand Down
4 changes: 3 additions & 1 deletion src/ameba/formatter/todo_formatter.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ module Ameba::Formatter
# Basically, it takes all issues reported and disables corresponding rules
# or excludes failed sources from these rules.
class TODOFormatter < DotFormatter
def initialize(@output = STDOUT, @config_path : Path = Config::DEFAULT_PATH)
@config_path : Path

def initialize(@output = STDOUT, @config_path = Config::DEFAULT_PATH)
end

def finished(sources)
Expand Down

0 comments on commit eb3cae0

Please sign in to comment.