diff --git a/Gemfile.lock b/Gemfile.lock index 44d36c2..9a8b684 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,6 @@ PATH specs: visualize_packwerk (0.0.4) code_ownership - package_protections parse_packwerk rake ruby-graphviz @@ -12,11 +11,6 @@ PATH GEM remote: https://rubygems.org/ specs: - activesupport (7.0.3.1) - concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 1.6, < 2) - minitest (>= 5.1) - tzinfo (~> 2.0) ast (2.4.2) code_ownership (1.28.0) code_teams (~> 1.0) @@ -25,36 +19,23 @@ GEM code_teams (1.0.0) sorbet-runtime coderay (1.1.3) - concurrent-ruby (1.1.10) diff-lcs (1.5.0) - i18n (1.12.0) - concurrent-ruby (~> 1.0) - json (2.6.2) method_source (1.0.0) - minitest (5.16.2) netrc (0.11.0) - package_protections (1.3.0) - activesupport - parse_packwerk - rubocop - rubocop-sorbet - sorbet-runtime parallel (1.22.1) - parse_packwerk (0.11.0) + parse_packwerk (0.14.0) sorbet-runtime parser (3.1.2.1) ast (~> 2.4.1) pry (0.14.1) coderay (~> 1.1) method_source (~> 1.0) - rainbow (3.1.1) rake (13.0.6) rbi (0.0.15) ast parser (>= 2.6.4.0) sorbet-runtime (>= 0.5.9204) unparser - regexp_parser (2.5.0) rexml (3.2.5) rspec (3.11.0) rspec-core (~> 3.11.0) @@ -69,23 +50,8 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.11.0) rspec-support (3.11.0) - rubocop (1.35.0) - json (~> 2.3) - parallel (~> 1.10) - parser (>= 3.1.2.1) - rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.20.1, < 2.0) - ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.21.0) - parser (>= 3.1.1.0) - rubocop-sorbet (0.6.11) - rubocop (>= 0.90.0) ruby-graphviz (1.2.5) rexml - ruby-progressbar (1.11.0) sorbet (0.5.10323) sorbet-static (= 0.5.10323) sorbet-runtime (0.5.10323) @@ -109,9 +75,6 @@ GEM thor (>= 1.2.0) yard-sorbet thor (1.2.1) - tzinfo (2.0.5) - concurrent-ruby (~> 1.0) - unicode-display_width (2.2.0) unparser (0.6.5) diff-lcs (~> 1.3) parser (>= 3.1.0) diff --git a/lib/visualize_packwerk.rb b/lib/visualize_packwerk.rb index da8a7e2..4cbc244 100644 --- a/lib/visualize_packwerk.rb +++ b/lib/visualize_packwerk.rb @@ -4,7 +4,6 @@ module VisualizePackwerk require 'visualize_packwerk/railtie' if defined?(Rails) require 'parse_packwerk' require 'code_ownership' - require 'package_protections' require 'graphviz' require 'visualize_packwerk/node_interface' diff --git a/lib/visualize_packwerk/package_graph.rb b/lib/visualize_packwerk/package_graph.rb index 9f5bdd1..f780b86 100644 --- a/lib/visualize_packwerk/package_graph.rb +++ b/lib/visualize_packwerk/package_graph.rb @@ -27,7 +27,7 @@ def self.construct # We would also need to ignore it when parsing PackageNodes. # next if p.name == ParsePackwerk::ROOT_PACKAGE_NAME owner = CodeOwnership.for_package(p) - violations_by_package = PackageProtections::ProtectedPackage.from(p).violations.group_by(&:to_package_name).transform_values(&:count) + violations_by_package = p.violations.group_by(&:to_package_name).transform_values(&:count) package_nodes << PackageNode.new( name: p.name, diff --git a/sorbet/rbi/gems/package_protections@1.3.0.rbi b/sorbet/rbi/gems/package_protections@1.3.0.rbi deleted file mode 100644 index 3200366..0000000 --- a/sorbet/rbi/gems/package_protections@1.3.0.rbi +++ /dev/null @@ -1,654 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for types exported from the `package_protections` gem. -# Please instead update this file by running `bin/tapioca gem package_protections`. - -# Welcome to PackageProtections! -# See https://github.com/rubyatscale/package_protections#readme for more info -# -# This file is a reference for the available API to `package_protections`, but all implementation details are private -# (which is why we delegate to `Private` for the actual implementation). -module PackageProtections - class << self - sig { returns(T::Array[::PackageProtections::ProtectionInterface]) } - def all; end - - sig { void } - def bust_cache!; end - - # @yield [Private.config] - sig { params(blk: T.proc.params(arg0: ::PackageProtections::Private::Configuration).void).void } - def configure(&blk); end - - # This returns an array of a `Offense` which is how we represent the outcome of attempting to protect one or more packages, - # each of which is configured with different violation behaviors for each protection. - sig do - params( - packages: T::Array[::ParsePackwerk::Package], - new_violations: T::Array[::PackageProtections::PerFileViolation] - ).returns(T::Array[::PackageProtections::Offense]) - end - def get_offenses(packages:, new_violations:); end - - sig do - params( - package_names: T::Array[::String], - all_packages: T::Array[::ParsePackwerk::Package] - ).returns(T::Array[::ParsePackwerk::Package]) - end - def packages_for_names(package_names, all_packages); end - - # Do not use this method -- it's meant to be used by Rubocop cops to get directory-specific - # parameters without needing to have directory-specific .rubocop.yml files. - sig { params(identifier: ::String).returns(T::Hash[T.untyped, T.untyped]) } - def private_cop_config(identifier); end - - # Why do we use Bundler.root here? - # The reason is that this function is evaluated in `.client_rubocop.yml`, so when rubocop evaluates the - # YML and parses the ERB, the working directory is inside this gem. We need to make sure it's at the root of the - # application so that we can find all of the packwerk packages. - # We use Bundler.root to get the root because: - # A) We expect it to be reliable - # B) We expect the client to be running bundle exec rubocop, which is typically done at the root, and also means - # the client already has this dependency. - sig { params(root_pathname: ::Pathname).returns(::String) } - def rubocop_yml(root_pathname: T.unsafe(nil)); end - - # PackageProtections.set_defaults! sets any unset protections to their default enforcement - sig do - params( - packages: T::Array[::ParsePackwerk::Package], - protection_identifiers: T::Array[::String], - verbose: T::Boolean - ).void - end - def set_defaults!(packages, protection_identifiers: T.unsafe(nil), verbose: T.unsafe(nil)); end - - # This is a fast way to get a protection given an identifier - sig { params(identifier: ::String).returns(::PackageProtections::ProtectionInterface) } - def with_identifier(identifier); end - end -end - -PackageProtections::EXPECTED_PACK_DIRECTORIES = T.let(T.unsafe(nil), Array) - -# A protection identifier is just a string that identifies the name of the protection within a `package.yml` -PackageProtections::Identifier = T.type_alias { ::String } - -# This is currently the only handled exception that `PackageProtections` will throw. -class PackageProtections::IncorrectPublicApiUsageError < ::StandardError; end - -class PackageProtections::Offense < ::T::Struct - const :file, ::String - const :message, ::String - const :package, ::ParsePackwerk::Package - const :violation_type, ::String - - sig { returns(::String) } - def package_name; end - - class << self - def inherited(s); end - end -end - -PackageProtections::PROTECTIONS_TODO_YML = T.let(T.unsafe(nil), String) - -# Perhaps this should be in ParsePackwerk. For now, this is here to help us break down violations per file. -# This is analogous to `Packwerk::ReferenceOffense` -class PackageProtections::PerFileViolation < ::T::Struct - const :class_name, ::String - const :constant_source_package, ::String - const :filepath, ::String - const :reference_source_package, ::ParsePackwerk::Package - const :type, ::String - - sig { returns(T::Boolean) } - def dependency?; end - - sig { returns(T::Boolean) } - def privacy?; end - - class << self - sig do - params( - violation: ::ParsePackwerk::Violation, - reference_source_package: ::ParsePackwerk::Package - ).returns(T::Array[::PackageProtections::PerFileViolation]) - end - def from(violation, reference_source_package); end - - def inherited(s); end - end -end - -# This module cannot be accessed by clients of `PackageProtections` -- only within the `PackageProtections` module itself. -# All implementation details are in here to keep the main `PackageProtections` module easily scannable and to keep the private things private. -module PackageProtections::Private - class << self - sig { returns(T::Array[::PackageProtections::ProtectedPackage]) } - def all_protected_packages; end - - sig { void } - def bust_cache!; end - - sig { returns(::PackageProtections::Private::Configuration) } - def config; end - - sig do - params( - packages: T::Array[::ParsePackwerk::Package], - new_violations: T::Array[::PackageProtections::PerFileViolation] - ).returns(T::Array[::PackageProtections::Offense]) - end - def get_offenses(packages:, new_violations:); end - - sig { params(name: ::String).returns(::PackageProtections::ProtectedPackage) } - def get_package_with_name(name); end - - sig do - params( - package_names: T::Array[::String], - all_packages: T::Array[::ParsePackwerk::Package] - ).returns(T::Array[::ParsePackwerk::Package]) - end - def packages_for_names(package_names, all_packages); end - - sig { params(identifier: ::String).returns(T::Hash[T.untyped, T.untyped]) } - def private_cop_config(identifier); end - - sig { params(root_pathname: ::Pathname).returns(::String) } - def rubocop_yml(root_pathname:); end - - sig do - params( - packages: T::Array[::ParsePackwerk::Package], - protection_identifiers: T::Array[::String], - verbose: T::Boolean - ).void - end - def set_defaults!(packages, protection_identifiers:, verbose:); end - end -end - -class PackageProtections::Private::ColorizedString - sig { params(original_string: ::String, color: ::PackageProtections::Private::ColorizedString::Color).void } - def initialize(original_string, color = T.unsafe(nil)); end - - sig { returns(::PackageProtections::Private::ColorizedString) } - def blue; end - - sig { returns(::String) } - def colorized_to_s; end - - sig { returns(::PackageProtections::Private::ColorizedString) } - def green; end - - sig { returns(::PackageProtections::Private::ColorizedString) } - def light_blue; end - - sig { returns(::PackageProtections::Private::ColorizedString) } - def pink; end - - sig { returns(::PackageProtections::Private::ColorizedString) } - def red; end - - sig { returns(::String) } - def to_s; end - - sig { returns(::PackageProtections::Private::ColorizedString) } - def white; end - - sig { returns(::PackageProtections::Private::ColorizedString) } - def yellow; end - - private - - sig { returns(::Integer) } - def color_code; end - - sig do - params( - color: ::PackageProtections::Private::ColorizedString::Color - ).returns(::PackageProtections::Private::ColorizedString) - end - def colorize(color); end -end - -class PackageProtections::Private::ColorizedString::Color < ::T::Enum - enums do - Black = new - Red = new - Green = new - Yellow = new - Blue = new - Pink = new - LightBlue = new - White = new - end -end - -class PackageProtections::Private::Configuration - sig { void } - def initialize; end - - sig { void } - def bust_cache!; end - - sig { returns(T::Array[::PackageProtections::ProtectionInterface]) } - def default_protections; end - - sig { returns(T::Array[::PackageProtections::ProtectionInterface]) } - def protections; end - - sig { params(protections: T::Array[::PackageProtections::ProtectionInterface]).void } - def protections=(protections); end -end - -class PackageProtections::Private::IncomingPrivacyProtection - include ::PackageProtections::ProtectionInterface - - sig do - override - .params( - protected_packages: T::Array[::PackageProtections::ProtectedPackage] - ).returns(T::Array[::PackageProtections::Offense]) - end - def get_offenses_for_existing_violations(protected_packages); end - - sig do - override - .params( - new_violations: T::Array[::PackageProtections::PerFileViolation] - ).returns(T::Array[::PackageProtections::Offense]) - end - def get_offenses_for_new_violations(new_violations); end - - sig { override.returns(::String) } - def humanized_protection_description; end - - sig { override.returns(::String) } - def humanized_protection_name; end - - sig { override.returns(::String) } - def identifier; end - - sig do - override - .params( - behavior: ::PackageProtections::ViolationBehavior, - package: ::ParsePackwerk::Package - ).returns(T.nilable(::String)) - end - def unmet_preconditions_for_behavior(behavior, package); end - - private - - sig { params(per_file_violation: ::PackageProtections::PerFileViolation).returns(::String) } - def message_for_fail_on_any(per_file_violation); end - - sig { params(per_file_violation: ::PackageProtections::PerFileViolation).returns(::String) } - def message_for_fail_on_new(per_file_violation); end -end - -PackageProtections::Private::IncomingPrivacyProtection::IDENTIFIER = T.let(T.unsafe(nil), String) - -class PackageProtections::Private::MetadataModifiers - class << self - sig do - params( - package: ::ParsePackwerk::Package, - protection_identifier: ::String, - violation_behavior: ::PackageProtections::ViolationBehavior - ).returns(::ParsePackwerk::Package) - end - def package_with_modified_protection(package, protection_identifier, violation_behavior); end - end -end - -class PackageProtections::Private::OutgoingDependencyProtection - include ::PackageProtections::ProtectionInterface - - sig do - override - .params( - protected_packages: T::Array[::PackageProtections::ProtectedPackage] - ).returns(T::Array[::PackageProtections::Offense]) - end - def get_offenses_for_existing_violations(protected_packages); end - - sig do - override - .params( - new_violations: T::Array[::PackageProtections::PerFileViolation] - ).returns(T::Array[::PackageProtections::Offense]) - end - def get_offenses_for_new_violations(new_violations); end - - sig { override.returns(::String) } - def humanized_protection_description; end - - sig { override.returns(::String) } - def humanized_protection_name; end - - sig { override.returns(::String) } - def identifier; end - - sig do - override - .params( - behavior: ::PackageProtections::ViolationBehavior, - package: ::ParsePackwerk::Package - ).returns(T.nilable(::String)) - end - def unmet_preconditions_for_behavior(behavior, package); end - - private - - sig { params(per_file_violation: ::PackageProtections::PerFileViolation).returns(::String) } - def message_for_fail_on_any(per_file_violation); end - - sig { params(per_file_violation: ::PackageProtections::PerFileViolation).returns(::String) } - def message_for_fail_on_new(per_file_violation); end -end - -PackageProtections::Private::OutgoingDependencyProtection::IDENTIFIER = T.let(T.unsafe(nil), String) - -class PackageProtections::Private::Output - class << self - sig { params(str: ::String).void } - def p(str); end - - sig { params(str: ::PackageProtections::Private::ColorizedString, colorized: T::Boolean).void } - def p_colorized(str, colorized:); end - end -end - -class PackageProtections::Private::VisibilityProtection - include ::PackageProtections::ProtectionInterface - - # By default, this protection does not show up when creating a new package, and its default behavior is FailNever - # A package that uses this protection is not considered strictly better -- in general, we want to design packages that - # are consumable by all packages. Therefore, a package that is consumable by all packages is the happy path. - # - # If a user wants to turn on package visibility, they must do it explicitly. - sig { returns(::PackageProtections::ViolationBehavior) } - def default_behavior; end - - sig do - override - .params( - protected_packages: T::Array[::PackageProtections::ProtectedPackage] - ).returns(T::Array[::PackageProtections::Offense]) - end - def get_offenses_for_existing_violations(protected_packages); end - - sig do - override - .params( - new_violations: T::Array[::PackageProtections::PerFileViolation] - ).returns(T::Array[::PackageProtections::Offense]) - end - def get_offenses_for_new_violations(new_violations); end - - sig { override.returns(::String) } - def humanized_protection_description; end - - sig { override.returns(::String) } - def humanized_protection_name; end - - sig { override.returns(::String) } - def identifier; end - - sig do - override - .params( - behavior: ::PackageProtections::ViolationBehavior, - package: ::ParsePackwerk::Package - ).returns(T.nilable(::String)) - end - def unmet_preconditions_for_behavior(behavior, package); end - - private - - sig { params(per_file_violation: ::PackageProtections::PerFileViolation).returns(::String) } - def message_for_fail_on_any(per_file_violation); end - - sig { params(per_file_violation: ::PackageProtections::PerFileViolation).returns(::String) } - def message_for_fail_on_new(per_file_violation); end -end - -PackageProtections::Private::VisibilityProtection::IDENTIFIER = T.let(T.unsafe(nil), String) - -class PackageProtections::ProtectedPackage < ::T::Struct - const :deprecated_references, ::ParsePackwerk::DeprecatedReferences - const :original_package, ::ParsePackwerk::Package - const :protections, T::Hash[::String, ::PackageProtections::ViolationBehavior] - - sig { returns(T::Array[::String]) } - def dependencies; end - - sig { returns(T::Hash[T.untyped, T.untyped]) } - def metadata; end - - sig { returns(::String) } - def name; end - - sig { params(key: ::String).returns(::PackageProtections::ViolationBehavior) } - def violation_behavior_for(key); end - - sig { returns(T::Array[::ParsePackwerk::Violation]) } - def violations; end - - sig { returns(T::Set[::String]) } - def visible_to; end - - sig { returns(::Pathname) } - def yml; end - - class << self - sig { params(original_package: ::ParsePackwerk::Package).returns(::PackageProtections::ProtectedPackage) } - def from(original_package); end - - sig do - params( - protection: ::PackageProtections::ProtectionInterface, - metadata: T::Hash[T.untyped, T.untyped], - package: ::ParsePackwerk::Package - ).returns(::PackageProtections::ViolationBehavior) - end - def get_violation_behavior(protection, metadata, package); end - - def inherited(s); end - end -end - -# @abstract Subclasses must implement the `abstract` methods below. -module PackageProtections::ProtectionInterface - requires_ancestor { Kernel } - - abstract! - - sig { returns(::PackageProtections::ViolationBehavior) } - def default_behavior; end - - sig do - params( - protected_packages: T::Array[::PackageProtections::ProtectedPackage], - new_violations: T::Array[::PackageProtections::PerFileViolation] - ).returns(T::Array[::PackageProtections::Offense]) - end - def get_offenses(protected_packages, new_violations); end - - # @abstract - sig do - abstract - .params( - protected_packages: T::Array[::PackageProtections::ProtectedPackage] - ).returns(T::Array[::PackageProtections::Offense]) - end - def get_offenses_for_existing_violations(protected_packages); end - - # @abstract - sig do - abstract - .params( - new_violations: T::Array[::PackageProtections::PerFileViolation] - ).returns(T::Array[::PackageProtections::Offense]) - end - def get_offenses_for_new_violations(new_violations); end - - # @abstract - sig { abstract.returns(::String) } - def humanized_protection_description; end - - # @abstract - sig { abstract.returns(::String) } - def humanized_protection_name; end - - # @abstract - sig { abstract.returns(::String) } - def identifier; end - - sig do - params( - behavior: ::PackageProtections::ViolationBehavior, - package: ::ParsePackwerk::Package - ).returns(T::Boolean) - end - def supports_violation_behavior?(behavior, package); end - - # @abstract - sig do - abstract - .params( - behavior: ::PackageProtections::ViolationBehavior, - package: ::ParsePackwerk::Package - ).returns(T.nilable(::String)) - end - def unmet_preconditions_for_behavior(behavior, package); end -end - -# @abstract Subclasses must implement the `abstract` methods below. -module PackageProtections::RubocopProtectionInterface - include ::PackageProtections::ProtectionInterface - - abstract! - - sig do - params( - packages: T::Array[::PackageProtections::ProtectedPackage] - ).returns(T::Array[::PackageProtections::RubocopProtectionInterface::CopConfig]) - end - def cop_configs(packages); end - - # Abstract Methods: These are methods that the client needs to implement - # - # @abstract - sig { abstract.returns(::String) } - def cop_name; end - - # Overriddable Methods: These are methods that the client can override, - # but a default is provided. - sig { params(package: ::PackageProtections::ProtectedPackage).returns(T::Hash[T.untyped, T.untyped]) } - def custom_cop_config(package); end - - sig do - override - .params( - protected_packages: T::Array[::PackageProtections::ProtectedPackage] - ).returns(T::Array[::PackageProtections::Offense]) - end - def get_offenses_for_existing_violations(protected_packages); end - - sig do - override - .params( - new_violations: T::Array[::PackageProtections::PerFileViolation] - ).returns(T::Array[::PackageProtections::Offense]) - end - def get_offenses_for_new_violations(new_violations); end - - # @abstract - sig { abstract.returns(T::Array[::String]) } - def included_globs_for_pack; end - - # @abstract - sig { abstract.params(file: ::String).returns(::String) } - def message_for_fail_on_any(file); end - - sig do - override - .params( - behavior: ::PackageProtections::ViolationBehavior, - package: ::ParsePackwerk::Package - ).returns(T.nilable(::String)) - end - def unmet_preconditions_for_behavior(behavior, package); end - - private - - sig { params(rule: ::String).returns(T::Set[::String]) } - def exclude_for_rule(rule); end - - class << self - sig { void } - def bust_rubocop_todo_yml_cache; end - - sig { returns(T.untyped) } - def rubocop_todo_yml; end - end -end - -class PackageProtections::RubocopProtectionInterface::CopConfig < ::T::Struct - const :enabled, T::Boolean, default: T.unsafe(nil) - const :exclude_paths, T::Array[::String], default: T.unsafe(nil) - const :include_paths, T::Array[::String], default: T.unsafe(nil) - const :name, ::String - - sig { returns(::String) } - def to_rubocop_yml_compatible_format; end - - class << self - def inherited(s); end - end -end - -class PackageProtections::ViolationBehavior < ::T::Enum - enums do - FailOnAny = new - FailOnNew = new - FailNever = new - end - - sig { returns(T::Boolean) } - def enabled?; end - - sig { returns(T::Boolean) } - def fail_never?; end - - sig { returns(T::Boolean) } - def fail_on_any?; end - - sig { returns(T::Boolean) } - def fail_on_new?; end - - class << self - sig { params(value: T.untyped).returns(::PackageProtections::ViolationBehavior) } - def from_raw_value(value); end - end -end - -RuboCop::Cop::PackageProtections::NamespacedUnderPackageName::IDENTIFIER = T.let(T.unsafe(nil), String) - -# This inherits from `Sorbet::StrictSigil` and doesn't change any behavior of it. -# The only reason we do this is so that configuration for this cop can live under a different cop namespace. -# This prevents this cop's configuration from clashing with other configurations for the same cop. -# A concrete example of this would be if a user is using this package protection to make sure public APIs are typed, -# and separately the application as a whole requiring strict typing in certain parts of the application. -# -# To prevent problems associated with needing to manage identical configurations for the same cop, we simply call it -# something else in the context of this protection. -# -# We can apply this same pattern if we want to use other cops in the context of package protections and prevent clashing. diff --git a/sorbet/rbi/gems/parse_packwerk@0.11.0.rbi b/sorbet/rbi/gems/parse_packwerk@0.14.0.rbi similarity index 54% rename from sorbet/rbi/gems/parse_packwerk@0.11.0.rbi rename to sorbet/rbi/gems/parse_packwerk@0.14.0.rbi index 565bf21..75b4eda 100644 --- a/sorbet/rbi/gems/parse_packwerk@0.11.0.rbi +++ b/sorbet/rbi/gems/parse_packwerk@0.14.0.rbi @@ -4,20 +4,30 @@ # This is an autogenerated file for types exported from the `parse_packwerk` gem. # Please instead update this file by running `bin/tapioca gem parse_packwerk`. +# source://parse_packwerk-0.14.0/lib/parse_packwerk/constants.rb:3 module ParsePackwerk class << self + # source://parse_packwerk-0.14.0/lib/parse_packwerk.rb:28 sig { returns(T::Array[::ParsePackwerk::Package]) } def all; end + # source://parse_packwerk-0.14.0/lib/parse_packwerk.rb:112 + sig { void } + def bust_cache!; end + + # source://parse_packwerk-0.14.0/lib/parse_packwerk.rb:33 sig { params(name: ::String).returns(T.nilable(::ParsePackwerk::Package)) } def find(name); end - sig { params(file_path: T.any(::Pathname, ::String)).returns(T.nilable(::ParsePackwerk::Package)) } + # source://parse_packwerk-0.14.0/lib/parse_packwerk.rb:43 + sig { params(file_path: T.any(::Pathname, ::String)).returns(::ParsePackwerk::Package) } def package_from_path(file_path); end + # source://parse_packwerk-0.14.0/lib/parse_packwerk.rb:54 sig { params(package: ::ParsePackwerk::Package).void } def write_package_yml!(package); end + # source://parse_packwerk-0.14.0/lib/parse_packwerk.rb:38 sig { returns(::ParsePackwerk::Configuration) } def yml; end @@ -25,94 +35,148 @@ module ParsePackwerk # We memoize packages_by_name for fast lookup. # Since Graph is an immutable value object, we can create indexes and general caching mechanisms safely. + # + # source://parse_packwerk-0.14.0/lib/parse_packwerk.rb:100 sig { returns(T::Hash[::String, ::ParsePackwerk::Package]) } def packages_by_name; end end end +# source://parse_packwerk-0.14.0/lib/parse_packwerk/configuration.rb:4 class ParsePackwerk::Configuration < ::T::Struct const :exclude, T::Array[::String] const :package_paths, T::Array[::String] class << self + # source://parse_packwerk-0.14.0/lib/parse_packwerk/configuration.rb:28 sig { params(config_hash: T::Hash[T.untyped, T.untyped]).returns(T::Array[::String]) } def excludes(config_hash); end + # source://parse_packwerk-0.14.0/lib/parse_packwerk/configuration.rb:11 sig { returns(::ParsePackwerk::Configuration) } def fetch; end + # source://sorbet-runtime-0.5.10323/lib/types/struct.rb:13 def inherited(s); end + # source://parse_packwerk-0.14.0/lib/parse_packwerk/configuration.rb:40 sig { params(config_hash: T::Hash[T.untyped, T.untyped]).returns(T::Array[::String]) } def package_paths(config_hash); end end end +# source://parse_packwerk-0.14.0/lib/parse_packwerk/constants.rb:20 ParsePackwerk::DEFAULT_EXCLUDE_GLOBS = T.let(T.unsafe(nil), Array) + +# source://parse_packwerk-0.14.0/lib/parse_packwerk/constants.rb:21 ParsePackwerk::DEFAULT_PACKAGE_PATHS = T.let(T.unsafe(nil), Array) + +# source://parse_packwerk-0.14.0/lib/parse_packwerk/constants.rb:22 +ParsePackwerk::DEFAULT_PUBLIC_PATH = T.let(T.unsafe(nil), String) + +# source://parse_packwerk-0.14.0/lib/parse_packwerk/constants.rb:12 ParsePackwerk::DEPENDENCIES = T.let(T.unsafe(nil), String) + +# source://parse_packwerk-0.14.0/lib/parse_packwerk/constants.rb:7 ParsePackwerk::DEPRECATED_REFERENCES_YML_NAME = T.let(T.unsafe(nil), String) +# source://parse_packwerk-0.14.0/lib/parse_packwerk/deprecated_references.rb:4 class ParsePackwerk::DeprecatedReferences < ::T::Struct const :pathname, ::Pathname const :violations, T::Array[::ParsePackwerk::Violation] class << self + # source://parse_packwerk-0.14.0/lib/parse_packwerk/deprecated_references.rb:11 sig { params(package: ::ParsePackwerk::Package).returns(::ParsePackwerk::DeprecatedReferences) } def for(package); end + # source://parse_packwerk-0.14.0/lib/parse_packwerk/deprecated_references.rb:17 sig { params(pathname: ::Pathname).returns(::ParsePackwerk::DeprecatedReferences) } def from(pathname); end + # source://sorbet-runtime-0.5.10323/lib/types/struct.rb:13 def inherited(s); end end end +# source://parse_packwerk-0.14.0/lib/parse_packwerk/constants.rb:8 ParsePackwerk::ENFORCE_DEPENDENCIES = T.let(T.unsafe(nil), String) + +# source://parse_packwerk-0.14.0/lib/parse_packwerk/constants.rb:9 ParsePackwerk::ENFORCE_PRIVACY = T.let(T.unsafe(nil), String) + +# source://parse_packwerk-0.14.0/lib/parse_packwerk/constants.rb:11 ParsePackwerk::METADATA = T.let(T.unsafe(nil), String) # Since this metadata is unstructured YAML, it could be any type. We leave it to clients of `ParsePackwerk::Package` # to add types based on their known usage of metadata. +# +# source://parse_packwerk-0.14.0/lib/parse_packwerk/constants.rb:16 ParsePackwerk::MetadataYmlType = T.type_alias { T::Hash[T.untyped, T.untyped] } +# source://parse_packwerk-0.14.0/lib/parse_packwerk.rb:14 class ParsePackwerk::MissingConfiguration < ::StandardError + # source://parse_packwerk-0.14.0/lib/parse_packwerk.rb:18 sig { params(packwerk_file_name: ::Pathname).void } def initialize(packwerk_file_name); end end +# source://parse_packwerk-0.14.0/lib/parse_packwerk/constants.rb:5 ParsePackwerk::PACKAGE_YML_NAME = T.let(T.unsafe(nil), String) + +# source://parse_packwerk-0.14.0/lib/parse_packwerk/constants.rb:6 ParsePackwerk::PACKWERK_YML_NAME = T.let(T.unsafe(nil), String) +# source://parse_packwerk-0.14.0/lib/parse_packwerk/constants.rb:10 +ParsePackwerk::PUBLIC_PATH = T.let(T.unsafe(nil), String) + +# source://parse_packwerk-0.14.0/lib/parse_packwerk/package.rb:4 class ParsePackwerk::Package < ::T::Struct const :dependencies, T::Array[::String] const :enforce_dependencies, T::Boolean const :enforce_privacy, T::Boolean const :metadata, T::Hash[T.untyped, T.untyped] const :name, ::String + const :public_path, ::String, default: T.unsafe(nil) + # source://parse_packwerk-0.14.0/lib/parse_packwerk/package.rb:35 sig { returns(::Pathname) } def directory; end + # source://parse_packwerk-0.14.0/lib/parse_packwerk/package.rb:45 sig { returns(T::Boolean) } def enforces_dependencies?; end + # source://parse_packwerk-0.14.0/lib/parse_packwerk/package.rb:50 sig { returns(T::Boolean) } def enforces_privacy?; end + # source://parse_packwerk-0.14.0/lib/parse_packwerk/package.rb:40 + sig { returns(::Pathname) } + def public_directory; end + + # source://parse_packwerk-0.14.0/lib/parse_packwerk/package.rb:55 + sig { returns(T::Array[::ParsePackwerk::Violation]) } + def violations; end + + # source://parse_packwerk-0.14.0/lib/parse_packwerk/package.rb:30 sig { returns(::Pathname) } def yml; end class << self + # source://parse_packwerk-0.14.0/lib/parse_packwerk/package.rb:15 sig { params(pathname: ::Pathname).returns(::ParsePackwerk::Package) } def from(pathname); end + # source://sorbet-runtime-0.5.10323/lib/types/struct.rb:13 def inherited(s); end end end +# source://parse_packwerk-0.14.0/lib/parse_packwerk/package_set.rb:8 class ParsePackwerk::PackageSet class << self + # source://parse_packwerk-0.14.0/lib/parse_packwerk/package_set.rb:12 sig do params( package_pathspec: T::Array[::String], @@ -123,26 +187,32 @@ class ParsePackwerk::PackageSet private + # source://parse_packwerk-0.14.0/lib/parse_packwerk/package_set.rb:28 sig { params(globs: T::Array[::String], path: ::Pathname).returns(T::Boolean) } def exclude_path?(globs, path); end end end +# source://parse_packwerk-0.14.0/lib/parse_packwerk/constants.rb:4 ParsePackwerk::ROOT_PACKAGE_NAME = T.let(T.unsafe(nil), String) +# source://parse_packwerk-0.14.0/lib/parse_packwerk/violation.rb:4 class ParsePackwerk::Violation < ::T::Struct const :class_name, ::String const :files, T::Array[::String] const :to_package_name, ::String const :type, ::String + # source://parse_packwerk-0.14.0/lib/parse_packwerk/violation.rb:13 sig { returns(T::Boolean) } def dependency?; end + # source://parse_packwerk-0.14.0/lib/parse_packwerk/violation.rb:18 sig { returns(T::Boolean) } def privacy?; end class << self + # source://sorbet-runtime-0.5.10323/lib/types/struct.rb:13 def inherited(s); end end end diff --git a/visualize_packwerk.gemspec b/visualize_packwerk.gemspec index cf75d41..bc73e9c 100644 --- a/visualize_packwerk.gemspec +++ b/visualize_packwerk.gemspec @@ -25,7 +25,6 @@ Gem::Specification.new do |spec| spec.add_dependency 'sorbet-runtime' spec.add_dependency 'parse_packwerk' - spec.add_dependency 'package_protections' spec.add_dependency 'code_ownership' spec.add_dependency 'rake' spec.add_dependency 'ruby-graphviz'