Giter Club home page Giter Club logo

parse_packwerk's Introduction

ParsePackwerk

This gem is meant to give a way to parse the various YML files that come with packwerk.

Usage

# Get all packages
# Note that currently, this does not respect configuration in `packwerk.yml`
packages = ParsePackwerk.all

# Get a single package with a given ame
package = ParsePackwerk.find('packs/my_pack')

# Get a structured `package_todo.yml` object a single package
package_todo = ParsePackwerk::PackageTodo.for(package)

# Count violations of a particular type for a package
package_todo.violations.count(&:privacy?)
package_todo.violations.count(&:dependency?)

# Get the number of files a particular constant is violated in
package_todo.violations.select { |v| v.class_name == 'SomeConstant' }.sum { |v| v.files.count }

Why does this gem exist?

We generally recommend folks depend on packwerk rather than parse_packwerk. This gem is mostly a private implementation for other parts of the Big Rails modularization toolchain.

This gem exists for this toolchain for these reasons:

  • packwerk is lacking public APIs for the behavior we want. It's close with PackageSet, but we need to also be able to parse violations.
  • Certain critical, production runtime code-paths need to use this, and we want a simple, low-dependency, infrequently changing dependency for our production environment. One example of production usage is that package.yml files can store team ownership information, which is used when an error happens in production to route it to the right team.
  • packwerk has heavy duty dependencies like rails and lots of others, and it adds a degree of maintenance cost and complexity that isn’t necessary when all we want to do is read YML files

Long-term, it might make sense for these reasons to extract out some of the parsing from packwerk into a separate gem similar to this so that we can leverage the ecosystem of tools associated with the idea of a “pack” in ways that are simple and safe for both development and production environments.

parse_packwerk's People

Contributors

shageman avatar schoblaska avatar professor avatar tastypi avatar geshwho avatar oskarpearson avatar bschrag620 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.