Hhvm: Feature: Exclude folders from Hack type checker

Created on 25 May 2016  路  3Comments  路  Source: facebook/hhvm

The Hack type checker would benefit immensely from the ability to exclude files and folders from being checked. My primary use case:

  • Imagine foo/bar, a Hack library entirely in strict mode.

    • foo/bar includes unit tests all in strict mode.

    • foo/bar lists some unit testing library in the require-dev section of composer.json.

  • Imagine hello/world, a Hack project which requires foo/bar.

    • hello/world doesn't use the same unit testing library as foo/bar.

  • When Composer installs foo/bar, it brings along the strict mode unit tests.
  • When the type checker runs, it will complain about missing symbols from foo/bar's unit tests.

Being able to add a line to .hhconfig like exclude=vendor/**/tests, or at the very least, a list of directory names, e.g. exclude=vendor/foo/bar/tests:vendor/baz/biz/tests would be amazing.

In a commit on one of my projects, @fredemmott mentions that a library could add some export-ignore statements to their .gitattributes, but as he says, that doesn't help dev-$BRANCH dependencies.

Nota Bene

I pored through the existing issues, checking that this isn't a dupe. The closest is #4855, which is close but no cigar. It's in the spirit of #4856, but I think the aim is different. It's also similar to #5611 in concept, but this feature request targets hh_server, not hh_format.

feature request hack

Most helpful comment

All 3 comments

When Hack first launched I used to be against this, but having actually worked more extensively with Composer (and listened to a year of @fredemmott's complaining ;)) I think this makes a lot of sense. Unfortunately I never got around to it before I left the team at the end of last year, and it's fairly unlikely to get implemented anytime soon :(

Concrete use case: hhvm/user-documentation needs an HHVM source tree (and in the near future, an HSL source tree), to build the documentation. These are not used at runtime, and should not be typechecked - but they need to be available during the build process.

Submoduling them would be nice, but it would mean that .hhconfig can't be in the top level directory unless this is fixed.

Something like:

ignore_directories = data-sources/, vendor/**/tests/
Was this page helpful?
0 / 5 - 0 ratings