diff --git a/src/ameba/config.cr b/src/ameba/config.cr index 6110c0fc7..0325462c5 100644 --- a/src/ameba/config.cr +++ b/src/ameba/config.cr @@ -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)) diff --git a/src/ameba/formatter/base_formatter.cr b/src/ameba/formatter/base_formatter.cr index a6ceafdf0..43364e07d 100644 --- a/src/ameba/formatter/base_formatter.cr +++ b/src/ameba/formatter/base_formatter.cr @@ -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. diff --git a/src/ameba/formatter/dot_formatter.cr b/src/ameba/formatter/dot_formatter.cr index 97982622f..22eafc527 100644 --- a/src/ameba/formatter/dot_formatter.cr +++ b/src/ameba/formatter/dot_formatter.cr @@ -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) diff --git a/src/ameba/formatter/todo_formatter.cr b/src/ameba/formatter/todo_formatter.cr index 00a2d28f1..ce8d58080 100644 --- a/src/ameba/formatter/todo_formatter.cr +++ b/src/ameba/formatter/todo_formatter.cr @@ -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)