Skip to content
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

Merge original repo updates into our fork #1

Merged
merged 37 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2510ec7
Include VIP Coding Standards with 10up Default.
peterwilsoncc Dec 14, 2022
db06895
Merge pull request #25 from 10up/fix/24-add-vipcs-to-10up-default
peterwilsoncc Jan 2, 2023
29e54ad
Update CREDITS.md
jeffpaul Jan 9, 2023
90bc825
Create CODEOWNERS
jeffpaul Jan 9, 2023
04c51b8
Update Github Actions summary example in README.md
iamdharmesh Mar 24, 2023
c58983b
Merge pull request #27 from 10up/fix/18
iamdharmesh Mar 27, 2023
15399b6
add 1.5.0 items to CHANGELOG.md
jeffpaul May 25, 2023
1fe5b1b
Update CREDITS.md
jeffpaul May 25, 2023
c5d7394
Update README.md
jeffpaul May 25, 2023
044a739
Update CHANGELOG.md
jeffpaul May 25, 2023
3ad3c36
Merge pull request #29 from 10up/release/1.5.0
jeffpaul Jun 12, 2023
15db252
Merge branch 'develop' into stable
jeffpaul Jun 12, 2023
b48ac6c
Create CODE_OF_CONDUCT.md
jeffpaul Jun 12, 2023
8f01e3c
Update CREDITS.md
jeffpaul Jun 12, 2023
770dcc8
Update README.md
jeffpaul Jun 12, 2023
ab14a45
Update action.yml
jeffpaul Jun 12, 2023
9ba2fff
Update CHANGELOG.md
jeffpaul Jun 14, 2023
a591c50
Update CREDITS.md
jeffpaul Jun 14, 2023
9e47af3
Merge pull request #31 from 10up/update/150-updates
iamdharmesh Jun 15, 2023
cf1198c
Merge branch 'develop' into fix/10
jeffpaul Jun 16, 2023
60423d3
Merge pull request #30 from 10up/fix/10
jeffpaul Jun 16, 2023
2132696
Add example for excluding specific rules in teh README file
kmgalanakis Aug 18, 2023
9f4cdfb
Change from master branch to main branch
dkotter Aug 18, 2023
8805a0f
Switch to checking out the 2.3.0 tagged release in preparation for th…
dkotter Aug 18, 2023
d6f6bdc
Merge pull request #34 from 10up/fix/33
iamdharmesh Aug 23, 2023
c3223df
Merge pull request #32 from 10up/feature/add-example-for-excluding-sp…
jeffpaul Aug 28, 2023
06e6fd4
Update CHANGELOG
dkotter Aug 29, 2023
2fc765f
Update CREDITS.md
dkotter Aug 29, 2023
b659f6f
Update README
dkotter Aug 29, 2023
32cfb89
Merge branch 'release/1.6.0' into develop
dkotter Aug 30, 2023
9dd8fbd
Merge branch 'develop' into stable
dkotter Aug 30, 2023
ab079ea
Try installing the VIPCS package from a branch
dkotter Aug 30, 2023
87732af
Merge pull request #37 from 10up/fix/install-vipcs
dkotter Aug 30, 2023
2e01e36
Update CHANGELOG
dkotter Aug 30, 2023
5bd2b7c
Update CREDITS.md
dkotter Aug 30, 2023
b85335a
Merge branch 'release/1.6.1' into develop
dkotter Aug 30, 2023
47459d3
Merge branch 'develop' into stable
dkotter Aug 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# These owners will be the default owners for everything in the repo. Unless a later match takes precedence, @10up/open-source-practice, as primary maintainers will be requested for review when someone opens a Pull Request.
* @10up/open-source-practice

