Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
REBELinBLUE committed Oct 25, 2017
0 parents commit 2f2df7f
Show file tree
Hide file tree
Showing 17 changed files with 5,221 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
codecov:
notify:
require_ci_to_pass: true

comment:
behavior: default
layout: header, diff
require_changes: false

coverage:
precision: 2
range:
- 50.0
- 80.0
round: down
status:
changes: false
patch: true
project: true
23 changes: 23 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[Makefile]
indent_style = tab

[*.php]
max_line_length = 120

[composer.json]
indent_size = 4

[*.md]
trim_trailing_whitespace = false
51 changes: 51 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Handle line endings automatically for files detected as text
# and leave all files detected as binary untouched.
* text=auto

#
## These files are text and should be normalized (Convert crlf => lf)
#

# Source code
*.php text
Makefile text

# git config
.gitattributes text
.gitignore text
.gitconfig text

# code analysis config
.php_cs.dist text
*.dist text
*.xml text
*.yml text

# misc config
.editorconfig text

# Documentation
*.md text

#
## Remove development files from git archive
#

tests/ export-ignore
.github/ export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.gitkeep export-ignore
.editorconfig export-ignore
.codecov.yml export-ignore
.travis.yml export-ignore
.styleci.yml export-ignore
.php_cs.dist export-ignore
phpunit.xml.dist export-ignore
Makefile export-ignore

#
## Do not try and merge these files
#

composer.lock -diff
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Composer files
composer.phar
vendor/

# Dev files
build/
.php_cs.cache
.php_cs
coverage.xml
phpunit.xml
94 changes: 94 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?php

return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setIndent(" ")
->setLineEnding("\n")
->setRules([
'@PSR2' => true,
'psr0' => false,
'psr4' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => ['align_equals' => true, 'align_double_arrow' => true],
'blank_line_after_opening_tag' => true,
'blank_line_before_return' => true,
'cast_spaces' => true,
'concat_space' => ['spacing' => 'one'],
'elseif' => true,
'encoding' => true,
'full_opening_tag' => true,
'function_declaration' => true,
'function_typehint_space' => true,
'hash_to_slash_comment' => true,
'include' => true,
'indentation_type' => true,
'lowercase_cast' => true,
'method_separation' => true,
'modernize_types_casting' => true,
'new_with_braces' => true,
'no_alias_functions' => true,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'no_closing_tag' => true,
'no_empty_statement' => true,
'no_extra_consecutive_blank_lines' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_multiline_whitespace_before_semicolons' => true,
'no_php4_constructor' => true,
'no_short_bool_cast' => true,
'no_short_echo_tag' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_trailing_comma_in_list_call' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_useless_else' => true,
'no_unused_imports' => true,
'no_useless_return' => true,
'no_whitespace_in_blank_line' => true,
'no_unreachable_default_argument_value' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'object_operator_without_whitespace' => true,
'phpdoc_align' => true,
'phpdoc_indent' => true,
'phpdoc_no_access' => true,
'phpdoc_no_alias_tag' => ['type' => 'var'],
'phpdoc_no_package' => true,
'phpdoc_no_empty_return' => true,
'phpdoc_order' => true,
'phpdoc_scalar' => true,
'phpdoc_summary' => true,
'phpdoc_to_comment' => true,
'phpdoc_trim' => true,
'phpdoc_var_without_name' => true,
'php_unit_construct' => true,
'php_unit_dedicate_assert' => true,
'php_unit_fqcn_annotation' => true,
'php_unit_strict' => true,
'pow_to_exponentiation' => true,
'random_api_migration' => true,
'self_accessor' => true,
'semicolon_after_instruction' => true,
'single_blank_line_at_eof' => true,
'single_blank_line_before_namespace' => true,
'single_quote' => true,
'standardize_not_equals' => true,
'strict_comparison' => true,
'strict_param' => true,
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
'ternary_operator_spaces' => true,
'trailing_comma_in_multiline_array' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'visibility_required' => true,
])
->setFinder(
PhpCsFixer\Finder::create()
->files()
->in('src')
->in('tests')
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true)
);
3 changes: 3 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
preset: psr2

linting: true
30 changes: 30 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
sudo: false

language: php

php:
- 7.0
- 7.1

cache:
directories:
- $TRAVIS_BUILD_DIR/vendor

before_install:
- phpenv config-rm xdebug.ini

