Skip to content

Commit

Permalink
Merge branch 'release/0.1.0'
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/IKEA/Tradfri/Collection/Devices.php
#	src/IKEA/Tradfri/Collection/Groups.php
#	src/IKEA/Tradfri/Collection/Lightbulbs.php
#	src/IKEA/Tradfri/Command/CommandAbstract.php
  • Loading branch information
Fahl-Design committed Jun 16, 2018
2 parents 2ff3727 + 1d7620d commit 98bce2e
Show file tree
Hide file tree
Showing 73 changed files with 2,305 additions and 4,993 deletions.
73 changes: 57 additions & 16 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,67 @@
engines:
duplication:
enabled: true
version: "2"
checks:
argument-count:
config:
languages:
- php
fixme:
enabled: true
threshold: 4
complex-logic:
config:
threshold: 4
file-lines:
config:
threshold: 250
method-complexity:
config:
threshold: 5
method-count:
config:
threshold: 20
method-lines:
config:
threshold: 25
nested-control-flow:
config:
threshold: 4
return-statements:
config:
threshold: 4
similar-code:
config:
threshold: # language-specific defaults. an override will affect all languages.
identical-code:
config:
threshold: # language-specific defaults. an override will affect all languages.

plugins:
phpmd:
enabled: true
config:
file_extensions:
- php
rulesets: "cleancode,codesize,naming,design,unusedcode"
rulesets: "unusedcode,codesize,naming,build/configs/ruleset.xml"
phpcodesniffer:
enabled: true
config:
file_extensions: "php"
standard: "ZEND"
ratings:
paths:
- src/**
- "**.php"
exclude_paths:
- "vendor/**/*"
- "**Test.php"
standard: "Zend"
checks:
Generic Functions OpeningFunctionBraceBsdAllman BraceOnSameLine:
enabled: false
PSR2 Methods MethodDeclaration Underscore:
enabled: false
PSR2 Classes PropertyDeclaration Underscore:
enabled: false
PSR1 Files SideEffects FoundWithSymbols:
enabled: false
sonar-php:
enabled: true
config:
tests_patterns:
- test/unit/**
duplication:
enabled: true

exclude_patterns:
- .git/**/*
- vendor/**/*
- tests/**/*
- wiki/**/*
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ fabric.properties
/tests/_data/example.php
coverage/*
!coverage/.gitkeep

composer.lock
149 changes: 97 additions & 52 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -1,60 +1,105 @@
<?php
declare(strict_types=1);
$header = <<<'EOF'
HEADER
EOF;

return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@PHP56Migration' => true,
'encoding' => true,
'single_blank_line_at_eof' => true,
'no_spaces_after_function_name' => true,
'no_closing_tag' => true,
'object_operator_without_whitespace' => true,
'single_import_per_statement' => true,
'method_argument_space' => true,
'line_ending' => true,
'no_alias_functions' => true,
'no_empty_statement' => true,
'indentation_type' => true,
'blank_line_after_namespace' => true,
'lowercase_keywords' => true,
'no_spaces_inside_parenthesis' => true,
'braces' => true,
'no_trailing_whitespace' => true,
'no_unused_imports' => true,
'no_whitespace_in_blank_line' => true,
'visibility_required' => true,
'standardize_not_equals' => true,
'full_opening_tag' => true,
'array_syntax' => ['syntax' => 'short'],
'combine_consecutive_unsets' => true,
// one should use PHPUnit methods to set up expected exception instead of annotations
'general_phpdoc_annotation_remove' => ['expectedException', 'expectedExceptionMessage', 'expectedExceptionMessageRegExp'],
// 'header_comment' => ['header' => $header],
'heredoc_to_nowdoc' => true,
'list_syntax' => ['syntax' => 'long'],
'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'],
'no_short_echo_tag' => true,
'no_unreachable_default_argument_value' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => false,
'ordered_imports' => true,
'php_unit_strict' => true,
'php_unit_test_class_requires_covers' => false,
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_order' => true,
'semicolon_after_instruction' => true,
'strict_comparison' => true,
'strict_param' => true,
])
->setRules(
[
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'align_double_arrow' => true,
'align_equals' => false
],
'blank_line_after_namespace' => true,
'blank_line_before_statement' => [
'statements' => [
'break',
'continue',
'return',
'throw',
'try',
],
],
'braces' => true,
'cast_spaces' => true,
'concat_space' => ['spacing' => 'none'],
'elseif' => true,
'encoding' => true,
'full_opening_tag' => true,
'function_declaration' => true,
/*'header_comment' => ['header' => $header, 'separate' => 'none'],*/
'indentation_type' => true,
'line_ending' => true,
'lowercase_constants' => true,
'lowercase_keywords' => true,
'method_argument_space' => true,
'native_function_invocation' => true,
'no_alias_functions' => true,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'no_closing_tag' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_consecutive_blank_lines' => true,
'no_leading_namespace_whitespace' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_spaces_after_function_name' => true,
'no_spaces_inside_parenthesis' => true,
'no_trailing_comma_in_list_call' => true,
'no_trailing_whitespace' => true,
'no_unused_imports' => true,
'no_whitespace_in_blank_line' => true,
'phpdoc_align' => true,
'phpdoc_indent' => true,
'phpdoc_no_access' => true,
'phpdoc_no_empty_return' => true,
'phpdoc_no_package' => true,
'phpdoc_scalar' => true,
'phpdoc_separation' => true,
'phpdoc_to_comment' => false,
'phpdoc_trim' => true,
'phpdoc_types' => true,
'phpdoc_var_without_name' => true,
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_order' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_types_order' => true,
'return_assignment' => true,
'semicolon_after_instruction' => true,
'single_line_comment_style' => true,
'strict_comparison' => true,
'strict_param' => true,
'string_line_ending' => true,
'yoda_style' => true,
'self_accessor' => true,
'simplified_null_return' => false,
'single_blank_line_at_eof' => true,
'single_import_per_statement' => true,
'single_line_after_imports' => true,
'single_quote' => true,
'ternary_operator_spaces' => true,
'trim_array_spaces' => true,
'visibility_required' => true,
'ordered_imports' => true,
'php_unit_strict' => true,
'php_unit_test_class_requires_covers' => false,
'ternary_to_null_coalescing' => true,
'multiline_comment_opening_closing' => false,
'native_constant_invocation' => true,
'native_function_casing' => true,
'@PHP71Migration' => false,
'function_typehint_space' => true,
'fully_qualified_strict_types' => true,
'modernize_types_casting' => true,
'return_type_declaration' => true,
]
)
->setFinder(
PhpCsFixer\Finder::create()
->ignoreDotFiles(true)
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
->exclude(__DIR__.'/vendor')
)
;
->files()
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests')
->name('*.php')
);
54 changes: 23 additions & 31 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,44 @@
language: php

