Skip to content

Commit

Permalink
refactor: add ramsey/devtools to the project and refactor accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
ramsey committed Aug 29, 2020
1 parent d04182c commit 1196eed
Show file tree
Hide file tree
Showing 49 changed files with 139 additions and 883 deletions.
41 changes: 0 additions & 41 deletions .codeclimate.yml

This file was deleted.

29 changes: 29 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
codecov:
require_ci_to_pass: yes

coverage:
precision: 2
round: down
range: "70...100"
status:
project:
default:
target: auto
threshold: 0%
patch:
default:
target: auto
threshold: 0%

parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no

comment:
layout: "reach,diff,flags,tree"
behavior: default
require_changes: false
6 changes: 1 addition & 5 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
.codecov.yml export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.github/ export-ignore
.gitignore export-ignore
.travis.yml export-ignore
CODE_OF_CONDUCT.md export-ignore
CONTRIBUTING.md export-ignore
bin/lint-fix.sh export-ignore
bin/repl export-ignore
bin/repl.php export-ignore
build/ export-ignore
captainhook.json export-ignore
docs/ export-ignore
Expand All @@ -16,5 +13,4 @@ phpstan.neon.dist export-ignore
phpunit.xml.dist export-ignore
psalm-baseline.xml export-ignore
psalm.xml export-ignore
resources/ export-ignore
tests/ export-ignore
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: ramsey
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE/Pull_Request_Template.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
- [ ] I have read the **CONTRIBUTING** document.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
- [ ] I have run `composer br:test:all` locally, and there were no failures or errors.
- [ ] I have run `composer test` locally, and there were no failures or errors.
32 changes: 14 additions & 18 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: main

on: [push, pull_request]
on:
push:
branches:
- master
tags:
pull_request:

jobs:

Expand Down Expand Up @@ -50,21 +55,12 @@ jobs:
- name: Install dependencies
run: composer install --no-interaction --prefer-dist --no-progress --no-suggest ${{ matrix.composer-options }}

- name: Enforce coding standards
run: composer br:lint

- name: Analyze the code for type safety issues, etc.
run: composer br:analyze

- name: Run unit tests
run: composer br:test:coverage:ci -- --coverage-text
- name: Analyze & test
run: |
composer dev:lint
composer dev:analyze:phpstan
composer dev:analyze:psalm -- --shepherd
composer dev:test:coverage:ci -- --coverage-text
- name: Publish code coverage
uses: paambaati/codeclimate-action@v2.6.0 # https://github.com/paambaati/codeclimate-action
with:
# Action requires coverageCommand, but we ran it in the previous step.
coverageCommand: echo "Sending coverage to Code Climate"
coverageLocations: ${{github.workspace}}/build/logs/clover.xml:clover
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
continue-on-error: true
- name: Publish code coverage to Codecov
uses: codecov/codecov-action@v1
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ To run all the tests and coding standards checks, execute the following from the
command line, while in the project root directory:

```
composer br:test:all
composer test
```


