Skip to content

Commit

Permalink
NEW Add DocumentationCheck for documentation folder
Browse files Browse the repository at this point in the history
  • Loading branch information
robbieaverill committed Feb 15, 2018
1 parent 60ff9c2 commit f71034e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ The return data from `CheckSuite::getCheckDetails` is an array with the followin
* PHP code passes a [PSR-2](www.php-fig.org/psr/psr-2/)-ish linting standards check (phpcs.xml.dist is stored in
`src/Check/CodingStandardCheck` for reference)
* Contributing guide file exists
* Has documentation
* [EditorConfig](http://editorconfig.org/) configuration file exists
* [.gitattributes](https://git-scm.com/docs/gitattributes) file exists
* A license file exists
Expand Down
2 changes: 2 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ SilverStripe\ModuleRatings\CheckSuite:
points: 10
SilverStripe\ModuleRatings\Check\ContributingFileCheck:
points: 2
SilverStripe\ModuleRatings\Check\DocumentationCheck:
points: 5
SilverStripe\ModuleRatings\Check\EditorConfigFileCheck:
points: 5
SilverStripe\ModuleRatings\Check\GitAttributesFileCheck:
Expand Down
25 changes: 25 additions & 0 deletions src/Check/DocumentationCheck.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace SilverStripe\ModuleRatings\Check;

use SilverStripe\ModuleRatings\Check;

class DocumentationCheck extends Check
{
public function getKey()
{
return 'has_documentation';
}

public function getDescription()
{
return 'Has documentation';
}

public function run()
{
if (file_exists($this->getSuite()->getModuleRoot() . '/docs')) {
$this->setSuccessful(true);
}
}
}
2 changes: 1 addition & 1 deletion tests/CheckSuiteIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testRun()
{
$this->checkSuite->run();

$this->assertEquals(55, $this->checkSuite->getScore());
$this->assertEquals(58, $this->checkSuite->getScore());
$this->assertEquals(0, $this->checkSuite->getCheckDetails()['travis_passing']['points']);
}
}
1 change: 1 addition & 0 deletions tests/TestModule/docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Some documentation

0 comments on commit f71034e

Please sign in to comment.