UnionOfRAD / li3_quality

(unmaintained) Code quality assurance for li₃.
BSD 3-Clause "New" or "Revised" License
12 stars 10 forks source link

Git Pre-commit Hook and Views #59

Closed jasonroyle closed 11 years ago

jasonroyle commented 11 years ago

I implemented the git pre-commit hook (as in the README.md) but using this while committing lithium view files in raw HTML gave me unexpected errors such as:

File does not begin with <?php File does not end with ?>

Also When a line ends with a period the following line will error with:

Incorrect tab indention 0 should be 1.

bayleedev commented 11 years ago

I believe in another ticket some users were reporting the same issues with php 5.4. What version of php are you running?

If the line ends in a "dot" we assume you are concatenating and the next line should be a tab.

jasonroyle commented 11 years ago

Sorry, I was talking about the dot being at the end of a line of raw HTML not PHP. Do I need to do anything with phpca? I've tried downloading it and running it against the same file and it shows the same errors.

PHP 5.3.15 with Suhosin-Patch (cli) (built: Aug 24 2012 17:45:44) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

bayleedev commented 11 years ago

No, li3_quality no longer uses phpca. I believe li3_quality may be doing a line by line check of files ending in ".php" so finding a ".html.php" file, even though not in php, still finds a "." and throws a violation. I'll take a look into this issue.

jasonroyle commented 11 years ago

That would make sense, all my view extensions are .html.php. Thanks.

bayleedev commented 11 years ago

Can you confirm this problem was solved on the dev branch?

jasonroyle commented 11 years ago

I'll test now, thanks for the quick response.

jasonroyle commented 11 years ago

Unfortunately I'm still getting violations:

Line Position Violation


1 - File does not begin with <?php 29 - File does not end with ?> 26 - Inline HTML should be in the following format: "<?=$var; ?>"

The third violation happens after php <?= $this->html->link(...) ?> These violations from app/views/pages/cookies.html.php Would it be useful to you if I sent you the file causing violations?

gwoo commented 11 years ago

I think the old li3_qa skipped the view directory. I wonder if we should do the same here.

nateabele commented 11 years ago

Sometimes people have their own view directories. I'd rather be smart about checking by file name. I'm pretty sure we have some stuff in Libraries that's able to search for class files.

bayleedev commented 11 years ago

We search views simply for the correct format of short tags <?=$var; ?> so maybe some work on if they are looking for view files or class files on a per rule basis would be nice and only get served those.

@jasonroyle yes, can you upload the file somewhere?

jasonroyle commented 11 years ago

Here's the file content http://pastium.org/view/c40f0d6b02820309669e7fe7c9c22342