Skip to content

Commit

Permalink
Configure SCA through GH actions
Browse files Browse the repository at this point in the history
  • Loading branch information
phansys committed Jul 3, 2020
1 parent 45472c9 commit 2c1fd2d
Show file tree
Hide file tree
Showing 29 changed files with 247 additions and 149 deletions.
4 changes: 2 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.* export-ignore
*.md export-ignore
tests export-ignore
docs export-ignore
Tests export-ignore
Resources/doc export-ignore
65 changes: 65 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
on: [push, pull_request]

name: Lint

jobs:
php-cs-fixer:
name: PHP-CS-Fixer

runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: actions/checkout@v2

- name: "Run PHP-CS-Fixer"
uses: docker://oskarstark/php-cs-fixer-ga:2.16.1
with:
args: --ansi --verbose --diff --dry-run

composer-normalize:
name: composer-normalize

runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: actions/checkout@v2

- name: "Run composer-normalize"
uses: docker://localheinz/composer-normalize-action:0.5.2
with:
args: --dry-run

yaml-files:
name: YAML files

runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: actions/checkout@v2

- name: "Install Ruby 2.6"
uses: actions/setup-ruby@v1
with:
ruby-version: '2.6'

- run: gem install yaml-lint

- name: "Linting..."
run: make lint-yaml

xml-files:
name: XML files

runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: actions/checkout@v2

- run: sudo apt-get update && sudo apt-get install libxml2-utils

- name: "Linting..."
run: make lint-xml
14 changes: 14 additions & 0 deletions .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
on: [push, pull_request]
name: Quality assurance
jobs:
phpstan:
name: PHPStan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: PHPStan
uses: "docker://oskarstark/phpstan-ga"
env:
REQUIRE_DEV: true
with:
args: analyse
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ cache:
before_script:
- if [ -f xdebug.ini ]; then phpenv config-rm xdebug.ini; fi
- if [ "$GITHUB_OAUTH_TOKEN" != "" ]; then echo -e $GITHUB_OAUTH_TOKEN && composer config -g github-oauth.github.com $GITHUB_OAUTH_TOKEN; fi;
- if [ 70100 -gt $(php -r 'echo PHP_VERSION_ID;') ]; then composer remove --dev "phpstan/phpstan" --no-update; fi;
- if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi;
- if [ -n $INSTALL_VICH_UPLOADER_BUNDLE ]; then composer require "vich/uploader-bundle" --no-update; fi;
- COMPOSER_MEMORY_LIMIT=-1 composer update --prefer-dist --no-interaction $COMPOSER_FLAGS
Expand Down
1 change: 0 additions & 1 deletion Component/TicketFeatures.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class TicketFeatures
private $features;

/**
* @param array $features
* @param string $messageClass TicketMessage class
*/
public function __construct(array $features, $messageClass)
Expand Down
12 changes: 2 additions & 10 deletions Controller/TicketController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ class TicketController extends Controller
/**
* Lists all Ticket entities.
*
* @param Request $request
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function indexAction(Request $request)
Expand Down Expand Up @@ -61,8 +59,6 @@ public function indexAction(Request $request)
/**
* Creates a new Ticket entity.
*
* @param Request $request
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
*/
public function createAction(Request $request)
Expand Down Expand Up @@ -157,8 +153,7 @@ public function showAction($ticketId)
/**
* Finds and displays a TicketInterface entity.
*
* @param Request $request
* @param int $ticketId
* @param int $ticketId
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
*/
Expand Down Expand Up @@ -201,8 +196,7 @@ public function replyAction(Request $request, $ticketId)
/**
* Deletes a Ticket entity.
*
* @param Request $request
* @param int $ticketId
* @param int $ticketId
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*/
Expand Down Expand Up @@ -259,8 +253,6 @@ private function createDeleteForm($id)
}

/**
* @param TicketMessageInterface $message
*
* @return \Symfony\Component\Form\Form
*/
private function createMessageForm(TicketMessageInterface $message)
Expand Down
2 changes: 0 additions & 2 deletions Entity/Traits/TicketMessageTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,6 @@ public function getMessage()
/**
* Set createdAt.
*
* @param \DateTime $createdAt
*
* @return $this
*/
public function setCreatedAt(\DateTime $createdAt)
Expand Down
4 changes: 0 additions & 4 deletions Entity/Traits/TicketTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,6 @@ public function getSubject()
/**
* Add message.
*
* @param TicketMessageInterface $message
*
* @return $this
*/
public function addMessage(TicketMessageInterface $message)
Expand All @@ -348,8 +346,6 @@ public function addMessage(TicketMessageInterface $message)
/**
* Remove message.
*
* @param TicketMessageInterface $message
*
* @return $this
*/
public function removeMessage(TicketMessageInterface $message)
Expand Down
3 changes: 0 additions & 3 deletions EventListener/FileSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ public static function getSubscribedEvents()
];
}

/**
* @param VichEvent\Event $event
*/
public function postUpload(VichEvent\Event $event)
{
/** @var MessageAttachmentInterface $object */
Expand Down
4 changes: 0 additions & 4 deletions Form/Type/TicketMessageType.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ public function __construct(UserManagerInterface $userManager, TicketFeatures $f
$this->messageClass = $messageClass;
}

/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
Expand Down
4 changes: 0 additions & 4 deletions Form/Type/TicketType.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ public function __construct($ticketClass)
$this->ticketClass = $ticketClass;
}

