Skip to content

Commit 62a1b3d

Browse files
Create phpmd.yml (#47)
1 parent 82a165d commit 62a1b3d

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

.github/workflows/phpmd.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
# PHPMD is a spin-off project of PHP Depend and
6+
# aims to be a PHP equivalent of the well known Java tool PMD.
7+
# What PHPMD does is: It takes a given PHP source code base
8+
# and look for several potential problems within that source.
9+
# These problems can be things like:
10+
# Possible bugs
11+
# Suboptimal code
12+
# Overcomplicated expressions
13+
# Unused parameters, methods, properties
14+
# More details at https://phpmd.org/
15+
16+
name: PHPMD
17+
18+
on:
19+
push:
20+
branches: [ "main" ]
21+
pull_request:
22+
# The branches below must be a subset of the branches above
23+
branches: [ "main" ]
24+
schedule:
25+
- cron: '42 8 * * 5'
26+
27+
permissions:
28+
contents: read
29+
30+
jobs:
31+
PHPMD:
32+
name: Run PHPMD scanning
33+
runs-on: ubuntu-latest
34+
permissions:
35+
contents: read # for checkout to fetch code
36+
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
37+
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
38+
39+
steps:
40+
- name: Checkout code
41+
uses: actions/checkout@v4
42+
43+
- name: Setup PHP
44+
uses: shivammathur/setup-php@aa1fe473f9c687b6fb896056d771232c0bc41161
45+
with:
46+
coverage: none
47+
tools: phpmd
48+
49+
- name: Run PHPMD
50+
run: phpmd . sarif codesize --reportfile phpmd-results.sarif
51+
continue-on-error: true
52+
53+
- name: Upload analysis results to GitHub
54+
uses: github/codeql-action/upload-sarif@v3
55+
with:
56+
sarif_file: phpmd-results.sarif
57+
wait-for-processing: true

0 commit comments

Comments
 (0)