sudo: false

cache:
directories:
- $HOME/.composer/cache
- $HOME/.local

- vendor
- $HOME/.composer/cache
- $HOME/.php-cs-fixer
- $HOME/.local
env:
RUN_WITH_COVERAGE=false
global:
- CC_TEST_REPORTER_ID=ff208c24a9f196d9bfc66a49f6bf8592a07e82c6eed47ea481e299c4c648e393
- RUN_WITH_COVERAGE=false

matrix:
fast_finish: true
include:
- php: 7.0
env: EXECUTE_CS_CHECK=true RUN_WITH_COVERAGE=true PATH="$HOME/.local/bin:$PATH"
- php: 7.0
- php: 7.1
- php: 7.2
- php: nightly
- php: hhvm

- php: 7.0
- php: 7.0
env: EXECUTE_CS_CHECK=true RUN_WITH_COVERAGE=true PATH="$HOME/.local/bin:$PATH"
- php: 7.1
- php: 7.2
- php: nightly
allow_failures:
- php: hhvm
- php: nightly
- php: 7.2
- php: nightly

before_install:
- rm -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
- travis_retry composer self-update
- git config --global user.name travis-ci
- git config --global user.email [email protected]
- if [[ $RUN_WITH_COVERAGE == 'true' ]]; then curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter; fi
- if [[ $RUN_WITH_COVERAGE == 'true' ]]; then chmod +x ./cc-test-reporter; fi
- if [[ $RUN_WITH_COVERAGE == 'true' ]]; then ./cc-test-reporter before-build; fi
- ./build/script/travis_before_install.sh

