Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ You can also reference the name of a gem.

While `packwerk` ships with its own offense formatter, you may specify a custom one in your configuration file via the `offenses_formatter:` key. Your custom formatter will be used when `bin/packwerk check` is run.

Firstly, you'll need to create an `OffensesFormatter` class that includes `Packwerk::OffensesFormatter`. You can use [`Packwerk::Formatters::OffensesFormatter`](lib/packwerk/formatters/offenses_formatter.rb) as a point of reference for this. Then, in the `require` directive described above, you'll want to tell `packwerk` about it:
Firstly, you'll need to create an `OffensesFormatter` class that includes `Packwerk::OffensesFormatter`. You can use [`Formatters::OffensesFormatter`](lib/packwerk/formatters/offenses_formatter.rb) as a point of reference for this. Then, in the `require` directive described above, you'll want to tell `packwerk` about it:
```ruby
# ./path/to/file.rb
class MyOffensesFormatter
Expand Down Expand Up @@ -358,7 +358,7 @@ class MyValidator
['enforce_my_custom_checker']
end

sig { override.params(package_set: PackageSet, configuration: Configuration).returns(ApplicationValidator::Result) }
sig { override.params(package_set: PackageSet, configuration: Configuration).returns(Validator::Result) }
def call(package_set, configuration)
# your logic here
end
Expand Down
78 changes: 32 additions & 46 deletions lib/packwerk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,62 +13,24 @@
module Packwerk
extend ActiveSupport::Autoload

autoload :ApplicationLoadPaths
autoload :ApplicationValidator
autoload :AssociationInspector
autoload :OffenseCollection
autoload :Cache
# Public APIs
autoload :Checker
autoload :Cli
autoload :Configuration
autoload :ConstantDiscovery
autoload :ConstantNameInspector
autoload :ConstNodeInspector
autoload :PackageTodo
autoload :ExtensionLoader
autoload :FileProcessor
autoload :FilesForProcessing
autoload :Graph
autoload :Loader
autoload :Node
autoload :NodeHelpers
autoload :NodeProcessor
autoload :NodeProcessorFactory
autoload :NodeVisitor
autoload :Offense
autoload :OffenseCollection
autoload :OffensesFormatter
autoload :OutputStyle
autoload :Package
autoload :PackageSet
autoload :ParsedConstantDefinitions
autoload :PackageTodo
autoload :Parsers
autoload :ParseRun
autoload :UnresolvedReference
autoload :Reference
autoload :ReferenceExtractor
autoload :ReferenceOffense
autoload :Result
autoload :RunContext
autoload :Validator
autoload :Version

module OutputStyles
extend ActiveSupport::Autoload

autoload :Coloured
autoload :Plain
end

autoload_under "commands" do
autoload :OffenseProgressMarker
end

module Formatters
extend ActiveSupport::Autoload

autoload :ProgressFormatter
end

module Generators
extend ActiveSupport::Autoload

Expand All @@ -85,21 +47,45 @@ module Checkers
extend ActiveSupport::Autoload

autoload :DependencyChecker
autoload :PrivacyChecker
end
end

class ApplicationValidator
module Validator
extend ActiveSupport::Autoload

autoload :Result
end

class Cli
extend ActiveSupport::Autoload

autoload :Result
autoload :Helpers
end

module OutputStyles
extend ActiveSupport::Autoload

autoload :Coloured
autoload :Plain
end

autoload_under "commands" do
autoload :OffenseProgressMarker
end

module Formatters
extend ActiveSupport::Autoload

autoload :ProgressFormatter
end

# Private APIs
autoload :Private
end

# Required to register the default OffensesFormatter
# Required to register the DefaultOffensesFormatter
# We put this at the *end* of the file to specify all autoloads first
require "packwerk/formatters/offenses_formatter"
require "packwerk/formatters/default_offenses_formatter"

# Required to register the default DependencyChecker
require "packwerk/reference_checking/checkers/dependency_checker"
Expand Down
73 changes: 0 additions & 73 deletions lib/packwerk/application_load_paths.rb

This file was deleted.

133 changes: 0 additions & 133 deletions lib/packwerk/application_validator.rb

This file was deleted.

Loading