Expand Down
58 changes: 11 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
<a href="https://github.com/ramsey/conventional-commits"><img src="http://img.shields.io/badge/source-ramsey/conventional--commits-blue.svg?style=flat-square" alt="Source Code"></a>
<a href="https://packagist.org/packages/ramsey/conventional-commits"><img src="https://img.shields.io/packagist/v/ramsey/conventional-commits.svg?style=flat-square&label=release" alt="Download Package"></a>
<a href="https://php.net"><img src="https://img.shields.io/packagist/php-v/ramsey/conventional-commits.svg?style=flat-square&colorB=%238892BF" alt="PHP Programming Language"></a>
<br>
<a href="https://github.com/ramsey/conventional-commits/actions?query=workflow%3Amain"><img src="https://img.shields.io/github/workflow/status/ramsey/conventional-commits/main?logo=github&style=flat-square" alt="Build Status"></a>
<a href="https://codeclimate.com/github/ramsey/conventional-commits"><img src="https://img.shields.io/codeclimate/coverage/ramsey/conventional-commits?logo=Code%20Climate&style=flat-square" alt="Code Coverage"></a>
<a href="https://codeclimate.com/github/ramsey/conventional-commits"><img src="https://img.shields.io/codeclimate/coverage-letter/ramsey/conventional-commits?label=maintainability&logo=Code%20Climate&style=flat-square" alt="Maintainability"></a>
<br>
<a href="https://codecov.io/gh/ramsey/conventional-commits"><img src="https://img.shields.io/codecov/c/gh/ramsey/conventional-commits?label=codecov&logo=codecov&style=flat-square" alt="Codecov Code Coverage"></a>
<a href="https://shepherd.dev/github/ramsey/conventional-commits"><img src="https://img.shields.io/endpoint?style=flat-square&url=https%3A%2F%2Fshepherd.dev%2Fgithub%2Framsey%2Fconventional-commits%2Fcoverage" alt="Psalm Type Coverage"></a>
<a href="https://github.com/ramsey/conventional-commits/blob/master/LICENSE"><img src="https://img.shields.io/packagist/l/ramsey/conventional-commits.svg?style=flat-square&colorB=darkcyan" alt="Read License"></a>
<a href="https://packagist.org/packages/ramsey/conventional-commits/stats"><img src="https://img.shields.io/packagist/dt/ramsey/conventional-commits.svg?style=flat-square&colorB=darkmagenta" alt="Package downloads on Packagist"></a>
<a href="https://phpc.chat/channel/ramsey"><img src="https://img.shields.io/badge/phpc.chat-%23ramsey-darkslateblue?style=flat-square" alt="Chat with the maintainers"></a>
Expand All @@ -30,10 +28,11 @@ uphold this code.

## Installation

