Skip to content

Commit

Permalink
Adding Churn PHP as a tool in the repo (#200)
Browse files Browse the repository at this point in the history
## Description

Closes #68 

## Checklist
- [ ] Updated CHANGELOG files
  • Loading branch information
JoshuaEstes authored Dec 22, 2023
1 parent 9155d9c commit 606bb94
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ composer.phar
packages.json
results.sarif
infection.log
.churn.cache
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ PHP = php
PHP_CS_FIXER = tools/php-cs-fixer/vendor/bin/php-cs-fixer
PHPUNIT = tools/phpunit/vendor/bin/phpunit
PSALM = tools/psalm/vendor/bin/psalm
CHURN = tools/churn/vendor/bin/churn
PSALM_BASELINE_FILE = psalm-baseline.xml
BARD = src/SonsOfPHP/Bard/bin/bard

Expand Down Expand Up @@ -200,9 +201,18 @@ infection:
-dapc.enable_cli=1 \
tools/infection/vendor/bin/infection --debug -vvv --show-mutations

tools-install: psalm-install php-cs-fixer-install phpunit-install
churn: ## Run Churn PHP
$(CHURN)

tools-upgrade: psalm-upgrade php-cs-fixer-upgrade phpunit-upgrade
churn-install:
$(COMPOSER) install --working-dir=tools/churn --no-interaction --prefer-dist --optimize-autoloader

churn-upgrade:
$(COMPOSER) upgrade --working-dir=tools/churn --no-interaction --prefer-dist --optimize-autoloader --with-all-dependencies

tools-install: psalm-install php-cs-fixer-install phpunit-install churn-install

tools-upgrade: psalm-upgrade php-cs-fixer-upgrade phpunit-upgrade churn-upgrade

## Documentation
docs-install: ## Install deps for building docs
Expand Down
59 changes: 59 additions & 0 deletions churn.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# The maximum number of files to display in the results table.
# Default: 10
filesToShow: 10

# The minimum score a file need to display in the results table.
# Disabled if null.
# Default: 0.1
minScoreToShow: 0

# The command returns an 1 exit code if the highest score is greater than the threshold.
# Disabled if null.
# Default: null
maxScoreThreshold: 0.9

# The number of parallel jobs to use when processing files.
# Default: 10
parallelJobs: 10

# How far back in the VCS history to count the number of commits to a file
# Can be a human readable date like 'One week ago' or a date like '2017-07-12'
# Default: '10 Years ago'
commitsSince: One year ago

# Files to ignore when processing. The full path to the file relative to the root of your project is required.
# Also supports regular expressions.
# Default: All PHP files in the path provided to churn-php are processed.
#filesToIgnore:
# - src/Commands/ChurnCommand.php
# - src/Results/ResultsParser.php
# - src/Foo/Ba*

# File extensions to use when processing.
# Default: php
fileExtensions:
- php

# This list is used only if there is no argument when running churn.
# Default: <empty>
directoriesToScan:
- src/

# List of user-defined hooks.
# They can be referenced by their full qualified class name if churn has access to the autoloader.
# Otherwise the file path can be used as well.
# See below the section about hooks for more details.
# Default: <empty>
#hooks:
# - Namespace\MyHook
# - path/to/my-hook.php

# The version control system used for your project.
# Accepted values: fossil, git, mercurial, subversion, none
# Default: git
vcs: git

# The path of the cache file. It doesn't need to exist before running churn.
# Disabled if null.
# Default: null
cachePath: .churn.cache
5 changes: 5 additions & 0 deletions tools/churn/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require": {
"bmitch/churn-php": "^1.7"
}
}

0 comments on commit 606bb94

Please sign in to comment.