-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
3,381 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/composer.lock binary | ||
/.phive export-ignore | ||
/features export-ignore | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/.travis.yml export-ignore | ||
/behat.yml export-ignore | ||
/box.json export-ignore | ||
/CHANGELOG.md export-ignore | ||
/Makefile export-ignore | ||
/phpcs.xml export-ignore | ||
/phpstan.neon export-ignore | ||
/README.md export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/vendor | ||
/composer.phar | ||
/byrolint.phar | ||
/byrolint.phar.asc | ||
/*.local.* | ||
/tools | ||
/VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phive xmlns="https://phar.io/phive"> | ||
<phar name="phpstan" version="^0.12.43" installed="0.12.63" location="./tools/phpstan" copy="false"/> | ||
<phar name="phpcs" version="^3.0" installed="3.5.8" location="./tools/phpcs" copy="false"/> | ||
<phar name="humbug/box" version="^3.11" installed="3.11.0" location="./tools/box" copy="false"/> | ||
<phar name="behat/behat" version="^3.8.1" installed="3.8.1" location="./tools/behat" copy="false"/> | ||
</phive> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
sudo: false | ||
|
||
language: php | ||
|
||
php: | ||
- 8.0 | ||
- 7.4 | ||
- 7.3 | ||
|
||
install: | ||
- make vendor/installed | ||
- wget -O phive.phar https://phar.io/releases/phive.phar | ||
- make tools/installed PHIVE_CMD="php phive.phar" | ||
|
||
script: | ||
- tools/behat --suite=default | ||
- make build | ||
- tools/behat --suite=phar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
|
||
## 1.0.0 - 2020-12-27 | ||
|
||
- Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
# Commands expected to be pre-installed | ||
COMPOSER_CMD=composer | ||
PHIVE_CMD=phive | ||
GPG_CMD=gpg | ||
GIT_CMD=git | ||
|
||
# Tools installed by this script | ||
BEHAT_CMD=tools/behat | ||
BOX_CMD=tools/box | ||
PHPCS_CMD=tools/phpcs | ||
PHPSTAN_CMD=tools/phpstan | ||
|
||
# Setup | ||
TARGET=byrolint.phar | ||
DESTDIR=/usr/local/bin | ||
VERSION=VERSION | ||
SIGNATURE=${TARGET}.asc | ||
SIGNATURE_ID[email protected] | ||
|
||
SRC_FILES:=$(shell find src/ bin/ -type f) | ||
|
||
.DEFAULT_GOAL=all | ||
|
||
.PHONY: all clean | ||
|
||
all: test analyze build check | ||
|
||
clean: | ||
rm $(TARGET) --interactive=no -f | ||
rm $(VERSION) --interactive=no -f | ||
rm $(SIGNATURE) --interactive=no -f | ||
rm -rf vendor | ||
rm -rf tools | ||
|
||
# | ||
# Build and sign | ||
# | ||
|
||
.PHONY: build build_release sign | ||
|
||
build: | ||
rm -rf $(VERSION) | ||
make $(TARGET) | ||
|
||
build_release: all sign | ||
|
||
$(TARGET): vendor/installed $(SRC_FILES) box.json $(VERSION) $(BOX_CMD) | ||
$(BOX_CMD) compile | ||
|
||
sign: $(SIGNATURE) | ||
|
||
$(SIGNATURE): $(TARGET) | ||
rm -rf $@ | ||
$(GPG_CMD) -u $(SIGNATURE_ID) --detach-sign --output $@ $< | ||
|
||
$(VERSION): | ||
-$(GIT_CMD) describe > $@ | ||
|
||
# | ||
# Install/uninstall | ||
# | ||
|
||
.PHONY: install uninstall | ||
|
||
install: $(TARGET) | ||
mkdir -p $(DESTDIR) | ||
cp $< $(DESTDIR)/`basename "$(TARGET)" .phar` | ||
|
||
uninstall: | ||
rm -f $(DESTDIR)/`basename "$(TARGET)" .phar` | ||
|
||
# | ||
# Tests and analysis | ||
# | ||
|
||
.PHONY: analyze test check phpstan phpcs | ||
|
||
analyze: phpstan phpcs | ||
|
||
test: vendor/installed $(BEHAT_CMD) | ||
$(BEHAT_CMD) --stop-on-failure --suite=default | ||
|
||
check: $(TARGET) $(BEHAT_CMD) | ||
$(BEHAT_CMD) --stop-on-failure --suite=phar | ||
|
||
phpstan: vendor/installed $(PHPSTAN_CMD) | ||
$(PHPSTAN_CMD) analyze -l 8 src | ||
|
||
phpcs: $(PHPCS_CMD) | ||
$(PHPCS_CMD) | ||
|
||
# | ||
# Dependencies | ||
# | ||
|
||
composer.lock: composer.json | ||
@echo composer.lock is not up to date | ||
|
||
vendor/installed: composer.lock | ||
$(COMPOSER_CMD) install | ||
touch $@ | ||
|
||
tools/installed: .phive/phars.xml | ||
$(PHIVE_CMD) install --force-accept-unsigned --trust-gpg-keys CF1A108D0E7AE720,31C7E470E2138192,0FD3A3029E470F86 | ||
touch $@ | ||
|
||
$(BEHAT_CMD): tools/installed | ||
$(BOX_CMD): tools/installed | ||
$(PHPCS_CMD): tools/installed | ||
$(PHPSTAN_CMD): tools/installed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,79 @@ | ||
# byrolint | ||
|
||
[![Packagist Version](https://img.shields.io/packagist/v/byrokrat/byrolint.svg?style=flat-square)](https://packagist.org/packages/byrokrat/byrolint) | ||
[![Build Status](https://img.shields.io/travis/byrokrat/byrolint/master.svg?style=flat-square)](https://travis-ci.com/github/byrokrat/byrolint) | ||
|
||
Command line utility for linting swedish bureaucratic content. | ||
|
||
## Installation | ||
|
||
### Using phive (recommended) | ||
|
||
Install using [phive][1]: | ||
|
||
```shell | ||
phive install byrokrat/byrolint | ||
``` | ||
|
||
### As a phar archive | ||
|
||
Download the latest version from the github [releases][2] page. | ||
|
||
Optionally rename `byrolint.phar` to `byrolint` for a smoother experience. | ||
|
||
### Using composer | ||
|
||
Install as a [composer][3] dependency: | ||
|
||
```shell | ||
composer require byrokrat/byrolint | ||
``` | ||
|
||
This will make `byrolint` avaliable as `vendor/bin/byrolint`. | ||
|
||
### From source | ||
|
||
To build you need `make` | ||
|
||
```shell | ||
make | ||
sudo make install | ||
``` | ||
|
||
The build script uses [composer][3] to handle dependencies and [phive][1] to | ||
handle build tools. If they are not installed as `composer` or `phive` | ||
respectivly you can use something like | ||
|
||
```shell | ||
make COMPOSER_CMD=./composer.phar PHIVE_CMD=./phive.phar | ||
``` | ||
|
||
## Usage | ||
|
||
Linting a regular account number | ||
|
||
```shell | ||
byrolint --account 123456678 | ||
``` | ||
|
||
Linting a personal id number | ||
|
||
```shell | ||
byrolint --personal-id 123456678 | ||
``` | ||
|
||
Check a number using all the linters | ||
|
||
```shell | ||
byrolint 123456678 | ||
``` | ||
|
||
For more information use | ||
|
||
```shell | ||
byrolint --help | ||
``` | ||
|
||
[1]: <https://phar.io/> | ||
[2]: <https://github.com/byrokrat/byrolint/releases> | ||
[3]: <https://getcomposer.org/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
default: | ||
suites: | ||
default: | ||
contexts: | ||
- FeatureContext: | ||
executable: bin/byrolint | ||
phar: | ||
contexts: | ||
- FeatureContext: | ||
executable: byrolint.phar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
/** | ||
* This file is part of byrolint. | ||
* | ||
* byrolint is free software: you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* byrolint is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with byrolint. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* Copyright 2018-20 Hannes Forsgård | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace byrokrat\byrolint; | ||
|
||
use Symfony\Component\Console\SingleCommandApplication; | ||
|
||
foreach ([__DIR__ . '/../vendor/autoload.php', __DIR__ . '/../../../autoload.php'] as $autoloader) { | ||
if (file_exists($autoloader)) { | ||
require_once $autoloader; | ||
break; | ||
} | ||
} | ||
|
||
if (!class_exists(Byrolint::class)) { | ||
die("Unable to find autoloader. Did you install dependencies using composer install?\n"); | ||
} | ||
|
||
(new Byrolint()) | ||
->configure(new SingleCommandApplication()) | ||
->run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"output": "byrolint.phar", | ||
"directories": [ | ||
"src", | ||
"vendor" | ||
], | ||
"files-bin": [ | ||
"VERSION" | ||
], | ||
"compactors": [ | ||
"KevinGH\\Box\\Compactor\\Php" | ||
], | ||
"algorithm": "SHA512", | ||
"chmod": "0555" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"name": "byrokrat/byrolint", | ||
"description": "Command line utility for linting swedish bureaucratic content", | ||
"keywords": [ | ||
"bankgiro", | ||
"plusgiro", | ||
"bank account", | ||
"Personnummer", | ||
"Organisationsnummer", | ||
"Personal id", | ||
"Corporation id", | ||
"personal identity number" | ||
], | ||
"homepage": "https://github.com/byrokrat/byrolint", | ||
"type": "project", | ||
"license": "GPL-3.0-or-later", | ||
"authors": [ | ||
{ | ||
"name": "Hannes Forsgård", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"bin": [ | ||
"bin/byrolint" | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"byrokrat\\byrolint\\": ["src/"] | ||
} | ||
}, | ||
"config": { | ||
"platform": { | ||
"php": "7.3.0" | ||
} | ||
}, | ||
"require": { | ||
"php": "^7.3 || ^8.0", | ||
"ext-bcmath": "*", | ||
"ext-mbstring": "*", | ||
"ext-simplexml": "*", | ||
"byrokrat/id": "^2.1", | ||
"byrokrat/banking": "^2.2", | ||
"symfony/console": "^5" | ||
}, | ||
"require-dev": { | ||
"roave/security-advisories": "dev-latest" | ||
} | ||
} |
Oops, something went wrong.