Skip to content

Commit fc23990

Browse files
committed
Use overcommit to check code before commit
1 parent f805e6b commit fc23990

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

.overcommit.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Use this file to configure the Overcommit hooks you wish to use. This will
2+
# extend the default configuration defined in:
3+
# https://github.com/brigade/overcommit/blob/master/config/default.yml
4+
#
5+
# At the topmost level of this YAML file is a key representing type of hook
6+
# being run (e.g. pre-commit, commit-msg, etc.). Within each type you can
7+
# customize each hook, such as whether to only run it on certain files (via
8+
# `include`), whether to only display output if it fails (via `quiet`), etc.
9+
#
10+
# For a complete list of hooks, see:
11+
# https://github.com/brigade/overcommit/tree/master/lib/overcommit/hook
12+
#
13+
# For a complete list of options that you can use to customize hooks, see:
14+
# https://github.com/brigade/overcommit#configuration
15+
#
16+
# Uncomment the following lines to make the configuration take effect.
17+
18+
PreCommit:
19+
TrailingWhitespace:
20+
enabled: true
21+
on_warn: fail
22+
PhpCs:
23+
enabled: true
24+
problem_on_unmodified_line: warn
25+
command: 'vendor/bin/phpcs'
26+
flags: ['--standard=ruleset.xml', '--report=csv', '-s']
27+
PhpLint:
28+
enabled: true
29+
on_warn: fail
30+
exclude:
31+
- '**/*.blade.php'
32+

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"pear/file_marc": "^1.1"
1717
},
1818
"require-dev": {
19-
"phpunit/phpunit": "^5.7 | ^6.0"
19+
"phpunit/phpunit": "^5.7 | ^6.0",
20+
"squizlabs/php_codesniffer": "^3.3"
2021
},
2122
"autoload": {
2223
"psr-4": {

ruleset.xml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="PSR2Tweaked">
3+
<description>PSR2 without namespace requirement.</description>
4+
<rule ref="PSR2"></rule>
5+
<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace">
6+
<exclude-pattern>*/tests/*</exclude-pattern>
7+
</rule>
8+
<rule ref="Generic.Files.LineLength">
9+
<exclude-pattern>*/tests/*</exclude-pattern>
10+
</rule>
11+
</ruleset>

0 commit comments

Comments
 (0)