# GitHub specifics
/.github/ @jeffpaul
LICENSE @jeffpaul
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.6.1] - 2023-08-30
### Fixed
- Clone the 2.3.3 tagged release of the VIPCS package to ensure running VIP scans works (props [@dkotter](https://github.com/dkotter), [@TylerB24890](https://github.com/TylerB24890) via [#37](https://github.com/10up/wpcs-action/pull/37)).

## [1.6.0] - 2023-08-30
### Added
- New example for excluding specific rules in the README file (props [@kmgalanakis](https://github.com/kmgalanakis), [@iamdharmesh](https://github.com/iamdharmesh) via [#32](https://github.com/10up/wpcs-action/pull/32)).

### Changed
- Update docs (props [@jeffpaul](https://github.com/jeffpaul), [@faisal-alvi](https://github.com/faisal-alvi) via [#30](https://github.com/10up/wpcs-action/pull/30)).

### Fixed
- Clone the 2.3.0 tagged branch of the WordPress Coding Standards (props [@dkotter](https://github.com/dkotter), [@iamdharmesh](https://github.com/iamdharmesh), [@GaryJones](https://github.com/GaryJones) via [#34](https://github.com/10up/wpcs-action/pull/34)).

## [1.5.0] - 2023-06-12
### Added
- Include WP VIP coding standards with 10up-Default sniffs (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@cadic](https://github.com/cadic), [@dkotter](https://github.com/dkotter), [@jeffpaul](https://github.com/jeffpaul) via [#25](https://github.com/10up/wpcs-action/pull/25)).

### Changed
- GitHub Actions summary example in README.md (props [@iamdharmesh](https://github.com/iamdharmesh), [@peterwilsoncc](https://github.com/peterwilsoncc), [@B-Interactive](https://github.com/B-Interactive), [@dinhtungdu](https://github.com/dinhtungdu), [@jeffpaul](https://github.com/jeffpaul) via [#27](https://github.com/10up/wpcs-action/pull/27)).

## [1.4.0] - 2022-11-23
### Added
- Support of 10up-Default ruleset (props [@cadic](https://github.com/cadic), [@jeffpaul](https://github.com/jeffpaul), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#21](https://github.com/10up/wpcs-action/pull/21)).
Expand Down Expand Up @@ -46,6 +67,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `phpcs_bin_path` and `installed_paths` options.

[Unreleased]: https://github.com/10up/wpcs-action/compare/stable...develop
[1.6.1]: https://github.com/10up/wpcs-action/compare/v1.6.0...v1.6.1
[1.6.0]: https://github.com/10up/wpcs-action/compare/v1.5.0...v1.6.0
[1.5.0]: https://github.com/10up/wpcs-action/compare/v1.4.0...v1.5.0
[1.4.0]: https://github.com/10up/wpcs-action/compare/v1.3.4...v1.4.0
[1.3.4]: https://github.com/10up/wpcs-action/compare/v1.3.3...v1.3.4
[1.3.3]: https://github.com/10up/wpcs-action/compare/v1.3.2...v1.3.3
Expand Down
128 changes: 128 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[email protected].
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
6 changes: 4 additions & 2 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ The following acknowledges the Maintainers for this repository, those who have C

The following individuals are responsible for curating the list of issues, responding to pull requests, and ensuring regular releases happen.

[Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul).
[Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul).

## Contributors

Note that this project was forked from [Ilya Chekalsky's](https://github.com/chekalsky) [PHP CodeSniffer GitHub Action](https://github.com/chekalsky/phpcs-action).

Thank you to all the people who have already contributed to this repository via bug reports, code, design, ideas, project management, translation, testing, etc.

[Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Daniele Scasciafratte (@Mte90)](https://github.com/Mte90), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Vikram (@vikrampm1)](https://github.com/vikrampm1), [Max Lyuchin (@cadic)](https://github.com/cadic), [Peter Wilson (@peterwilsoncc)](https://github.com/peterwilsoncc), [Siddharth Thevaril (@Sidsector9)](https://github.com/Sidsector9), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh)
[Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Daniele Scasciafratte (@Mte90)](https://github.com/Mte90), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Vikram Moparthy (@vikrampm1)](https://github.com/vikrampm1), [Max Lyuchin (@cadic)](https://github.com/cadic), [Peter Wilson (@peterwilsoncc)](https://github.com/peterwilsoncc), [Siddharth Thevaril (@Sidsector9)](https://github.com/Sidsector9), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [Darin Kotter (@dkotter)](https://github.com/dkotter), [David Armstrong (@B-Interactive)](https://github.com/B-Interactive), [Konstantinos Galanakis (@kmgalanakis)](https://github.com/kmgalanakis), [Faisal Alvi (@faisal-alvi)](https://github.com/faisal-alvi), [Gary Jones (@GaryJones)](https://github.com/GaryJones), [Tyler Bailey (@TylerB24890)](https://github.com/TylerB24890).

## Libraries

Expand Down
55 changes: 49 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# WPCS GitHub Action

> GitHub Action to help you lint your PHP without additional dependencies within your codebase
> GitHub Action to help you lint your PHP without additional dependencies within your codebase.

[![Support Level](https://img.shields.io/badge/support-active-green.svg)](#support-level) [![Release Version](https://img.shields.io/github/release/10up/wpcs-action.svg)](https://github.com/10up/wpcs-action/releases/latest) [![MIT License](https://img.shields.io/github/license/10up/wpcs-action.svg)](https://github.com/10up/wpcs-action/blob/develop/LICENSE)

## Overview

This action will help you to run phpcs (PHP_CodeSniffer) against [WordPress Coding Standards](https://github.com/WordPress/WordPress-Coding-Standards) with [GitHub Actions](https://github.com/features/actions) platform.

To make it as simple as possible, this action supports WordPress Coding Standards exclusively and only checks for PHP files. This action doesn't require any change or addition to your source code. It means that you don't need to add composer/phpcs to your plugin or create PHP CodeSniffer config to use this action.

This is a fork of [chekalsky/phpcs-action](https://github.com/chekalsky/phpcs-action), so this action supports GitHub Action annotations too. All credit goes to
This is a fork of [chekalsky/phpcs-action](https://github.com/chekalsky/phpcs-action), so this action supports GitHub Action annotations too. All credit goes to
[Ilya Chekalsky](https://github.com/chekalsky).

From v1.3.1, this action can detect the PHPCS custom config and use that config to check the source code. When using the local config, `paths`, `excludes`, and `standard` are ignored.
Expand All @@ -35,7 +37,7 @@ jobs:
name: WPCS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: WPCS check
uses: 10up/wpcs-action@stable
```
Expand Down Expand Up @@ -72,12 +74,13 @@ jobs:
name: VIPCS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: VIPCS check
uses: 10up/wpcs-action@stable
with:
standard: 'WordPress-VIP-Go'
```

### Display the linting result in the GitHub Actions summary

```yaml
Expand All @@ -90,23 +93,63 @@ jobs:
name: VIPCS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: VIPCS check
uses: 10up/wpcs-action@stable
with:
standard: 'WordPress-VIP-Go'
extra_args: '--report-json=./phpcs.json'
- name: Update summary
run: |
npx --yes github:10up/phpcs-json-to-md --path ./phpcs.json --output ./phpcs.md
npm i -g github:10up/phpcs-json-to-md
phpcs-json-to-md --path ./phpcs.json --output ./phpcs.md
cat phpcs.md >> $GITHUB_STEP_SUMMARY
if: always()
```

### Exclude specific rule(s) from the used ruleset

Create a custom project ruleset by creating file named `phpcs.xml.dist` in the root directory of the project. The contents of the file should be similar to the following:

```xml
<?xml version="1.0"?>
<ruleset name="Project Rules">
<rule ref="WordPress">
<!-- Any of `WordPress|WordPress-Core|WordPress-Docs|WordPress-Extra|WordPress-VIP-Go|WordPressVIPMinimum|10up-Default` -->
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
</rule>
</ruleset>
```

When setting up the workflow for the project, to use the custom project ruleset, the `use_local_config` arguments will need to be set to `true` to instruct the action to use the local project file. The job configuration should be similar to the following:

```yaml
jobs:
phpcs:
name: WPCS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: WPCS check
uses: 10up/wpcs-action@stable
with:
standard: 'WordPress' # Standard to use. Accepts WordPress|WordPress-Core|WordPress-Docs|WordPress-Extra|WordPress-VIP-Go|WordPressVIPMinimum|10up-Default.
use_local_config: 'true'
```

## Support Level

**Active:** 10up is actively working on this, and we expect to continue work for the foreseeable future including keeping tested up to the most recent version of WordPress. Bug reports, feature requests, questions, and pull requests are welcome.

## Changelog

A complete listing of all notable changes to this project are documented in [CHANGELOG.md](https://github.com/10up/wpcs-action/blob/develop/CHANGELOG.md).

## Contributing

Please read [CODE_OF_CONDUCT.md](https://github.com/10up/wpcs-action/blob/develop/CODE_OF_CONDUCT.md) for details on our code of conduct, [CONTRIBUTING.md](https://github.com/10up/wpcs-action/blob/develop/CONTRIBUTING.md) for details on the process for submitting pull requests to us, and [CREDITS.md](https://github.com/10up/wpcs-action/blob/develop/CREDITS.md) for a listing of maintainers, contributors, and libraries for this project.

## Like what you see?

<p align="center">
Expand Down
6 changes: 3 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 'PHP_CodeSniffer Check with Annotations'
description: 'PHPCS checker with auto annotations out of the box'
author: 'Ilya Chekalsky'
name: 'PHPCS Check with Annotations'
description: 'PHPCS checker with automatic annotations and no additional dependencies.'
author: '10up'
inputs:
enable_warnings:
description: 'Enable checking for warnings (-w)'
Expand Down
10 changes: 6 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

cp /action/problem-matcher.json /github/workflow/problem-matcher.json

git clone -b master https://github.com/WordPress/WordPress-Coding-Standards.git ~/wpcs
git clone --depth 1 -b 2.3.0 https://github.com/WordPress/WordPress-Coding-Standards.git ~/wpcs

if [ "${INPUT_STANDARD}" = "WordPress-VIP-Go" ] || [ "${INPUT_STANDARD}" = "WordPressVIPMinimum" ]; then
echo "Setting up VIPCS"
git clone https://github.com/Automattic/VIP-Coding-Standards ${HOME}/vipcs
git clone --depth 1 -b 2.3.3 https://github.com/Automattic/VIP-Coding-Standards.git ${HOME}/vipcs
git clone https://github.com/sirbrillig/phpcs-variable-analysis ${HOME}/variable-analysis
${INPUT_PHPCS_BIN_PATH} --config-set installed_paths "${HOME}/wpcs,${HOME}/vipcs,${HOME}/variable-analysis"
elif [ "${INPUT_STANDARD}" = "10up-Default" ]; then
Expand All @@ -16,7 +16,9 @@ elif [ "${INPUT_STANDARD}" = "10up-Default" ]; then
git clone https://github.com/PHPCompatibility/PHPCompatibility ${HOME}/phpcompat
git clone https://github.com/PHPCompatibility/PHPCompatibilityParagonie ${HOME}/phpcompat-paragonie
git clone https://github.com/PHPCSStandards/PHPCSUtils ${HOME}/phpcsutils
${INPUT_PHPCS_BIN_PATH} --config-set installed_paths "${HOME}/wpcs,${HOME}/10up/10up-Default,${HOME}/phpcompatwp/PHPCompatibilityWP,${HOME}/phpcompat/PHPCompatibility,${HOME}/phpcompat-paragonie/PHPCompatibilityParagonieSodiumCompat,${HOME}/phpcompat-paragonie/PHPCompatibilityParagonieRandomCompat,${HOME}/phpcsutils/PHPCSUtils"
git clone https://github.com/Automattic/VIP-Coding-Standards ${HOME}/vipcs
git clone https://github.com/sirbrillig/phpcs-variable-analysis ${HOME}/variable-analysis
${INPUT_PHPCS_BIN_PATH} --config-set installed_paths "${HOME}/wpcs,${HOME}/10up/10up-Default,${HOME}/phpcompatwp/PHPCompatibilityWP,${HOME}/phpcompat/PHPCompatibility,${HOME}/phpcompat-paragonie/PHPCompatibilityParagonieSodiumCompat,${HOME}/phpcompat-paragonie/PHPCompatibilityParagonieRandomCompat,${HOME}/phpcsutils/PHPCSUtils,${HOME}/vipcs,${HOME}/variable-analysis"
elif [ -z "${INPUT_STANDARD_REPO}" ] || [ "${INPUT_STANDARD_REPO}" = "false" ]; then
${INPUT_PHPCS_BIN_PATH} --config-set installed_paths ~/wpcs
else
Expand Down Expand Up @@ -46,7 +48,7 @@ fi
# .phpcs.xml, phpcs.xml, .phpcs.xml.dist, phpcs.xml.dist
if [ -f ".phpcs.xml" ] || [ -f "phpcs.xml" ] || [ -f ".phpcs.xml.dist" ] || [ -f "phpcs.xml.dist" ]; then
HAS_CONFIG=true
else
else
HAS_CONFIG=false
fi

Expand Down