Skip to content

Commit

Permalink
Merge pull request #22 from owncloud/code-style
Browse files Browse the repository at this point in the history
implement ownCloud coding standard
  • Loading branch information
individual-it committed Sep 7, 2018
2 parents 92a6458 + edc156b commit 37f5983
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ pipeline:
commands:
- make test-php-lint

owncloud-coding-standard:
image: owncloudci/php:7.1
pull: true
commands:
- make test-php-style

build:
image: owncloudci/php:7.1
pull: true
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build
/vendor/
vendor-bin/**/vendor
vendor-bin/**/composer.lock
vendor-bin/**/composer.lock
.php_cs.cache
12 changes: 12 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

$config = new OC\CodingStandard\Config();

$config
->setUsingCache(true)
->getFinder()
->exclude('vendor')
->exclude('vendor-bin')
->in(__DIR__);

return $config;
19 changes: 18 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ all_src=$(src_dirs) $(src_files)

# bin file definitions
PHPLINT=php -d zend.enable_gc=0 vendor-bin/php-parallel-lint/vendor/bin/parallel-lint
PHP_CS_FIXER=php -d zend.enable_gc=0 vendor-bin/owncloud-codestyle/vendor/bin/php-cs-fixer

# start with displaying help
.DEFAULT_GOAL := help
Expand Down Expand Up @@ -51,6 +52,16 @@ test-php-lint: ## Run phan
test-php-lint: vendor-bin/php-parallel-lint/vendor
$(PHPLINT) appinfo lib locking

.PHONY: test-php-style
test-php-style: ## Run php-cs-fixer and check owncloud code-style
test-php-style: vendor-bin/owncloud-codestyle/vendor
$(PHP_CS_FIXER) fix -v --diff --diff-format udiff --allow-risky yes --dry-run

.PHONY: test-php-style-fix
test-php-style-fix: ## Run php-cs-fixer and fix code style issues
test-php-style-fix: vendor-bin/owncloud-codestyle/vendor
$(PHP_CS_FIXER) fix -v --diff --diff-format udiff --allow-risky yes

#
# Dependency management
#--------------------------------------
Expand All @@ -68,4 +79,10 @@ vendor-bin/php-parallel-lint/vendor: vendor/bamarni/composer-bin-plugin vendor-b
composer bin php-parallel-lint install --no-progress

vendor-bin/php-parallel-lint/composer.lock: vendor-bin/php-parallel-lint/composer.json
@echo php-parallel-lint composer.lock is not up to date.
@echo php-parallel-lint composer.lock is not up to date.

vendor-bin/owncloud-codestyle/vendor: vendor/bamarni/composer-bin-plugin vendor-bin/owncloud-codestyle/composer.lock
composer bin owncloud-codestyle install --no-progress

vendor-bin/owncloud-codestyle/composer.lock: vendor-bin/owncloud-codestyle/composer.json
@echo owncloud-codestyle composer.lock is not up to date.
5 changes: 5 additions & 0 deletions vendor-bin/owncloud-codestyle/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require": {
"owncloud/coding-standard": "^1.0"
}
}

0 comments on commit 37f5983

Please sign in to comment.