Skip to content

Add qlty #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
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
38 changes: 17 additions & 21 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# PHPUnit Composer min/max test.
# TODO: Make our own orb out of this.

version: 2.1
orbs:
php: circleci/[email protected]
Expand Down Expand Up @@ -82,14 +79,13 @@ commands:
name: Install XDebug
command: sudo -E install-php-extensions xdebug && sudo -E docker-php-ext-enable xdebug

install-cc-test-reporter:
install-qlty:
# TODO: Parameterize location.
steps:
- run:
name: Install Codeclimate test reporter
name: Install qlty tool test reporter
command: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
curl https://qlty.sh | sh

run-phpunit-tests:
description: |
Expand All @@ -107,36 +103,36 @@ commands:
default: test
description: The name of the script within your composer.json which will run your tests.
type: string
report-to-codeclimate:
report-to-qlty:
type: boolean
default: false
description: Report coverage info to Codeclimate.
description: Report coverage info to qlty.sh.
steps:
- checkout
- update-packages:
app-dir: <<parameters.app-dir>>
cache-key: composer.json
install-flags: <<parameters.install-flags>>
- when:
condition: <<parameters.report-to-codeclimate>>
condition: <<parameters.report-to-qlty>>
environment:
QLTY_COVERAGE_TOKEN: ${QLTY_COVERAGE_TOKEN}
steps:
- install-xdebug
- install-cc-test-reporter
- install-qlty
- run: |
./cc-test-reporter before-build
XDEBUG_MODE=coverage composer <<parameters.test-command>> -- --coverage-clover clover.xml
./cc-test-reporter after-build --coverage-input-type clover --exit-code $?
source /home/circleci/.profile
qlty coverage publish --format clover clover.xml
- when:
condition:
not: <<parameters.report-to-codeclimate>>
not: <<parameters.report-to-qlty>>
steps:
- run: |
XDEBUG_MODE=off composer <<parameters.test-command>>

jobs:
matrix-conditions:
environment:
CC_TEST_REPORTER_ID: d20339bfed51b1e242630efbe3f2745337794f7a856f610aad4d21897c5e0309
description: Run tests for matrix
executor:
name: php/default
Expand All @@ -154,18 +150,18 @@ jobs:
- when:
condition:
and:
- equal: [ "8.3", <<parameters.version>> ]
- equal: [ "", <<parameters.install-flags>> ]
- equal: ["8.3", <<parameters.version>>]
- equal: ["", <<parameters.install-flags>>]
steps:
- run-phpunit-tests:
report-to-codeclimate: true
report-to-qlty: true
install-flags: << parameters.install-flags >>
- when:
condition:
not:
and:
- equal: [ "8.3", <<parameters.version>> ]
- equal: [ "", <<parameters.install-flags>> ]
- equal: ["8.3", <<parameters.version>>]
- equal: ["", <<parameters.install-flags>>]
steps:
- run-phpunit-tests:
install-flags: << parameters.install-flags >>
Expand Down
16 changes: 16 additions & 0 deletions .qlty/configs/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
}
],
"require": {
"drupal/coder": "^8.3.13"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
80 changes: 80 additions & 0 deletions .qlty/qlty.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# This file was automatically generated by `qlty init`.
# You can modify it to suit your needs.
# We recommend you to commit this file to your repository.
#
# This configuration is used by both Qlty CLI and Qlty Cloud.
#
# Qlty CLI -- Code quality toolkit for developers
# Qlty Cloud -- Fully automated Code Health Platform
#
# Try Qlty Cloud: https://qlty.sh
#
# For a guide to configuration, visit https://qlty.sh/d/config
# Or for a full reference, visit https://qlty.sh/d/qlty-toml
config_version = "0"

exclude_patterns = [
"*_min.*",
"*-min.*",
"*.min.*",
"**/*.d.ts",
"**/.yarn/**",
"**/bower_components/**",
"**/build/**",
"**/cache/**",
"**/config/**",
"**/db/**",
"**/deps/**",
"**/dist/**",
"**/extern/**",
"**/external/**",
"**/generated/**",
"**/Godeps/**",
"**/gradlew/**",
"**/mvnw/**",
"**/node_modules/**",
"**/protos/**",
"**/seed/**",
"**/target/**",
"**/testdata/**",
"**/vendor/**",
"**/assets/**",
]

test_patterns = [
"**/test/**",
"**/spec/**",
"**/*.test.*",
"**/*.spec.*",
"**/*_test.*",
"**/*_spec.*",
"**/test_*.*",
"**/spec_*.*",
]

[smells]
mode = "comment"

[[source]]
name = "default"
default = true

[[plugin]]
name = "markdownlint"
version = "0.41.0"

[[plugin]]
name = "php-codesniffer"
package_file = ".qlty/configs/composer.json"

[[plugin]]
name = "phpstan"

[[plugin]]
name = "prettier"

[[plugin]]
name = "ripgrep"

[[plugin]]
name = "yamllint"
8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
],
"require": {
"php": ">=7.4 <9.0",
"ext-json": "*"
"ext-json": "*",
"drupal/coder": "^8.3"
},
"require-dev": {
"phpunit/phpunit": "^9.6.22",
Expand All @@ -30,7 +31,10 @@
}
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"scripts": {
"phpcbf": "./vendor/bin/phpcbf",
Expand Down
1 change: 0 additions & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols"/>
</rule>
<rule ref="PSR2"/>

</ruleset>