-
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.
Merge pull request #1 from newsuk/chore/CPNT-2252-phpmd-config
chore(CPNT-2252) PHPMD config
- Loading branch information
Showing
8 changed files
with
1,162 additions
and
2 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,32 @@ | ||
version: 2.1 | ||
jobs: | ||
phpmd: | ||
docker: | ||
- image: cimg/php:8.2-node | ||
steps: | ||
- checkout | ||
- run: | ||
name: Install production dependencies | ||
command: composer install --no-dev -o | ||
- run: | ||
name: Composer validate | ||
command: composer validate --strict | ||
- run: | ||
name: PHPMD install check | ||
command: | | ||
vendor/bin/phpmd --version | ||
if vendor/bin/phpmd --version | grep -q "PHPMD"; then | ||
echo "PHPMD installed successfully." | ||
else | ||
echo "Error: PHPMD is not installed." | ||
exit 1 | ||
fi | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- vendor | ||
workflows: | ||
version: 2 | ||
build: | ||
jobs: | ||
- phpmd |
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,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "composer" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
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 @@ | ||
/vendor/ |
Validating CODEOWNERS rules …
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 @@ | ||
* @newsuk/tnl-wp-newspress |
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,34 @@ | ||
# nuk-wp-phpmd-config | ||
Provides PHPMD standard config for NUK WordPress plugins and themes. | ||
### NUK WP PHPMD config | ||
|
||
This library contains PHPMD configuration for NewsUK plugins and themes. | ||
|
||
## Installation | ||
|
||
Composer install: | ||
|
||
```bash | ||
composer require --dev newsuk/nuk-wp-phpmd-config | ||
``` | ||
|
||
## Using the ruleset | ||
Create a `phpmd.xml.dist` file in your project and add the following: | ||
|
||
```xml | ||
<?xml version="1.0"?> | ||
<ruleset> | ||
<rule ref="vendor/newsuk/nuk-wp-phpmd-config/ruleset.xml" /> | ||
</ruleset> | ||
``` | ||
|
||
## Composer scripts | ||
Add the following to `scripts` section in `composer.json` file and run `composer phpmd`, make sure to update the directory and file names accordingly. | ||
|
||
```json | ||
"phpmd": "phpmd plugin.php,includes text phpmd.xml.dist --color" | ||
``` | ||
|
||
Add the following to generate baseline file for existing plugins and run `composer phpmd-baseline`, make sure to update the directory and file names accordingly. | ||
|
||
```json | ||
"phpmd-baseline": "phpmd plugin.php,includes text phpmd.xml.dist --generate-baseline" | ||
``` |
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 @@ | ||
{ | ||
"name": "newsuk/nuk-wp-phpmd-config", | ||
"description": "PHPMD configuration for WordPress VIP plugins and themes", | ||
"type": "phpmd-standard", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Content Platforms", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"phpmd/phpmd": "^2.15" | ||
} | ||
} |
Oops, something went wrong.