Skip to content

Added vendor/project namespace, restructured folders for PSR-4 #58

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

Merged
merged 6 commits into from
Jul 29, 2016
Merged
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
27 changes: 27 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
engines:
duplication:
enabled: true
config:
languages:
- php
phpcodesniffer:
enabled: true
phpmd:
enabled: true
checks:
CleanCode/ElseExpression:
enabled: false
Controversial/Superglobals:
enabled: false
exclude_fingerprints:
# High complexity in CiInfo#toArray()
- 8f1ff5077ea52a5fee818bde73a0dbb7
- efc665f3aa41cbbd0bbd0ec9c945a453
ratings:
paths:
- "**.inc"
- "**.module"
- "**.php"
exclude_paths:
- tests/
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.idea/
.vagrant/
Vagrantfile
build/
vendor/
box.phar
codeclimate-test-reporter.phar
composer.lock
composer.phar
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ cache:
directories:
- $HOME/.composer/cache

env:
global:
secure: Yc+Xohkr/iEUU7FCQuSLXAE9ywNW9g6CfrM1Ki0Hl+fS15F3AXT7dFY8EyCJ4dP1/oI0dBmwrGWrltXV0XWIjGV1Ms3tefCgQpBBAqwT+hImzVP3RbpZW8Iyo2d0VgiDemQF1LWYD/pKu6d8WljTnv5D77NIMdEJjQ0uzeTLWdw=

before_install:
- composer self-update

Expand Down
38 changes: 29 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"name": "codeclimate/php-test-reporter",
"description": "PHP client for reporting test coverage to Code Climate",
"keywords": ["codeclimate", "coverage"],
"keywords": [
"codeclimate",
"coverage"
],
"homepage": "https://github.com/codeclimate/php-test-reporter",
"type": "library",
"license": "MIT",
Expand All @@ -15,23 +18,40 @@
"require": {
"php": ">=5.3",
"ext-curl": "*",
"satooshi/php-coveralls": "1.0.*",
"symfony/console": ">=2.0"
"satooshi/php-coveralls": "^1.0",
"symfony/console": "^2.0"
},
"require-dev": {
"phpunit/phpunit": "3.7.*@stable",
"ext-xdebug": "*"
"ext-xdebug": "*",
"tm/tooly-composer-script": "^1.0"
},
"autoload": {
"psr-0": {
"CodeClimate\\Component": "src/",
"CodeClimate\\Bundle": "src/"
"psr-4": {
"CodeClimate\\PhpTestReporter\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"CodeClimate\\PhpTestReporter\\Tests\\": "tests/"
}
},
"bin": ["composer/bin/test-reporter"],
"bin": [
"composer/bin/test-reporter"
],
"scripts": {
"post-install-cmd": "Tooly\\ScriptHandler::installPharTools",
"post-update-cmd": "Tooly\\ScriptHandler::installPharTools"
},
"extra": {
"branch-alias": {
"dev-master": "0.3.x-dev"
}
},
"tools": {
"box": {
"url": "https://github.com/box-project/box2/releases/download/2.7.2/box-2.7.2.phar",
"only-dev": true
}
}
}
}
13 changes: 7 additions & 6 deletions composer/bin/test-reporter
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#!/usr/bin/env php
<?php

$files = array(
namespace CodeClimate\PhpTestReporter;

use CodeClimate\PhpTestReporter\Constants\Version;

$files = [
__DIR__ . '/../../vendor/autoload.php',
__DIR__ . '/../../../../autoload.php'
);
__DIR__ . '/../../../../autoload.php',
];

