Skip to content
This repository has been archived by the owner on May 30, 2020. It is now read-only.

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 committed Aug 18, 2019
0 parents commit 8625f59
Show file tree
Hide file tree
Showing 28 changed files with 681 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .editorconfig
@@ -0,0 +1,26 @@
root = true

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

[*.{yaml,yml,twig,php}]
indent_size = 4

[*.{js,scss,css}]
indent_size = 2

[.travis.yml]
indent_size = 2

[Jenkinsfile]
indent_size = 2

[*.{json}]
indent_size = 4

[Makefile]
indent_style = tab
7 changes: 7 additions & 0 deletions .gitattributes
@@ -0,0 +1,7 @@
.* export-ignore
Makefile export-ignore
phpstan.neon export-ignore
phpunit.xml.dist export-ignore
/docs export-ignore
/tests export-ignore
/vendor-bin export-ignore
6 changes: 6 additions & 0 deletions .gitignore
@@ -0,0 +1,6 @@
build
phpunit.xml
coverage
composer.lock
vendor
.php_cs.cache
10 changes: 10 additions & 0 deletions .kodiak.toml
@@ -0,0 +1,10 @@
version = 1

[merge]
method = "merge"
automerge_label = "automerge"
block_on_reviews_requested = true

[merge.message]
title = "pull_request_title"
body = "pull_request_body"
44 changes: 44 additions & 0 deletions .php_cs.dist
@@ -0,0 +1,44 @@
<?php

$header = <<<EOF
(c) Christian Gripp <mail@core23.de>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
EOF;

$finder = PhpCsFixer\Finder::create()
->in([ __DIR__.'/src', __DIR__.'/tests'])
;

$config = PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' => true,
'@PHP70Migration' => true,
'@PHPUnit60Migration:risky' => true,
'header_comment' => [
'header' => $header,
],
'list_syntax' => [
'syntax' => 'short',
],
'binary_operator_spaces' => [
'default' => 'align',
],
'method_chaining_indentation' => false,
'phpdoc_types_order' => [
'null_adjustment' => 'always_last',
],
'php_unit_internal_class' => false,
'php_unit_test_class_requires_covers' => false,
'no_superfluous_phpdoc_tags' => true,
'static_lambda' => true,
])
->setFinder($finder)
;

return $config;
33 changes: 33 additions & 0 deletions .rmt.yml
@@ -0,0 +1,33 @@
vcs: git

prerequisites:
- working-copy-check
- display-last-changes
- composer-json-check:
composer: composer
- command:
cmd: composer update
- tests-check:
command: vendor/bin/phpunit --stop-on-failure
- command:
cmd: vendor/bin/phpstan analyse
- command:
cmd: vendor/bin/php-cs-fixer fix --verbose
- composer-security-check
- composer-stability-check
- command:
cmd: vendor/bin/composer-require-checker check composer.json
stop_on_error: false
- command:
cmd: git remote -v

pre-release-actions:
composer-update: ~
changelog-update:
format: simple
dump-commits: true
exclude-merge-commits: true
vcs-commit: ~

version-generator: semantic
version-persister: vcs-tag
66 changes: 66 additions & 0 deletions .travis.yml
@@ -0,0 +1,66 @@
language: php

php:
- 7.2
- 7.3
- nightly

sudo: false

addons:
apt:
packages:
- libxml2-utils

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

env:
global:
- PATH="$HOME/.composer/vendor/bin:$PATH"
- SYMFONY_DEPRECATIONS_HELPER=max[self]=0
- TARGET=test

stages:
- lint
- test

matrix:
fast_finish: true
include:
- stage: lint
php: 7.3
env: TARGET=lint
- stage: lint
php: 7.3
env: TARGET=phpstan
- stage: lint
php: 7.3
env: TARGET=checkdeps
- stage: test
php: 7.2
env: COMPOSER_FLAGS="--prefer-lowest"
- stage: test
php: 7.3
env: SYMFONY_VERSION=3.4.*
- stage: test
php: 7.3
env: SYMFONY_VERSION=4.2.*
allow_failures:
- php: nightly
- php: 7.3
env: TARGET=checkdeps

before_install:
- wget "https://github.com/php-coveralls/php-coveralls/releases/download/v2.0.0/php-coveralls.phar" --output-document="${HOME}/bin/php-coveralls" && chmod u+x "${HOME}/bin/php-coveralls"
- gem install yaml-lint

install:
- if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi;
- composer update --prefer-dist --no-interaction $COMPOSER_FLAGS

script: make $TARGET

after_success:
- php-coveralls -v
21 changes: 21 additions & 0 deletions LICENSE.md
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 Christian Gripp

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
22 changes: 22 additions & 0 deletions Makefile
@@ -0,0 +1,22 @@
.PHONY: lint test

all:
@echo "Please choose a task."

