martin-helmich / typo3-typoscript-lint

Find coding errors in your TypoScript files.
MIT License
82 stars 19 forks source link

Empty lines should not be indented #115

Closed simonschaufi closed 3 years ago

simonschaufi commented 3 years ago

I would not expect any warnings or errors with the following code:

plugin.tx_gkhrssimport_pi1 = USER
plugin.tx_gkhrssimport_pi1 {
    userFunc = GertKaaeHansen\GkhRssImport\Controller\RssImportController->main

    templateFile = {$plugin.tx_gkhrssimport_pi1.templateFile}
}

but I get a warning that my indent on line 4 is wrong (the empy line) and expected to be 1 tab.

My requirement is that empty lines should always have no indent no matter where they are.

martin-helmich commented 3 years ago

Hey Simon, thanks for the report. :+1: I suspect this might be a side effect of martin-helmich/typo3-typoscript-parser#61. I'll look into it; in the meantime, as a workaround it might help to pin the helmich/typo3-typoscript-parser dependency to the previous version 2.2.1 in your composer.json.

simonschaufi commented 3 years ago

@martin-helmich yes, this version indeed still works fine.

martin-helmich commented 3 years ago

@simonschaufi @oliverklee I've just tagged a new version that should reign in the indentation sniff.

When releasing the 2.3.0 version of helmich/typo3-typoscript-parser, I was actually aware that the parser (or the lexer, to be more precise) would produce slightly different output (and even had a call with the original contributor on whether this should be considered a breaking change and we came to the conclusion it wasn't -- although, in hindsight, it apparently was 🙄).

I noticed that the unit tests in this project would have actually caught the breaking change in the upstream library; I'll put some thought into how I can make the test suites around this project a bit more robust, to prevent any issues like this in the future.

Sorry for any inconvenience this might've caused. 😌🙏

simonschaufi commented 3 years ago

thank you for fixing it!