Giter Site home page Giter Site logo

ibuildingsnl / qa-tools Goto Github PK

View Code? Open in Web Editor NEW
12.0 12.0 7.0 5.36 MB

A set of quality assurance tools that are easily configurable through an installer

Home Page: https://ibuildingsnl.github.io/qa-tools

License: MIT License

PHP 94.09% Shell 0.01% Makefile 0.74% HTML 1.78% Tcl 3.37%
php qa testing-tools

qa-tools's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qa-tools's Issues

Allow JSHint installation without node

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)

Space in path creates error in PHPlint?

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/

improve phpmd results

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.

Installation of JSHint fails

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.

Clean install failes on jsHint setup

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).

Prevent frequent Travis Composer cache invalidation

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.

QA tools don't install with Symfony2 SE

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.

Let build install jshint dependency

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>

JavaScript code styles

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).

PHPMD excludes don't always work

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

qa-tools-common als framework

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

JSON serialized versie van Settings object opslaan als qa-tools.json

original created by mvdbos

Deze wordt gebruikt bij volgende keren draaien van qa-tools.

  • Bij install worden hier de defaults uit gehaald in plaats van de standaard defaults
  • bij toekomstige update wordt dit gebruikt om de oude settings te behouden bij update.

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.

Warning for default settings.

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] 

Allow installation of pdepend for SF and "Other PHP" projects

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

  • save the output summary.xml and images in a specific directory
  • push the images to a (e.g.) qa-tools-phpmd-reports branch

Also consult https://docs.travis-ci.com/user/deployment/#Uploading-Files (and following sections) on how to configure the deploy tool

Ask for run composer install

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 😉

Small improvements

  • Add new line after asking for ENV variables in Travis Configurator so that the user answers on a blank line
  • Set default of PHPCS to Yes i.s.o. No
  • Remove double [Y/n] in Composer Configurator
  • Set default for CPD exlcude patterns question to No (consistent)
  • Move version to const rather than injected string, add to qa-tools.json
  • Fix trailing comma's in build deps in build.xml

QA-tools is not responsible for installation of binaries

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.

  • remove installation logic from JS tools

JSHint cyclomatic complexity default is low

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 */
}

Create Unit Tests

original created by mvdbos

alles onder src onder Common namespace: 100% coverage.

Runners: geen coverage
Configurators: even kijken wat praktisch is

Automatically release after successful build in Travis

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 😃

phpmd-ci target in build.xml does not report failures

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.

Qa tools opsplitsen in verschillende composer packages

original created by mvdbos

  • Common (dependency voor alle andere)
  • Drupal (conflicts PHP)
  • Javascript
  • Functional
  • PHP (conflicts Drupal)

De InstallCommand van Common herkent welke packages zijn geïnstalleerd en vraagt of je die wil configureren. Runt dan de configurators van die packages.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.