/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
Expand Down
3 changes: 0 additions & 3 deletions HackzillaTicketBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

class HackzillaTicketBundle extends Bundle
{
/**
* @param ContainerBuilder $container
*/
public function build(ContainerBuilder $container)
{
parent::build($container);
Expand Down
64 changes: 64 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,67 @@ test:

test_with_vichuploaderbundle:
vendor/bin/simple-phpunit -c phpunit.xml.dist

all:
@echo "Please choose a task."
.PHONY: all

lint: lint-composer lint-yaml lint-xml lint-php
.PHONY: lint

lint-composer:
composer validate
.PHONY: lint-composer

lint-yaml:
yaml-lint --ignore-non-yaml-files --quiet --exclude vendor .

.PHONY: lint-yaml

lint-xml:
find . \( -name '*.xml' -or -name '*.xliff' \) \
-not -path './vendor/*' \
-not -path './src/Resources/public/vendor/*' \
| while read xmlFile; \
do \
XMLLINT_INDENT=' ' xmllint --encode UTF-8 --format "$$xmlFile"|diff - "$$xmlFile"; \
if [ $$? -ne 0 ] ;then exit 1; fi; \
done

.PHONY: lint-xml

lint-php:
php-cs-fixer fix --ansi --verbose --diff --dry-run
.PHONY: lint-php

cs-fix: cs-fix-php cs-fix-xml
.PHONY: cs-fix

cs-fix-php:
php-cs-fixer fix --verbose
.PHONY: cs-fix-php

cs-fix-xml:
find . \( -name '*.xml' -or -name '*.xliff' \) \
-not -path './vendor/*' \
-not -path './src/Resources/public/vendor/*' \
| while read xmlFile; \
do \
XMLLINT_INDENT=' ' xmllint --encode UTF-8 --format "$$xmlFile" --output "$$xmlFile"; \
done
.PHONY: cs-fix-xml

build:
mkdir $@

test:
ifeq ($(shell php --modules|grep --quiet pcov;echo $$?), 0)
vendor/bin/simple-phpunit -c phpunit.xml.dist --coverage-clover build/logs/clover.xml
else
vendor/bin/simple-phpunit -c phpunit.xml.dist
endif
.PHONY: test

docs:
cd docs && sphinx-build -W -b html -d _build/doctrees . _build/html
.PHONY: docs
13 changes: 2 additions & 11 deletions Manager/TicketManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ public function __construct($ticketClass, $ticketMessageClass)
}

/**
* @param ObjectManager $om
*
* @return $this
*/
public function setEntityManager(ObjectManager $om)
Expand All @@ -57,8 +55,6 @@ public function setEntityManager(ObjectManager $om)
}

/**
* @param TranslatorInterface $translator
*
* @return $this
*/
public function setTranslator(TranslatorInterface $translator)
Expand Down Expand Up @@ -140,8 +136,6 @@ public function updateTicket(TicketInterface $ticket, TicketMessageInterface $me

/**
* Delete a ticket from the database.
*
* @param TicketInterface $ticket
*/
public function deleteTicket(TicketInterface $ticket)
{
Expand Down Expand Up @@ -186,8 +180,6 @@ public function getMessageById($ticketMessageId)
/**
* Find ticket by criteria.
*
* @param array $criteria
*
* @return array|TicketInterface[]
*/
public function findTicketsBy(array $criteria)
Expand All @@ -200,9 +192,8 @@ public function findTicketsBy(array $criteria)
*
* @deprecated since hackzilla/ticket-bundle 3.3, use `getTicketListQuery()` instead.
*
* @param UserManagerInterface $userManager
* @param int $ticketStatus
* @param int $ticketPriority
* @param int $ticketStatus
* @param int $ticketPriority
*
* @return mixed
*/
Expand Down
9 changes: 4 additions & 5 deletions Manager/TicketManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Hackzilla\Bundle\TicketBundle\Manager;

use Doctrine\ORM\QueryBuilder;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\QueryBuilder;
use Hackzilla\Bundle\TicketBundle\Model\TicketInterface;
use Hackzilla\Bundle\TicketBundle\Model\TicketMessageInterface;
use Symfony\Component\Translation\TranslatorInterface;
Expand All @@ -22,7 +22,7 @@ public function createTicket();
public function createMessage(TicketInterface $ticket = null);

/**
* @return void
* NEXT_MAJOR: Declare `void` as return type.
*/
public function updateTicket(TicketInterface $ticket, TicketMessageInterface $message = null);

Expand All @@ -41,9 +41,8 @@ public function findTicketsBy(array $criteria);
*
* @deprecated since hackzilla/ticket-bundle 3.3, use `getTicketListQuery()` instead.
*
* @param UserManagerInterface $userManager
* @param int $ticketStatus
* @param int $ticketPriority
* @param int $ticketStatus
* @param int $ticketPriority
*
* @return QueryBuilder
*/
Expand Down
Loading

0 comments on commit 2c1fd2d

Please sign in to comment.