install:
- travis_retry composer install --no-interaction --prefer-dist --no-suggest

script:
- make lint
- make phpcs
- make phpmd
- make phpstan
- make coverage

after_success:
- bash <(curl -s https://codecov.io/bash)

notifications:
email: false
77 changes: 77 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
.DEFAULT_GOAL := help
.PHONY: help
.SILENT:

GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
RESET := $(shell tput -Txterm sgr0)
COMPOSER := $(shell command -v composer 2> /dev/null)

test: install lint phpcs phpunit phpmd

## Install composer locally
composer:
ifndef COMPOSER
curl --silent https://getcomposer.org/installer | php -- --quiet
endif

## Install dependencies
install: composer
ifndef COMPOSER
@php composer.phar install --optimize-autoloader --prefer-dist --no-interaction --no-suggest
else
@composer install --optimize-autoloader --prefer-dist --no-interaction --no-suggest
endif

## Run PHP unit tests
phpunit:
@echo "${GREEN}Unit tests${RESET}"
@php vendor/bin/phpunit

## Run PHP mess detector
phpmd:
@echo "${GREEN}PHP Mess Detector${RESET}"
@php vendor/bin/phpmd src/ text cleancode,codesize,naming,design,controversial,unusedcode

## Run Behat
#behat:
# @echo "${GREEN}Behat${RESET}"
# @php vendor/bin/behat --format progress

## Run PHP code sniffer
phpcs:
@echo "${GREEN}PHP Code Sniffer${RESET}"
@php vendor/bin/phpcs -p --standard=psr2 --colors src/

## Run PHPStan
#phpstan:
# @echo "${GREEN}PHPStan${RESET}"
# @php vendor/bin/phpstan analyse -l 0 src/

## PHP Parallel Lint
lint:
@echo "${GREEN}PHP Parallel Lint${RESET}"
@php vendor/bin/parallel-lint src/ tests/

## Fix PHP syntax with code sniffer
fix:
@php vendor/bin/php-cs-fixer --no-interaction fix

## Generate the public API docs
docs:
@echo "Nothing here"

## Test Coverage HTML
coverage:
@echo "${GREEN}Tests with coverage${RESET}"
@phpdbg -qrr vendor/bin/phpunit --coverage-html build/ --coverage-clover coverage.xml

## Prints this help
help:
@echo "\nUsage: make ${YELLOW}<target>${RESET}\n\nThe following targets are available:\n";
@awk -v skip=1 \
'/^##/ { sub(/^[#[:blank:]]*/, "", $$0); doc_h=$$0; doc=""; skip=0; next } \
skip { next } \
/^#/ { doc=doc "\n" substr($$0, 2); next } \
/:/ { sub(/:.*/, "", $$0); printf "\033[34m%-30s\033[0m\033[1m%s\033[0m %s\n", $$0, doc_h, doc; skip=1 }' \
$(MAKEFILE_LIST)
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# {{project}}
59 changes: 59 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"name": "rebelinblue/laravel5-zxcvbn",
"description": "Service provider to use the zxcvbn project by @dropbox in Laravel 5.",
"keywords": [
"zxcvbn",
"passwords",
"security",
"validation",
"laravel"
],
"homepage": "https://github.com/REBELinBLUE/laravel5-zxcvbn",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "Stephen Ball",
"email": "[email protected]"
}
],
"require": {
"php": ">=7.0",
"illuminate/support": "~5.4|~5.5",
"bjeavons/zxcvbn-php": "^0.3"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.1",
"jakub-onderka/php-console-highlighter": "^0.3.2",
"jakub-onderka/php-parallel-lint": "^0.9.2",
"orchestra/testbench": "~3.4",
"phpmd/phpmd": "^2.6",
"phpunit/phpunit": "^6.0",
"squizlabs/php_codesniffer": "^2.8"
},
"autoload": {
"psr-4": {
"REBELinBLUE\\Zxcvbn\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"REBELinBLUE\\Zxcvbn\\Tests\\": "tests/"
}
},
"minimum-stability": "stable",
"config": {
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"providers": [
"REBELinBLUE\\Zxcvbn\\ServiceProvider"
],
"aliases": {
"Zxcvbn": "REBELinBLUE\\Zxcvbn\\Facade"
}
}
}
}
Loading

0 comments on commit 2f2df7f

Please sign in to comment.