Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Error: "Filename STIN doesn't match the expected filename 'stdin'" #60

Closed
rdebeasi opened this issue Sep 21, 2015 · 12 comments
Closed

Error: "Filename STIN doesn't match the expected filename 'stdin'" #60

rdebeasi opened this issue Sep 21, 2015 · 12 comments
Labels

Comments

@rdebeasi
Copy link

With the latest version of linter and linter-phpcs, I get the following error above any "real" errors that the linter detects:

Error: "Filename STIN doesn't match the expected filename 'stdin' at line 1 col 1

This happens when I use the "WordPress-VIP" standard that I've installed locally, but not when I use the default standard. Running phpcs --report=full --standard=WordPress-VIP "path/myfile.php" does not produce any errors.

Running pear upgrade-all does not fix the problem.

Any idea what might be happening here? Thank you!

@steelbrain
Copy link
Contributor

cc @Arcanemagus @skyrpex

@skyrpex
Copy link
Contributor

skyrpex commented Sep 21, 2015

@rdebeasi, could you please run the following command and print the output here?

cat "path/myfile.php" | phpcs --report=json --standard=WordPress-VIP

@rdebeasi
Copy link
Author

Pretty printed for readability:

{
    "totals": {
        "errors": 1,
        "warnings": 0,
        "fixable": 0
    },
    "files": {
        "STDIN": {
            "errors": 1,
            "warnings": 0,
            "messages": [
                {
                    "message": "Filename \"STDIN\" doesn't match the expected filename \"stdin\"",
                    "source": "Generic.Files.LowercasedFilename.NotFound",
                    "severity": 5,
                    "type": "ERROR",
                    "line": 1,
                    "column": 1,
                    "fixable": false
                }
            ]
        }
    }
}

I intentionally introduced a style violation and then ran the command again:

{
    "totals": {
        "errors": 3,
        "warnings": 0,
        "fixable": 2
    },
    "files": {
        "STDIN": {
            "errors": 3,
            "warnings": 0,
            "messages": [
                {
                    "message": "Filename \"STDIN\" doesn't match the expected filename \"stdin\"",
                    "source": "Generic.Files.LowercasedFilename.NotFound",
                    "severity": 5,
                    "type": "ERROR",
                    "line": 1,
                    "column": 1,
                    "fixable": false
                },
                {
                    "message": "Expected 1 spaces after opening bracket; 0 found",
                    "source": "PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket",
                    "severity": 5,
                    "type": "ERROR",
                    "line": 41,
                    "column": 32,
                    "fixable": true
                },
                {
                    "message": "Expected 1 spaces before closing bracket; 0 found",
                    "source": "PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket",
                    "severity": 5,
                    "type": "ERROR",
                    "line": 41,
                    "column": 32,
                    "fixable": true
                }
            ]
        }
    }
}

The error also appears with the "full" report. Running the same phpcs command without catdoes not produce the "Filename STDIN" error.

I have phpcs installed through PEAR, for what it's worth.

@skyrpex
Copy link
Contributor

skyrpex commented Sep 22, 2015

Thanks for the pretty print.

Both the linter and PHPCS itself seems to work fine. It's just that your standard (WordPress-VIP) expects your PHP filenames to be lowercase. PHPCS seems to assume that STDIN is a filename...

Maybe we should file a bug at PHPCS. What do you think, @steelbrain?

@steelbrain
Copy link
Contributor

@skyrpex Instead of taking the long way around, I would suggest that we handle both the cases where it's lowercase and where it's uppercase in this package. Opening a bug won't hurt anyone, so opening it should get it fixed in the future.

@skyrpex
Copy link
Contributor

skyrpex commented Sep 22, 2015

So, shall we ignore Generic.Files.LowercasedFilename.NotFound errors from PHPCS until it gets fixed?

@steelbrain
Copy link
Contributor

I kinda misread the text above 😅 but yeah. Ignore that error.

@rdebeasi
Copy link
Author

Awesome, thank you so much! I added this change to my local copy of the plugin, and it resolves the problem.

@skyrpex
Copy link
Contributor

skyrpex commented Sep 22, 2015

Nice! Is it still showing other messages?

@rdebeasi
Copy link
Author

Yep, those appear as expected!

@Arcanemagus
Copy link
Member

@rdebeasi what version of phpcs are you running?

After further investigation it appears this issue should have been fixed already at the source, which would explain why I haven't been seeing it in 2.3.4.

@Arcanemagus
Copy link
Member

Nevermind, the fix was in there because @gsherwood just implemented it. I still have no idea why I couldn't reproduce this initially.

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

No branches or pull requests

4 participants