ibuildingsnl / qa-tools Goto Github PK
View Code? Open in Web Editor NEWA set of quality assurance tools that are easily configurable through an installer
Home Page: https://ibuildingsnl.github.io/qa-tools
License: MIT License
A set of quality assurance tools that are easily configurable through an installer
Home Page: https://ibuildingsnl.github.io/qa-tools
License: MIT License
original created by DRvanR
Currently the JSHint configurator is set up to always test whether or not node is installed, and aborts if not, see here. This is all good if you run this on your dev img. From looking at the code it seems that it wants to install JSHint on the machine. This is nice for people not having JSHint installed or integrated their IDE, but is annoying if you run this locally and/or don't have node installed (because they install it later, or people might use the rulesets for CI only without the pre-commit hook).
Imo, the user should at least be prompted to make a decision about this, rather than denying installation immediately, a.e:
JSHint cannot be installed since node is not installed, do you still want to continue configuring JSHint? (y\N)
original created by mvdbos
Runners replace build.xml snippets
original created by rosstuck
One of the developers at MijnDomein is complaining that PHP Lint is creating an error, likely because of a space in his path. He's running OS X.
Output:
php-lint:
sh: /Volumes/Disk: No such file or directory
full path is /Volumes/Disk Image/gtld-main/
original created by mvdbos
original created by seggen-ibuildings
PHPMD works best if you run it on the entire code base.
Two classes might have the same base class, making them count as 1 dependency in total. If you run just one file they count as 2. Either PHPMD should fix this, or the QA Tools should not run PHPMD on just the change set.
If you alias a class with a use-statement, the occurence in the docblock and the occurence in the code seem to count as 2 dependencies. I'm not entirely sure about this one, but I'd love to do some digging and write a PR for PHPMD.
original created by DRvanR
Well, the title says it all ;)
Output:
Do you want to enable JSHint? [Y/n]
Starting setup of the pre-commit hook for the Ibuildings QA Tools
npm ERR! install Couldn't read dependencies
npm ERR! Error: No 'name' field
npm ERR! at validName (/usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:557:40)
npm ERR! at final (/usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:340:27)
npm ERR! at /usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:140:33
npm ERR! at cb (/usr/lib/node_modules/npm/node_modules/slide/lib/async-map.js:48:11)
npm ERR! at /usr/lib/node_modules/npm/node_modules/read-package-json/read-json.js:270:40
npm ERR! at [object Object].<anonymous> (fs.js:115:5)
npm ERR! at [object Object].emit (events.js:64:17)
npm ERR! at afterRead (fs.js:1117:12)
npm ERR! at /usr/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:292:17
npm ERR! at Object.wrapper [as oncomplete] (fs.js:254:17)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <[email protected]>
npm ERR! System Linux 3.5.0-45-generic
npm ERR! command "node" "/usr/bin/npm" "install"
npm ERR! cwd /home/daan/Workspace/projects/strukton/iworkx/iworkx-blueprint/vendor/ibuildings/qa-tools
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.71
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/daan/Workspace/projects/strukton/iworkx/iworkx-blueprint/vendor/ibuildings/qa-tools/npm-debug.log
npm ERR! not ok code undefined
npm ERR! not ok code 1
PHP Fatal error: Call to a member function writeln() on a non-object in /home/daan/Workspace/projects/strukton/iworkx/iworkx-blueprint/vendor/ibuildings/qa-tools/src/Ibuildings/QA/Tools/Javascript/Console/InstallJsHintCommand.php on line 59
Seems there is a name
field missing and the error is not handled gracefully since PHP throws a fatal.
After a clean install of version 1.1.20 the tools fail with the following error:
build.xml:48: Execute failed: java.io.FileNotFoundException: /logs/checkstyle-jshint.xml (No such file or directory)
The path does not exist and does not get created. After some investigation it turns out I disabled artifacts creation at all, but the JSHint config does not take this into account (as well as the artifacts path setting).
The Composer directory (~/.composer
) also contains metadata regarding installed packages. This metadata changes often, causing the cache to be invalidated. This increases the build time in small libraries by only a few seconds. I can imagine this will be more with larger applications. The solution is to cache ~/.composer/cache/files
, rather than ~/.composer
, as done in SURFnet/yubikey-api-client-bundle#14.
As it stands, the QA tools don't install with a default Symfony2 SE installation.
To reproduce:
$ composer create-project symfony/framework-standard-edition sf2qa \~2 -n
$ cd sf2qa
$ composer require --dev ibuildings/qa-tools:1.1.\*
PHP 5.5.9
Output in this gist.
qa-tools/src/Tool/PhpMd/Resources/templates/phpmd-default.xml.twig
Lines 20 to 23 in 1ef6032
original created by lucasvanlierop
Instead of using composer to trigger installation of jshint let the build do the work.
Add the following target and let jshint targets deped on it (note that this is the parsed version of the xml)
<target name="install-jshint">
<exec executable="${basedir}/bin/qa-tools">
<arg line="install:jshint"/>
</exec>
</target>
For Symfony projects, we'd like to use the Airbnb style guide (which has a preset for ESLint). Drupal has its own style guide, including an ESLint example file: https://www.drupal.org/node/1955232.
I would like to suggest that we switch JSHint for ESLint and add a prompt to choose a coding style (offering at least Airbnb and Drupal).
We need support for Symfony 3.
original created by mvdbos
Als een file expliciet genoemd wordt als te scannen source, wordt deze niet ge-exclude, ook al match hij een exlcude pattern. Dit komt dus alleen voor bij de pre-commit variant, want de ci-versie scant alleen het root src path
Zie hier: phpmd/phpmd#102
Dit is lastig te fixen. Oplossing zou kunnen zijn om meer global excludes te doen, en deze dus al uit de changeset te houden binnen de qa-tools
original created by mvdbos
Common gebruikt een Renderer om de build.xml te genereren. Mochten we ooit iets anders willen, bijvoorbeeld Scrutinizer of Travis, dan zou alleen die Renderer aangepast moeten hoeven worden.
De verschillende configurators weten niets van renderen en manipuleren alleen de Settings. Die hoeven dan dus niet aangepast te worden.
Wel genereren ze eventueel hun eigen config files, zoals phpcs.xml
original created by mvdbos
Deze wordt gebruikt bij volgende keren draaien van qa-tools.
Bovenstaande maakt het ook mogelijk om bepaalde distros van de qa-tools te maken: die bevatten dan al een qa-tools.json en dat wordt dan gebruikt als defaults.
Configuring PHP inspections
Do you want to run `./composer.phar install` on every commit? [Y/n]
Do you want to enable PHP Lint? [Y/n]
Do you want to enable the PHP Mess Detector? [Y/n]
- Do you want to exclude custom patterns for PHP Mess Detector? [y/N]
Do you want to enable the PHP Code Sniffer? [Y/n]
- Which coding standard do you want to use? (PEAR, PHPCS, PSR1, PSR2, Squiz, Zend) [PSR2]
- Do you want to exclude some default Symfony patterns for PHP Code Sniffer? [y/N]
- Do you want to exclude some custom patterns for PHP Code Sniffer? [y/N]
- Which patterns should be excluded for PHP Code Sniffer? (comma separated)
Do you want to enable PHP Copy Paste Detection? [Y/n]
- Do you want to exclude patterns for PHP Copy Paste detection? [Y/n]
- Which patterns should be excluded for PHP Copy Paste detection? [Tests] (comma separated)
PHP Warning: explode() expects parameter 2 to be string, array given in /opt/www/OpenConext-engineblock/vendor/openconext/engineblock-metadata/vendor/ibuildings/qa-tools/src/Ibuildings/QA/Tools/Common/Configurator/Helper/MultiplePathHelper.php on line 72
Warning: explode() expects parameter 2 to be string, array given in /opt/www/OpenConext-engineblock/vendor/openconext/engineblock-metadata/vendor/ibuildings/qa-tools/src/Ibuildings/QA/Tools/Common/Configurator/Helper/MultiplePathHelper.php on line 72
PHP Warning: Invalid argument supplied for foreach() in /opt/www/OpenConext-engineblock/vendor/openconext/engineblock-metadata/vendor/ibuildings/qa-tools/src/Ibuildings/QA/Tools/Common/Configurator/Helper/MultiplePathHelper.php on line 75
Warning: Invalid argument supplied for foreach() in /opt/www/OpenConext-engineblock/vendor/openconext/engineblock-metadata/vendor/ibuildings/qa-tools/src/Ibuildings/QA/Tools/Common/Configurator/Helper/MultiplePathHelper.php on line 75
Do you want to enable the Sensiolabs Security Checker? [Y/n]
At which paths is the PHP source code located? [src] (comma separated)
Configuring PHPUnit
Do you want to enable PHPUnit tests? [Y/n]
Do you have a custom PHPUnit config? (for example, Symfony has one in 'app/phpunit.xml.dist') [y/N]
On what paths can the PHPUnit tests be found? [tests] (comma separated)
PHP Warning: explode() expects parameter 2 to be string, array given in /opt/www/OpenConext-engineblock/vendor/openconext/engineblock-metadata/vendor/ibuildings/qa-tools/src/Ibuildings/QA/Tools/Common/Configurator/Helper/MultiplePathHelper.php on line 110
Warning: explode() expects parameter 2 to be string, array given in /opt/www/OpenConext-engineblock/vendor/openconext/engineblock-metadata/vendor/ibuildings/qa-tools/src/Ibuildings/QA/Tools/Common/Configurator/Helper/MultiplePathHelper.php on line 110
PHP Warning: Invalid argument supplied for foreach() in /opt/www/OpenConext-engineblock/vendor/openconext/engineblock-metadata/vendor/ibuildings/qa-tools/src/Ibuildings/QA/Tools/Common/Configurator/Helper/MultiplePathHelper.php on line 114
Warning: Invalid argument supplied for foreach() in /opt/www/OpenConext-engineblock/vendor/openconext/engineblock-metadata/vendor/ibuildings/qa-tools/src/Ibuildings/QA/Tools/Common/Configurator/Helper/MultiplePathHelper.php on line 114
Do you want to enable an autoload script for PHPUnit? [Y/n]
As originally submitted by @DRvanR
see https://pdepend.org/documentation/getting-started.html
Also: https://pdepend.org/documentation/handbook/index.html
Simple way to get the reporting to the repo: https://github.com/travis-ci/dpl#github-pages
Also consult https://docs.travis-ci.com/user/deployment/#Uploading-Files (and following sections) on how to configure the deploy tool
Sometimes the default value overwrites the value set through the qa-tools.json, this should be checked and fixed where necessary.
original created by mvdbos
Upgrade reuses your old settings to reinstall the qa-tools. For destructive things like overwriting your pre-commit hooks, it still asks for confirmation.
Proposal: put all generated files in .qa-tools
. Currently we can have 9 files generated, which pollutes the project root.
original created by mdeletter
Each package (qatools-php, qatools-behat, ...) get its own composer.json
<arg value="--exclude {{ phpMdExcludePatterns|join(',') }}"/>
should be last. Currently it doesn't work
original created by DRvanR
At the moment (v 1.1.11) you can either enable or disable to run composer install. Personally I would prefer that this could be determined per commit. This PR adds that ability - albeit in a hacky way.
Not sure if this is something that should go in as it is a personal preference, but hey ho, a PR can be rejected eh 😉
original created by lucasvanlierop
Please add some form of caching
original created by mvdbos
In that case only defaults are chosen. Again, if there is already a qa-tools.json, those defaults willl be used
Yes
i.s.o. No
[Y/n]
in Composer ConfiguratorNo
(consistent)const
rather than injected string, add to qa-tools.jsonoriginal created by lucasvanlierop
Will try to make a PR for this later.
original created by mdeletter
Convert Ant build files to Phing build files (for now).
original created by mvdbos
The core tools and plugins will never install anything other than scripts (PHP, shell, etc.) and config files. If there are any binaries needed (such as PHP and git, or even jshint), we REQUIRE them:
QA Tools core REQUIRES: git and PHP
QA Tools PHP REQUIRES: php
QA Tools plugin Javascript REQUIRES: jshint, it doesn't even care what kind of jshint it is, as long as it is the right version and it is available in the path.
A bump to PHPUnit 5 is required in order to support PHP 7. PHPUnit 4 only supports PHP 5.3 - 5.6. Therefore the QA tools cannot be installed on PHP 7.
original created by mroest
original created by DRvanR
Currently the default jshint.maxcomplexity is set to 3. To me this seems to be low. Not sure if it would be something to update by default to say 4 or 5, allowing:
if (/* something */) {
/* do this */
} else {
/* do that */
}
/* ALSO */
if (/* something else */) {
/* do X */
} else {
/* do Y */
}
When using the current .travis.yml template, Travis runs the legacy infrastructure by default. This infrastructure doesn't support cache directories. By adding sudo: false
to .travis.yml
, cache is re-enabled.
See Routing your build to container-based infrastructure (travis.org).
If there are no objections, I'll submit a PR for this.
original created by mvdbos
alles onder src onder Common namespace: 100% coverage.
Runners: geen coverage
Configurators: even kijken wat praktisch is
Please include the Drupal Coding Standard from the coder module in this tool :)
It is quite easy to make a GitHub release after a Travis was successful by adding something like the following to .travis.yml
:
deploy:
provider: releases
api_key: $GITHUB_TOKEN
file:
- "qa-tools.phar"
- "qa-tools.phar.pubkey"
skip_cleanup: true
on:
branch: master
tags: true
Assuming the Travis build created artifacts qa-tools.phar
and qa-tools.phar.pubkey
.
See https://docs.travis-ci.com/user/deployment/releases/
This requires a github token to be set in the Travis environment variables with key GITHUB_TOKEN
. This key must be created by a GitHub account that has write access to the repository and must have the repo
permission enabled. Travis will not output this variable during build and for a PR from a fork it won't even load the variable at all, so people can't echo
it.
Of course this required the private key to sign the phar file as well, but that can be encrypted and put in the repository as well in a way that Travis can use it but nobody else can. See https://docs.travis-ci.com/user/encrypting-files/
Combine this with RMT for version tagging and changelog management and all the whole release process is fully automated 😃
original created by mvdbos
Support exclusion of directories from mess detection by PHPMD.
If the QA Tools support running PHPMD only against the Git changeset at the time of implementing this enhancement, bug #19 reported for 2.x versions applies.
original created by mvdbos
Strangely, when running the full build through ant with build.xml, the phpmd-ci target doesn't report errors for some files, but not all, that have proven errors when running phpmd manually on that file or through the qa-tools.
original created by mvdbos
original created by mvdbos
De InstallCommand van Common herkent welke packages zijn geïnstalleerd en vraagt of je die wil configureren. Runt dan de configurators van die packages.
This has the following advantages:
Record asciinema of QA Tools configure command and display in README. Make sure this works in the generated Couscous documentation.
Copied from https://github.com/ibuildingsnl/qa-tools-v3/issues/122
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.