Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions check_syntax.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
#!/bin/bash

echo "Start"
LIST=`git diff --name-only origin/master | grep -e '.php$'`

LIST=`git diff --name-only origin/master | grep '.php'`
if [ -z $LIST ]; then
echo "Success"
if [ -z "$LIST" ]; then
echo "PHP file not changed."
exit 0
fi

vendor/bin/phpcs index.php --standard=PSR2 --report=checkstyle \
| checkstyle_filter-git diff origin/master

if [ -n "$CI_PULL_REQUESTS" ]; then
git diff --name-only origin/master \
| grep -e '.php$' \
| xargs vendor/bin/phpcs -n --standard=PSR2 --report=checkstyle \
| bundle exec checkstyle_filter-git diff origin/master \
| bundle exec saddler report \
--require saddler/reporter/github \
--reporter Saddler::Reporter::Github::PullRequestReviewComment
fi
18 changes: 18 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
<?php
echo 'Hello world';
if (true) {
echo "True";
}

function hoge() {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ERROR: Opening brace should be on a new line

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ERROR: Opening brace should be on a new line

return true;
}

function moge()
{
return true;
}

if (true) {
echo "True";
}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ERROR: Expected 1 blank line at end of file; 3 found



15 changes: 15 additions & 0 deletions test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
echo 'Hello world';
if (true) {
echo "True";
}

function hoge()
{
return true;
}

function moge()
{
return true;
}