Skip to content

Commit 03138a4

Browse files
committed
Add codestylechecker
1 parent 6d945f4 commit 03138a4

File tree

6 files changed

+2089
-1
lines changed

6 files changed

+2089
-1
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Desktop.ini
2525
*.swp
2626
*~.nib
2727
*~
28+
*.travis/*
2829

2930
# Ignore mergetool files
3031
*.orig
@@ -34,7 +35,6 @@ build.properties
3435
phing-latest.phar
3536

3637
# Composer
37-
composer.lock
3838
composer.phar
3939
vendor/*
4040
tests/vendor/*

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
language: php
2+
php:
3+
- 5.4
4+
before_script:
5+
- composer install
6+
7+
script:
8+
- vendor/bin/robo check:codestyle

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,13 @@ You should remove the WebDriver module and replace it with the JoomlaBrowser mod
103103
AcceptanceHelper:
104104
...
105105
```
106+
107+
## Tools
108+
Joomla Browser comes with a set of tools added via robo.li
109+
110+
### Code Style Checker
111+
To check automatically the code style execute the following commands in your Terminal window at the root of the repository:
112+
113+
- `$ composer install`
114+
- `$ vendor/bin/robo`
115+
- `$ vendor/bin/robo check:codestyle`

RoboFile.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
/**
4+
* This is project's console commands configuration for Robo task runner.
5+
*
6+
* @see http://robo.li/
7+
*/
8+
class RoboFile extends \Robo\Tasks
9+
{
10+
// Load tasks from composer, see composer.json
11+
use \joomla_projects\robo\loadTasks;
12+
13+
private $extension = '';
14+
15+
/**
16+
* Set the Execute extension for Windows Operating System
17+
*
18+
* @return void
19+
*/
20+
private function setExecExtension()
21+
{
22+
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
23+
{
24+
$this->extension = '.exe';
25+
}
26+
}
27+
28+
/**
29+
* Check the code style of the project against a passed sniffers using PHP_CodeSniffer_CLI
30+
*
31+
* @param string $sniffersPath Path to the sniffers. If not provided Joomla Coding Standards will be used.
32+
*/
33+
public function checkCodestyle($sniffersPath = null)
34+
{
35+
if (is_null($sniffersPath))
36+
{
37+
$this->say('Downloading Joomla Coding Standards Sniffers');
38+
$this->_exec("git $this->extension clone -b master --single-branch --depth 1 https://github.com/joomla/coding-standards.git .travis/phpcs/Joomla");
39+
$sniffersPath = __DIR__ . '/.travis/phpcs/Joomla';
40+
}
41+
42+
$this->taskCheckCodeStyle()
43+
->inspect(__DIR__ . '/src')
44+
->dontStopOnFail(true)
45+
->standard($sniffersPath)
46+
->run();
47+
}
48+
}

composer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
"php": ">=5.3.0",
1919
"codeception/codeception": "2.*"
2020
},
21+
"require-dev": {
22+
"codegyre/robo": "^0.5.3",
23+
"joomla-projects/robo": "dev-master"
24+
},
2125
"autoload": {
2226
"psr-4": {
2327
"Codeception\\Module\\": "src"

0 commit comments

Comments
 (0)