-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for phpcs #111
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c8b859c
Add phpcs support
nhoag 7029586
Make phpcs runners executable
nhoag dab1d27
Add --no-interaction to composer info
nhoag acc7fb6
Use correct path to phpcs
nhoag d92acbe
Simplify installation logic
nhoag b43cb2e
Fixup: Formatting update
nhoag 6e0f8e9
Remove phpcs version variable
nhoag be7daa2
Add drupal/coder standards to phpcs config
nhoag 49c9255
Add default phpcs arguments
nhoag File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 @@ | ||
#!/usr/bin/env bash | ||
# @file | ||
# Common functionality for installing phpcs and friends. | ||
|
||
# | ||
# Ensures that phpcs is installed. | ||
# | ||
function drupal_ti_ensure_phpcs() { | ||
# This function is re-entrant. | ||
if [ -r "$TRAVIS_BUILD_DIR/../drupal_ti-phpcs-installed" ] | ||
then | ||
return | ||
fi | ||
|
||
# Check if drupal/coder is already available. | ||
DRUPAL_CODER=$(composer info --no-interaction drupal/coder || echo "") | ||
|
||
if [ -z "$DRUPAL_CODER" ] | ||
then | ||
# Install drupal/coder globally. | ||
echo "Installing drupal/coder: $DRUPAL_TI_DRUPAL_CODER_VERSION" | ||
composer global require --no-interaction "$DRUPAL_TI_DRUPAL_CODER_VERSION" | ||
else | ||
echo "phpcs $DRUPAL_TI_DRUPAL_CODER_VERSION is already installed." | ||
composer global install --no-interaction | ||
fi | ||
|
||
# Install Drupal and DrupalPractice coding standards. | ||
phpcs --config-set installed_paths $HOME/.composer/vendor/drupal/coder/coder_sniffer | ||
|
||
touch "$TRAVIS_BUILD_DIR/../drupal_ti-phpcs-installed" | ||
} |
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,7 @@ | ||
#!/usr/bin/env bash | ||
# Simple script to install dependencies for travis-ci running. | ||
|
||
set -e $DRUPAL_TI_DEBUG | ||
|
||
# Ensure that phpcs is installed. | ||
drupal_ti_ensure_phpcs |
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,19 @@ | ||
#!/usr/bin/env bash | ||
# @file | ||
# phpcs integration - Script step. | ||
|
||
set -e $DRUPAL_TI_DEBUG | ||
|
||
if [[ -n $DRUPAL_TI_PHPCS_ARGS ]]; then | ||
ARGS=( $DRUPAL_TI_PHPCS_ARGS ) | ||
else | ||
ARGS=( | ||
"--colors" | ||
"--standard=Drupal,DrupalPractice" | ||
"--extensions=php,module,inc,install,test,profile,theme,css,info,txt,md" | ||
"--ignore=node_modules,bower_components,vendor" | ||
"${TRAVIS_BUILD_DIR}" | ||
) | ||
fi | ||
|
||
$HOME/.composer/vendor/bin/phpcs "${ARGS[@]}" |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure you should lint css files :D