Install this package as a dependency using [Composer](https://getcomposer.org).
Install this package as a development dependency using
[Composer](https://getcomposer.org).

``` bash
composer require ramsey/conventional-commits
composer require --dev ramsey/conventional-commits
```

## Usage
Expand Down Expand Up @@ -116,37 +115,11 @@ to validate all staged changes prior to commit.

#### Composer Commands

To see all the commands available in the project `br` namespace for
To see all the commands available in the project `dev` namespace for
Composer, type:

``` bash
composer list br
```

##### Composer Command Autocompletion

If you'd like to have Composer command auto-completion, you may use
[bamarni/symfony-console-autocomplete](https://github.com/bamarni/symfony-console-autocomplete).
Install it globally with Composer:

``` bash
composer global require bamarni/symfony-console-autocomplete
```

Then, in your shell configuration file — usually `~/.bash_profile` or `~/.zshrc`,
but it could be different depending on your settings — ensure that your global
Composer `bin` directory is in your `PATH`, and evaluate the
`symfony-autocomplete` command. This will look like this:

``` bash
export PATH="$(composer config home)/vendor/bin:$PATH"
eval "$(symfony-autocomplete)"
```

Now, you can use the `tab` key to auto-complete Composer commands:

``` bash
composer br:[TAB][TAB]
composer list dev
```

#### Coding Standards
Expand All @@ -164,10 +137,10 @@ commands:

``` bash
# Lint
composer br:lint
composer dev:lint

# Lint and autofix
composer br:lint:fix
composer dev:lint:fix
```

#### Static Analysis
Expand All @@ -186,23 +159,14 @@ following command:

``` bash
# Static analysis
composer br:analyze
composer dev:analyze
```

### Project Structure
#### Project Structure

This project uses [pds/skeleton](https://github.com/php-pds/skeleton) as its
base folder structure and layout.

| Name | Description |
| ------------------| ---------------------------------------------- |
| **bin/** | Commands and scripts for this project |
| **build/** | Cache, logs, reports, etc. for project builds |
| **docs/** | Project-specific documentation |
| **resources/** | Additional resources for this project |
| **src/** | Project library and application source code |
| **tests/** | Tests for this project |

## Copyright and License

The ramsey/conventional-commits library is copyright © [Ben Ramsey](https://benramsey.com)
Expand Down
Empty file modified bin/conventional-commits
100644 → 100755
Empty file.
26 changes: 0 additions & 26 deletions bin/lint-fix.sh

This file was deleted.

5 changes: 0 additions & 5 deletions bin/repl

This file was deleted.

9 changes: 0 additions & 9 deletions bin/repl.php

This file was deleted.

73 changes: 11 additions & 62 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,17 @@
"symfony/polyfill-php80": "^1.17"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"ergebnis/composer-normalize": "^2.6",
"hamcrest/hamcrest-php": "^2",
"mockery/mockery": "^1.4",
"phpstan/extension-installer": "^1",
"phpstan/phpstan": "^0.12.32",
"phpstan/phpstan-mockery": "^0.12.5",
"phpstan/phpstan-phpunit": "^0.12.11",
"phpunit/phpunit": "^9.3",
"psy/psysh": "^0.10.4",
"slevomat/coding-standard": "^6.3",
"squizlabs/php_codesniffer": "^3.5",
"vimeo/psalm": "^3.12.2"
"ramsey/devtools": "^1.1"
},
"config": {
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
},
"command-prefix": "dev"
},
"autoload": {
"psr-4": {
"Ramsey\\CaptainHook\\": "src/CaptainHook/",
Expand All @@ -52,60 +46,15 @@
},
"autoload-dev": {
"psr-4": {
"Ramsey\\Test\\": "tests/",
"Ramsey\\Console\\": "resources/console/"
"Ramsey\\Test\\": "tests/"
},
"files": [
"vendor/hamcrest/hamcrest-php/hamcrest/Hamcrest.php"
]
},
"minimum-stability": "dev",
"prefer-stable": true,
"bin": [
"bin/conventional-commits"
],
"scripts": {
"post-autoload-dump": "captainhook install --ansi -f -s",
"br:analyze": [
"@br:analyze:phpstan",
"@br:analyze:psalm"
],
"br:analyze:phpstan": "phpstan analyse --memory-limit=1G",
"br:analyze:psalm": "psalm --diff --diff-methods --show-info=true --config=psalm.xml",
"br:build:clean": "git clean -fX build/.",
"br:build:clear-cache": "git clean -fX build/cache/.",
"br:lint": "phpcs --cache=build/cache/phpcs.cache",
"br:lint:fix": "./bin/lint-fix.sh",
"br:repl": [
"echo ; echo 'Type ./bin/repl to start the REPL.'"
],
"br:test": "phpunit --colors=always",
"br:test:all": [
"@br:lint",
"@br:analyze",
"@br:test"
],
"br:test:coverage:ci": "phpunit --coverage-clover build/logs/clover.xml",
"br:test:coverage:html": "phpunit --coverage-html build/coverage",
"pre-commit": [
"@br:lint:fix",
"@br:lint",
"@br:analyze"
],
"test": "@br:test:all"
},
"scripts-descriptions": {
"br:analyze": "Performs static analysis on the code base.",
"br:analyze:phpstan": "Runs the PHPStan static analyzer.",
"br:analyze:psalm": "Runs the Psalm static analyzer.",
"br:build:clean": "Removes everything not under version control from the build directory.",
"br:build:clear-cache": "Removes everything not under version control from build/cache/.",
"br:lint": "Checks all source code for coding standards issues.",
"br:lint:fix": "Checks source code for coding standards issues and fixes them, if possible.",
"br:repl": "Note: Use ./bin/repl to run the REPL.",
"br:test": "Runs the full unit test suite.",
"br:test:all": "Runs linting, static analysis, and unit tests.",
"br:test:coverage:ci": "Runs the unit test suite and generates a Clover coverage report.",
"br:test:coverage:html": "Runs the unit tests suite and generates an HTML coverage report.",
"pre-commit": "These commands are run as part of a Git pre-commit hook installed using captainhook/captainhook. Each command should be prepared to accept a list of space-separated staged files.",
"test": "Shortcut to run the full test suite."
}
]
}
Empty file removed docs/.gitkeep
Empty file.
Loading

0 comments on commit 1196eed

Please sign in to comment.