foreach ($files as $file) {
if (file_exists($file)) {
Expand All @@ -24,9 +28,6 @@ if (!defined('PHP_TEST_REPORTER_COMPOSER_INSTALL')) {
);
}

use CodeClimate\Bundle\TestReporterBundle\Version;
use CodeClimate\Bundle\TestReporterBundle\Console\Application;

$rootDir = realpath(dirname(PHP_TEST_REPORTER_COMPOSER_INSTALL) . '/..');

$app = new Application($rootDir, 'Code Climate PHP Test Reporter', Version::VERSION);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
<?php
namespace CodeClimate\Bundle\TestReporterBundle\Console;
namespace CodeClimate\PhpTestReporter;

use CodeClimate\Bundle\TestReporterBundle\Command\TestReporterCommand;
use CodeClimate\PhpTestReporter\ConsoleCommands\TestReporterCommand;
use Symfony\Component\Console\Application as BaseApplication;
use Symfony\Component\Console\Input\InputInterface;

/**
* Coveralls API application.
*
* @author Kitamura Satoshi <[email protected]>
*/
class Application extends BaseApplication
{
/**
* Path to project root directory.
*
* @var string
*/
private $rootDir;
Expand All @@ -37,7 +35,6 @@ public function __construct($rootDir, $name = 'UNKNOWN', $version = 'UNKNOWN')

/**
* {@inheritdoc}
*
* @see \Symfony\Component\Console\Application::getCommandName()
*/
protected function getCommandName(InputInterface $input)
Expand All @@ -47,23 +44,21 @@ protected function getCommandName(InputInterface $input)

/**
* {@inheritdoc}
*
* @see \Symfony\Component\Console\Application::getDefaultCommands()
*/
protected function getDefaultCommands()
{
// Keep the core default commands to have the HelpCommand
// which is used when using the --help option
$defaultCommands = parent::getDefaultCommands();
$defaultCommands = parent::getDefaultCommands();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra space here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like aligned tokens are actually the expected style here.

$defaultCommands[] = $this->createTestReporterCommand();

return $defaultCommands;
}

/**
* Create TestReporterCommand.
*
* @return \CodeClimate\Bundle\TestReporterBundle\Command\TestReporterCommand
* @return TestReporterCommand
*/
protected function createTestReporterCommand()
{
Expand All @@ -77,7 +72,6 @@ protected function createTestReporterCommand()

/**
* {@inheritdoc}
*
* @see \Symfony\Component\Console\Application::getDefinition()
*/
public function getDefinition()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php
namespace CodeClimate\Bundle\TestReporterBundle\Command;

use CodeClimate\Bundle\TestReporterBundle\CoverageCollector;
use CodeClimate\Bundle\TestReporterBundle\ApiClient;
namespace CodeClimate\PhpTestReporter\ConsoleCommands;

use CodeClimate\PhpTestReporter\TestReporter\ApiClient;
use CodeClimate\PhpTestReporter\TestReporter\CoverageCollector;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand All @@ -15,51 +16,48 @@ class TestReporterCommand extends Command
{
/**
* Path to project root directory.
*
* @var string
*/
protected $rootDir;

/**
* {@inheritdoc}
*
* @see \Symfony\Component\Console\Command\Command::configure()
*/
protected function configure()
{
$this
->setName('test-reporter')
->setDescription('Code Climate PHP Test Reporter')
->addOption(
'stdout',
null,
InputOption::VALUE_NONE,
'Do not upload, print JSON payload to stdout'
)
->addOption(
'coverage-report',
null,
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
'Location of clover style CodeCoverage report, as produced by PHPUnit\'s --coverage-clover option.',
array('build/logs/clover.xml')
);
->setName('test-reporter')
->setDescription('Code Climate PHP Test Reporter')
->addOption(
'stdout',
null,
InputOption::VALUE_NONE,
'Do not upload, print JSON payload to stdout'
)
->addOption(
'coverage-report',
null,
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
'Location of clover style CodeCoverage report, as produced by PHPUnit\'s --coverage-clover option.',
[ 'build/logs/clover.xml' ]
);
}

/**
* {@inheritdoc}
*
* @see \Symfony\Component\Console\Command\Command::execute()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$ret = 0;
$ret = 0;
$collector = new CoverageCollector($input->getOption('coverage-report'));
$json = $collector->collectAsJson();
$json = $collector->collectAsJson();

if ($input->getOption('stdout')) {
$output->writeln((string)$json);
} else {
$client = new ApiClient();
$client = new ApiClient();
$response = $client->send($json);
switch ($response->code) {
case 200:
Expand All @@ -72,7 +70,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
break;

default:
$output->writeln("Unexpected response: ".$response->code." ".$response->message);
$output->writeln("Unexpected response: " . $response->code . " " . $response->message);
$output->writeln($response->body);
$ret = 1;
break;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
namespace CodeClimate\Bundle\TestReporterBundle;

namespace CodeClimate\PhpTestReporter\Constants;

/**
* TestReporterBundle version.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
namespace CodeClimate\Component\System\Git;
namespace CodeClimate\PhpTestReporter\System\Git;

use Satooshi\Component\System\SystemCommand;

Expand Down
Loading