lint:
composer validate
find . -name '*.yml' -not -path './vendor/*' -not -path './vendor-bin/*' -not -path './src/Resources/public/vendor/*' | xargs yaml-lint
find . \( -name '*.xml' -or -name '*.xlf' \) \
-not -path './vendor/*' -not -path './vendor-bin/*' -not -path './src/Resources/public/vendor/*' \
| xargs -I'{}' xmllint --encode UTF-8 --output '{}' --format '{}'
export PHP_CS_FIXER_IGNORE_ENV=1 && php vendor/bin/php-cs-fixer fix --verbose
git diff --exit-code

checkdeps:
vendor/bin/composer-require-checker check composer.json

phpstan:
vendor/bin/phpstan analyse

test:
vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover build/logs/clover.xml
60 changes: 60 additions & 0 deletions README.md
@@ -0,0 +1,60 @@
CommonMarkFormatterBundle
=========================


[![Latest Stable Version](https://poser.pugx.org/core23/commonmark-formatter-bundle/v/stable)](https://packagist.org/packages/core23/commonmark-formatter-bundle)
[![Latest Unstable Version](https://poser.pugx.org/core23/commonmark-formatter-bundle/v/unstable)](https://packagist.org/packages/core23/commonmark-formatter-bundle)
[![License](https://poser.pugx.org/core23/commonmark-formatter-bundle/license)](https://packagist.org/packages/core23/commonmark-formatter-bundle)

[![Total Downloads](https://poser.pugx.org/core23/commonmark-formatter-bundle/downloads)](https://packagist.org/packages/core23/commonmark-formatter-bundle)
[![Monthly Downloads](https://poser.pugx.org/core23/commonmark-formatter-bundle/d/monthly)](https://packagist.org/packages/core23/commonmark-formatter-bundle)
[![Daily Downloads](https://poser.pugx.org/core23/commonmark-formatter-bundle/d/daily)](https://packagist.org/packages/core23/commonmark-formatter-bundle)

[![Build Status](https://travis-ci.org/core23/CommonMarkFormatterBundle.svg)](https://travis-ci.org/core23/CommonMarkFormatterBundle)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/core23/CommonMarkFormatterBundle/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/core23/CommonMarkFormatterBundle)
[![Code Climate](https://codeclimate.com/github/core23/CommonMarkFormatterBundle/badges/gpa.svg)](https://codeclimate.com/github/core23/CommonMarkFormatterBundle)
[![Coverage Status](https://coveralls.io/repos/core23/CommonMarkFormatterBundle/badge.svg)](https://coveralls.io/r/core23/CommonMarkFormatterBundle)

This bundle provides a commonmark formatter for the [Sonata FormatterBundle].

## Installation

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
composer require core23/commonmark-formatter-bundle
```

### Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in `config/bundles.php` file of your project:

```php
// config/bundles.php

return [
// ...
Core23\CommonMarkFormatterBundle\Core23CommonMarkFormatterBundle::class => ['all' => true],
];
```

To use the new formatter, register the formatter in `config/packages/sonata_formatter.yaml` file of your project:

```yaml
sonata_formatter:
formatters:
commonmark:
service: core23_commonmark.formatter
```

## Add markdown extensions

If you want to use some [Github-Flavored Markdown extensions](https://github.com/thephpleague/commonmark-extras), you just need to register them inside the `config/services.yaml` file of your project:

```yaml
services:
League\CommonMark\Extras\CommonMarkExtrasExtension:
tags: [ 'core23_commonmark.extension' ]
```

[Sonata FormatterBundle]: https://github.com/sonata-project/SonataFormatterBundle
61 changes: 61 additions & 0 deletions composer.json
@@ -0,0 +1,61 @@
{
"name": "core23/commonmark-formatter-bundle",
"type": "symfony-bundle",
"description": "This bundle provides a commonmark formatter for the Sonata FormatterBundle.",
"keywords": [
"symfony",
"formatter",
"markdown",
"sonata",
"commonmark"
],
"homepage": "https://core23.de",
"license": "MIT",
"authors": [
{
"name": "Christian Gripp",
"email": "mail@core23.de"
}
],
"require": {
"php": "^7.2",
"league/commonmark": "^1.0",
"sonata-project/formatter-bundle": "^4.0",
"symfony/config": "^3.4 || ^4.2",
"symfony/dependency-injection": "^3.4 || ^4.2",
"symfony/expression-language": "^3.4 || ^4.2",
"symfony/framework-bundle": "^3.4 || ^4.2",
"symfony/http-foundation": "^3.4 || ^4.2",
"symfony/http-kernel": "^3.4 || ^4.2"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.2",
"sllh/composer-lint": "^1.0"
},
"config": {
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"Core23\\CommonMarkFormatterBundle\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Core23\\CommonMarkFormatterBundle\\Tests\\": "tests/"
}
},
"scripts": {
"post-install-cmd": [
"@composer bin all install --ansi"
],
"post-update-cmd": [
"@composer bin all update --ansi"
]
}
}
15 changes: 15 additions & 0 deletions phpstan.neon.dist
@@ -0,0 +1,15 @@
parameters:
level: max

paths:
- src
- tests

autoload_files:
- vendor-bin/test/vendor/autoload.php

ignoreErrors:
# PHPUnit
-
message: '#Property .*::\$.* has no typehint specified.#'
path: tests/

0 comments on commit 8625f59

Please sign in to comment.