Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
automatic_updates-3449631
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
automatic_updates-3449631
Commits
5849597f
Commit
5849597f
authored
2 years ago
by
Travis Carden
Committed by
Ted Bowman
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3305312
by TravisCarden: Add scripts to run PHPCS and PHPCBF
parent
210fea30
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
composer.json
+8
-0
8 additions, 0 deletions
composer.json
scripts/phpcbf.sh
+39
-0
39 additions, 0 deletions
scripts/phpcbf.sh
scripts/phpcs.sh
+39
-0
39 additions, 0 deletions
scripts/phpcs.sh
with
86 additions
and
0 deletions
composer.json
+
8
−
0
View file @
5849597f
...
@@ -24,5 +24,13 @@
...
@@ -24,5 +24,13 @@
"platform"
:
{
"platform"
:
{
"php"
:
"7.4.0"
"php"
:
"7.4.0"
}
}
},
"scripts"
:
{
"phpcbf"
:
"scripts/phpcbf.sh"
,
"phpcs"
:
"scripts/phpcs.sh"
},
"scripts-descriptions"
:
{
"phpcbf"
:
"Automatically fixes standards violations where possible."
,
"phpcs"
:
"Checks code for standards compliance."
}
}
}
}
This diff is collapsed.
Click to expand it.
scripts/phpcbf.sh
0 → 100755
+
39
−
0
View file @
5849597f
#!/usr/bin/env bash
# NAME
# phpcbf.sh - Automatically fixe standards violations where possible.
#
# SYNOPSIS
# bash phpcbf.sh
#
# DESCRIPTION
# Fix code compliance with Drupal core coding standards using PHP Code
# Beautifier and Fixer (PHPCBF).
#
# It is assumed that this module is inside a Drupal core installation, in
# modules or modules/contrib. See setup_local_dev.sh.
cd
"
$(
dirname
"
$0
"
)
"
||
exit
0
;
## Find PHPCBF in Drupal core. Check up to three directories up.
DIR
=
$(
pwd
)
for
i
in
{
0..3
}
;
do
DIR
=
$(
dirname
"
$DIR
"
)
PHPCBF_BIN
=
"
$DIR
/vendor/bin/phpcbf"
PHPCS_CONFIG
=
"
$DIR
/core/phpcs.xml.dist"
if
test
-f
"
$PHPCBF_BIN
"
;
then
break
fi
done
# Exit if PHPCBF can't be found.
if
test
!
-f
"
$PHPCBF_BIN
"
;
then
echo
"Could not find PHPCBF. Are you inside a Drupal site's 'modules' directory?"
exit
1
fi
# Run PHPCBF on the module directory.
php
"
$PHPCBF_BIN
"
\
--colors
\
--standard
=
"
$PHPCS_CONFIG
"
\
"
$(
cd
..
&&
pwd
)
"
This diff is collapsed.
Click to expand it.
scripts/phpcs.sh
0 → 100755
+
39
−
0
View file @
5849597f
#!/usr/bin/env bash
# NAME
# phpcs.sh - Check code for standards compliance.
#
# SYNOPSIS
# bash phpcs.sh
#
# DESCRIPTION
# Check for compliance with Drupal core coding standards using
# PHP_CodeSniffer (PHPCS).
#
# It is assumed that this module is inside a Drupal core installation, in
# modules or modules/contrib. See setup_local_dev.sh.
cd
"
$(
dirname
"
$0
"
)
"
||
exit
0
;
## Find PHPCS in Drupal core. Check up to three directories up.
DIR
=
$(
pwd
)
for
i
in
{
0..3
}
;
do
DIR
=
$(
dirname
"
$DIR
"
)
PHPCS_BIN
=
"
$DIR
/vendor/bin/phpcs"
PHPCS_CONFIG
=
"
$DIR
/core/phpcs.xml.dist"
if
test
-f
"
$PHPCS_BIN
"
;
then
break
fi
done
# Exit if PHPCS can't be found.
if
test
!
-f
"
$PHPCS_BIN
"
;
then
echo
"Could not find PHPCS. Are you inside a Drupal site's 'modules' directory?"
exit
1
fi
# Run PHPCS on the module directory.
php
"
$PHPCS_BIN
"
\
--colors
\
--standard
=
"
$PHPCS_CONFIG
"
\
"
$(
cd
..
&&
pwd
)
"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment