Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Including and excluding parts of the same directory doesn't work #23

Closed
erunion opened this issue Dec 16, 2016 · 7 comments
Closed

Including and excluding parts of the same directory doesn't work #23

erunion opened this issue Dec 16, 2016 · 7 comments

Comments

@erunion
Copy link
Contributor

erunion commented Dec 16, 2016

I'm running the following config, and it doesn't appear to be properly excluding my tests/Stubs directory, because I have tests/ set up for inspection.

<?xml version="1.0"?>
<codeinspector stopOnFirstError="false" useDocblockTypes="true">
    <inspectFiles>
        <directory name="src" />
        <directory name="tests" />
    </inspectFiles>

    <excludeFiles>
        <directory name="tests/Stubs" />
    </excludeFiles>

    <fileExtensions>
        <extension name=".php" />
    </fileExtensions>
</codeinspector>
ERROR: MissingReturnType - tests/Stubs/RepresentationWithTwoFieldsButOnlyOneDocumentedStub.php:9 - Method Vimeo\Docparser\Tests\Stubs\RepresentationWithTwoFieldsButOnlyOneDocumentedStub::main does not have a return type
    protected function main()
@erunion erunion added the bug label Dec 16, 2016
@muglug muglug added enhancement and removed bug labels Dec 16, 2016
@muglug
Copy link
Collaborator

muglug commented Dec 16, 2016

Not a bug – you cannot exclude specific directories like that. But I could add support for that within the inspectFiles area. In the meantime you could put the files you do want to tests in a subdirectory of tests

@erunion
Copy link
Contributor Author

erunion commented Dec 16, 2016

It'd definitely be nice to have this, otherwise I've got to do:

<inspectFiles>
    <directory name="src" />
    <file name="tests/bootstrap.php" />
    <file name="tests/CompilerTest" />
    <file name="tests/ParserTest.php" />
    <directory name="tests/Parser" />
    <directory name="tests/Traits" />
</inspectFiles>

@muglug
Copy link
Collaborator

muglug commented Dec 16, 2016

So something like

<inspectFiles>
    <directory name="src" />
    <directory name="tests">
        <excludeFiles>
            <directory name="tests/Stubs" />
        </excludeFiles>
    </directory>
</inspectFiles>

@erunion
Copy link
Contributor Author

erunion commented Dec 16, 2016

Yeah that might work. Why not support the example in the top of the ticket?

@muglug
Copy link
Collaborator

muglug commented Dec 16, 2016

I like keeping the specific files that will be checked in a self-contained node.

Maybe includeFiles and excludeFiles could be deprecated in favour of onlyFiles and ignoreFiles, as the latter could then be used in both places. Also I think we could change inspectFiles to projectFiles while we're at it.

So the XML would look something like

<psalm>
  <projectFiles>
    <directory name="src" />
    <directory name="tests" />
    <ignoreFiles>
      <directory name="tests/Stubs" />
    </ignoreFiles>
  </projectFiles>

  <issueHandler>
    <InvalidReturnType>
      <onlyFiles>
        ...
      </onlyFiles>
    </InvalidReturnType>

    <MixedInferredReturnType>
      <ignoreFiles>
        ...
      </ignoreFiles>
    </MixedInferredReturnType>
  </issueHandler>
</psalm>

@erunion
Copy link
Contributor Author

erunion commented Dec 18, 2016

I like the idea of just moving it to projectFiles declaration.

@muglug muglug closed this as completed in b79ce90 Dec 30, 2016
muglug added a commit that referenced this issue Dec 30, 2016
@Mte90
Copy link

Mte90 commented Jan 29, 2017

The wiki not contain updates about that, but actually is not possible to use pattern for exclude files like:
<directory name="*lib*" /> <directory name="/vendor/*" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants