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

RFC: Standardise Psalm Configuration #127

Open
gsteel opened this issue Sep 13, 2022 · 3 comments
Open

RFC: Standardise Psalm Configuration #127

gsteel opened this issue Sep 13, 2022 · 3 comments
Labels

Comments

@gsteel
Copy link
Member

gsteel commented Sep 13, 2022

Thanks to @boesing, I recently discovered some psalm configuration options that'll be potentially helpful to improving code quality.

I'd like to start discussion about which of those options we should switch on or off by default for Laminas and Mezzio projects so that we can define a standard configuration.

Once a standard has been decided, it should be applied everywhere with an expanded baseline so that new code will need to pass a stricter set of requirements as enforced by CI.

To start discussion off, I'm thinking something like this:

<?xml version="1.0"?>
<psalm
    errorLevel="1"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="https://getpsalm.org/schema/config"
    xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
    errorBaseline="psalm-baseline.xml"
    ignoreInternalFunctionFalseReturn="false"
    ignoreInternalFunctionNullReturn="false"
    allowInternalNamedArgumentCalls="false"
    allowNamedArgumentCalls="false"
    strictBinaryOperands="true"
    disableSuppressAll="true"
    memoizeMethodCallResults="true"
    checkForThrowsDocblock="false"
    findUnusedVariablesAndParams="true"
    findUnusedCode="false"
    findUnusedPsalmSuppress="true"
>
    <projectFiles>
        <directory name="src"/>
        <directory name="test"/>
        <ignoreFiles>
            <directory name="vendor"/>
        </ignoreFiles>
    </projectFiles>

    <plugins>
        <pluginClass class="Psalm\PhpUnitPlugin\Plugin"/>
    </plugins>
</psalm>

Reference: https://psalm.dev/docs/running_psalm/configuration/

Perhaps, once decided, a template can be stored in the Laminas .github organisation repo?

@gsteel gsteel added the RFC label Sep 13, 2022
@Ocramius
Copy link
Member

Before going down this line, perhaps we could ask for psalm itself to have this sort of "stricter" defaults with a single flag? Maybe errorLevel="0"? :P

/cc @orklah

@orklah
Copy link

orklah commented Sep 13, 2022

Yeah, that'd be great, this has been suggested in Psalm issue tracker also: vimeo/psalm#7630

/cc @AndrolGenhald

@boesing
Copy link
Member

boesing commented Sep 14, 2022

I'd like to propose these two as well.

https://psalm.dev/docs/running_psalm/configuration/#ensurearraystringoffsetsexist
https://psalm.dev/docs/running_psalm/configuration/#ensurearrayintoffsetsexist

But I'd expect them to be enabled with the strictest option provided by vimeo/psalm#7630

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

No branches or pull requests

4 participants