mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Add phpcs ruleset and fix violations
This commit is contained in:
parent
ba51a8e8e1
commit
563e33c772
22
phpcs.xml.dist
Normal file
22
phpcs.xml.dist
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ruleset name="SilverStripe">
|
||||||
|
<description>CodeSniffer ruleset for SilverStripe coding conventions.</description>
|
||||||
|
|
||||||
|
<!-- base rules are PSR-2 -->
|
||||||
|
<rule ref="PSR2" >
|
||||||
|
<!-- Current exclusions -->
|
||||||
|
<exclude name="PSR1.Methods.CamelCapsMethodName" />
|
||||||
|
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols" />
|
||||||
|
<exclude name="PSR2.Classes.PropertyDeclaration" />
|
||||||
|
<exclude name="PSR2.ControlStructures.SwitchDeclaration" /> <!-- causes php notice while linting -->
|
||||||
|
<exclude name="PSR2.ControlStructures.SwitchDeclaration.WrongOpenercase" />
|
||||||
|
<exclude name="PSR2.ControlStructures.SwitchDeclaration.WrongOpenerdefault" />
|
||||||
|
<exclude name="PSR2.ControlStructures.SwitchDeclaration.TerminatingComment" />
|
||||||
|
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
|
||||||
|
<exclude name="Squiz.Scope.MethodScope" />
|
||||||
|
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
|
||||||
|
<exclude name="Generic.Files.LineLength.TooLong" />
|
||||||
|
<exclude name="PEAR.Functions.ValidDefaultValue.NotAtEnd" />
|
||||||
|
</rule>
|
||||||
|
</ruleset>
|
||||||
|
|
@ -6,7 +6,6 @@ use SilverStripe\Blog\Model\BlogPost;
|
|||||||
use SilverStripe\Lumberjack\Forms\GridFieldSiteTreeState;
|
use SilverStripe\Lumberjack\Forms\GridFieldSiteTreeState;
|
||||||
use SilverStripe\View\Requirements;
|
use SilverStripe\View\Requirements;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a component to the {@link GridField} which tells the user whether or not a blog post
|
* Provides a component to the {@link GridField} which tells the user whether or not a blog post
|
||||||
* has been published and when.
|
* has been published and when.
|
||||||
|
@ -221,7 +221,7 @@ class BlogController extends PageController
|
|||||||
if ($tag) {
|
if ($tag) {
|
||||||
$this->blogPosts = $tag->BlogPosts();
|
$this->blogPosts = $tag->BlogPosts();
|
||||||
|
|
||||||
if($this->isRSS()) {
|
if ($this->isRSS()) {
|
||||||
return $this->rssFeed($this->blogPosts, $tag->getLink());
|
return $this->rssFeed($this->blogPosts, $tag->getLink());
|
||||||
} else {
|
} else {
|
||||||
return $this->render();
|
return $this->render();
|
||||||
@ -265,7 +265,7 @@ class BlogController extends PageController
|
|||||||
if ($category) {
|
if ($category) {
|
||||||
$this->blogPosts = $category->BlogPosts();
|
$this->blogPosts = $category->BlogPosts();
|
||||||
|
|
||||||
if($this->isRSS()) {
|
if ($this->isRSS()) {
|
||||||
return $this->rssFeed($this->blogPosts, $category->getLink());
|
return $this->rssFeed($this->blogPosts, $category->getLink());
|
||||||
} else {
|
} else {
|
||||||
return $this->render();
|
return $this->render();
|
||||||
|
@ -123,5 +123,3 @@ class BlogCategoriesWidget extends Widget
|
|||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -215,5 +215,4 @@ class BlogTagTest extends FunctionalTest
|
|||||||
$tag->write();
|
$tag->write();
|
||||||
$this->assertEquals($tag->URLSegment, "another-test");
|
$this->assertEquals($tag->URLSegment, "another-test");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user