install:
- travis_retry composer update --no-interaction --prefer-source
- phpunit --version
- travis_retry composer self-update
- travis_retry composer install --prefer-dist --optimize-autoloader --profile --no-interaction

script:
- if [[ $EXECUTE_CS_CHECK == 'true' ]]; then composer cs-check; fi
- if [[ $RUN_WITH_COVERAGE != 'true' ]]; then composer run-tests; fi
- if [[ $RUN_WITH_COVERAGE == 'true' ]]; then echo zend_extension=xdebug.so >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini || return 0; fi
- if [[ $RUN_WITH_COVERAGE == 'true' ]]; then composer build-coverage; fi
- if [[ $RUN_WITH_COVERAGE == 'true' ]]; then bash <(curl -s https://codecov.io/bash) -Z ; fi
- ./build/script/travis_script.sh

after_script:
- if [[ $RUN_WITH_COVERAGE == 'true' && "$TRAVIS_PULL_REQUEST" == "false" ]]; then ./cc-test-reporter after-build -t=clover tests/_output/coverage.xml --exit-code $TRAVIS_TEST_RESULT ; fi
after_success:
- ./build/script/travis_after_success.sh

notifications:
email: false
slack:
secure: JqH3MeraT5uwvV+Qh+wzjIbo0y7A7ltisIgnJjdT94EVjI94p52HHMB3ABh5/aJ/KMXtcFNov9x5G60+6UztOqHLNYiToOy3PACtz99yEOt5aniAtut9Ne9xaII06KMErCt04cYMl0tTBYiXvzc16GThZ8tEnx+2Hmr5Craj2qn90sWSFMMi2zpyJWAo9UU9cRgYuVy/KGP3Qji3GUe7yXpDMZD4BT5DFr0nr5P/CiJZnnIzseB6LP8A/t9FF2wYnVTyjB9uR+q+A40s7dZ2SSxN/PCi853acJDcozg5uxXaA4RMFVBILzGrWncLl72rxayq8fg4376rEFCFcQBv3lSZN2RwZVbiZIukZ6n3ZDoe+nXJ/9irBH/8drJuDUssIlVVzu8oZ0OzCmpmvpCovy7XToUiTlkEQYc4nvTMgVa9GlmjhevEDLSsS+1qouFmlb8oXsh2rBhRVXUMXTN6VxD3uDFXYvswhcmGNYA5xkH0f1VrgYBqAYjUgKQ1H05Y5zguMSdbcPQsMJd4ZsI8Z/vEZcPoonfCD+nAH0HTVxxD4JVN/4H3lfaF+rNelBMZN/s5JX8DF3+5FQqFqVRyCZ6S+7CMY2M7YZbNx+rnxmm3J+th93p4AWHE1TRJbsiZhStDm9IpUDDoxvng8ebT2bEyLRITVmZ1Hld//AN3/OI=
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM debian as builder
MAINTAINER Benjamin Fahl
ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_FRONTEND newt
RUN apt-get update \
&& apt-get install -y \
make \
automake \
libtool \
clang \
gcc \
git \
libcunit1-dev \
doxygen \
libxml2-utils \
xsltproc \
docbook-xml \
asciidoc
ENV DEBIAN_FRONTEND newt
RUN git clone --depth 1 --recursive -b dtls https://github.com/home-assistant/libcoap.git \
&& cd libcoap \
&& ./autogen.sh \
&& ./configure --disable-documentation --disable-shared --without-debug CFLAGS="-D COAP_DEBUG_FD=stderr" \
&& make \
&& make install \
&& cd .. \
&& rm -rf libcoap
FROM debian:stable-slim as runner
COPY --from=builder ./usr/local/bin/coap-client /usr/local/bin/coap-client
COPY --from=builder ./usr/local/bin/coap-server /usr/local/bin/coap-server
COPY --from=builder ./usr/local/bin/coap-rd /usr/local/bin/coap-rd
RUN cd /usr/local/bin/ && ls -l
ENTRYPOINT /usr/local/bin/coap-client
Loading

0 comments on commit 98bce2e

Please sign in to comment.