paragonie / airship

Secure Content Management for the Modern Web - "The sky is only the beginning"
https://cspr.ng
Other
418 stars 41 forks source link

Deep Static Analysis and Unit Testing #180

Closed paragonie-scott closed 6 years ago

paragonie-scott commented 7 years ago

We currently have Psalm running in Travis CI on the core files (src/Engine). We should expand the coverage include everything in src. We'll have to do each Cabin individually.

muglug commented 7 years ago

Relatedly, this curious chunk of code was flagged by latest Psalm dev-master.

paragonie-scott commented 7 years ago

Oh, I should probably change null to []? (Composer still hasn't updated.)

muglug commented 7 years ago

more the if (!\is_array($data)) { check on something that is definitely an array (because of the cast)

paragonie-scott commented 7 years ago

Is there any chance we can just make the is_*() functions excluded from type errors?

muglug commented 7 years ago

They should be excluded when the type comes from a docblock (as opposed to language-level check). I think the difference here is that the if is inside a loop, and I imagine I introduced a regression with https://github.com/vimeo/psalm/pull/115. Will fix momentarily.

But still, how can that if statement ever be true?

paragonie-scott commented 7 years ago

It can't ever be true; it's dead code. I'm removing it in a few seconds. :)

muglug commented 7 years ago

Fixed in https://github.com/vimeo/psalm/commit/f0964685362dc45e867a6e22de3b4fc28b3a4f6a

paragonie-scott commented 7 years ago

Left to do before this can be closed (mostly meant as a note to myself so the next time I look through open issues for things to work on, I don't need to try to refresh my own memory):

muglug commented 7 years ago

You can do psalm --config=somefile.xml

paragonie-scott commented 7 years ago

Perfect! Thanks. :)

muglug commented 7 years ago

If you're running --diff builds locally you'll need to specify different cache directories for them, but I think your codebase is small enough that --diff builds aren't necessary.