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

Phpcs Baseline testing #24

Closed
wants to merge 231 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
231 commits
Select commit Hold shift + click to select a range
cf245fa
Fix PHPCS issue
kamleshluhana Apr 1, 2023
378f37b
Added Coding Standard action.yml file
kamleshluhana Apr 1, 2023
851cfe8
Verify PHPCs baseline action
kamleshluhana Apr 1, 2023
b63edc4
Verify PHPCs baseline action
kamleshluhana Apr 1, 2023
54c3279
Verify PHPCs baseline action
kamleshluhana Apr 1, 2023
84e0efb
Verify PHPCs baseline action
kamleshluhana Apr 1, 2023
c43ca7f
Verify PHPCs baseline action
kamleshluhana Apr 1, 2023
761f63c
Verify PHPCs baseline action
kamleshluhana Apr 1, 2023
7c7bbc3
Verify PHPCs baseline action
kamleshluhana Apr 1, 2023
dceb3d9
Verify PHPCs baseline action
kamleshluhana Apr 1, 2023
d0281bf
Verify PHPCs baseline action
kamleshluhana Apr 1, 2023
0074502
Verify PHPCs baseline action
kamleshluhana Apr 1, 2023
ab45995
Verify PHPCs baseline action
kamleshluhana Apr 1, 2023
410228e
Verify PHPCs baseline action
kamleshluhana Apr 1, 2023
cbbbd89
Verify PHPCs baseline action
kamleshluhana Apr 1, 2023
d48fceb
Verify PHPCs baseline action
kamleshluhana Apr 1, 2023
f06c872
Verify PHPCs baseline action
kamleshluhana Apr 1, 2023
65bd618
Verify PHPCs baseline action
kamleshluhana Apr 1, 2023
83f7927
Verify PHPCs baseline action
kamleshluhana Apr 1, 2023
eb4dad8
Verify PHPCs baseline action
kamleshluhana Apr 1, 2023
71aa4a2
Verify PHPCs baseline action
kamleshluhana Apr 1, 2023
245c1b9
Verify PHPCs baseline action
kamleshluhana Apr 1, 2023
3e7afaa
Verify PHPCs baseline action
kamleshluhana Apr 1, 2023
1d0382f
Verify PHPCs baseline action
kamleshluhana Apr 1, 2023
3101aec
Verify PHPCs baseline action
kamleshluhana Apr 1, 2023
90ea0b0
Modification based on Simon comments
kamleshluhana Apr 15, 2023
06e7d58
Modification based on Simon comments
kamleshluhana Apr 15, 2023
e1b4fdd
Modification based on Simon comments
kamleshluhana Apr 15, 2023
5647eb1
Modification based on Simon comments
kamleshluhana Apr 15, 2023
d466398
Modification based on Simon comments
kamleshluhana Apr 15, 2023
6d03496
Merge remote-tracking branch 'origin/2.4-develop' into phpcs_baseline
kamleshluhana Apr 18, 2023
b223b5c
Testing of PHPCS
kamleshluhana Apr 18, 2023
3e986e4
Fix workflow file issue
kamleshluhana Apr 18, 2023
b2326a9
Fix workflow file issue
kamleshluhana Apr 18, 2023
de2c0cf
Fix workflow file issue
kamleshluhana Apr 18, 2023
ba75deb
Fix workflow file issue
kamleshluhana Apr 18, 2023
652ed72
Fix workflow file issue
kamleshluhana Apr 18, 2023
e1eb94c
Fix workflow file issue
kamleshluhana Apr 18, 2023
d1185be
Fix workflow file issue
kamleshluhana Apr 18, 2023
5bbf172
Fix workflow file issue
kamleshluhana Apr 18, 2023
122578f
Fix workflow file issue
kamleshluhana Apr 18, 2023
252e3e4
Merge remote-tracking branch 'origin/2.4-develop' into phpcs_baseline
kamleshluhana Apr 22, 2023
bf87076
Testing PHPCS Baseline
kamleshluhana Apr 22, 2023
29ca752
Testing PHPCS Baseline
kamleshluhana Apr 22, 2023
629ccdb
Testing PHPCS Baseline
kamleshluhana Apr 22, 2023
4f3bada
Testing PHPCS Baseline
kamleshluhana Apr 22, 2023
5727ae9
Testing PHPCS Baseline
kamleshluhana Apr 22, 2023
88aea1e
Testing PHPCS Baseline
kamleshluhana Apr 22, 2023
b23eed2
Testing PHPCS Baseline
kamleshluhana Apr 22, 2023
2361dd9
Testing PHPCS Baseline
kamleshluhana Apr 22, 2023
c168718
Testing PHPCS Baseline
kamleshluhana Apr 22, 2023
e815525
Testing PHPCS Baseline
kamleshluhana Apr 22, 2023
5379c0a
Testing PHPCS Baseline
kamleshluhana Apr 22, 2023
ccdae62
Testing PHPCS Baseline
kamleshluhana Apr 22, 2023
2d8cbfb
Testing PHPCS Baseline
kamleshluhana Apr 22, 2023
7775d06
Merge branch 'mage-os:2.4-develop' into phpcs_baseline
MeetKamal Apr 24, 2023
f90d914
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
462a67d
Merge branch 'phpcs_baseline' of github.com:MeetKamal/mageos-magento2…
kamleshluhana Apr 24, 2023
8915d55
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
7e96a06
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
b5b4637
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
202b303
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
89b7334
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
1085ff3
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
b9a4b7a
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
b19f4f9
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
f6ae066
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
9a40ead
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
bcceae6
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
89fa6b6
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
9c8f8f7
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
94f38ba
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
ca36e8d
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
25d382d
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
098ba23
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
ec48fe5
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
5fc5d9a
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
6d74bf9
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
771293f
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
fe10004
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
aec686c
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
3d177c1
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
036fedb
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
2f7a56e
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
fbc45da
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
a95414a
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
16ee3a8
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
e4de9ce
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
0b44940
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
be2594e
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
6643af5
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
00303c7
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
b28eecc
Testing PHPCS Baseline
kamleshluhana Apr 24, 2023
84416fa
Add changes as requested by Simon
kamleshluhana May 6, 2023
28cfc3c
Add changes as requested by Simon
kamleshluhana May 6, 2023
dceea69
Add changes as requested by Simon
kamleshluhana May 6, 2023
4fda29d
Merge branch 'mage-os:2.4-develop' into phpcs_baseline
MeetKamal May 6, 2023
fa2e254
Apply changes as per Simon comments
kamleshluhana May 6, 2023
d617634
Apply changes as per Simon comments
kamleshluhana May 6, 2023
7d2c9bd
Apply changes as per Simon comments
kamleshluhana May 6, 2023
fcef028
Apply changes as per Simon comments
kamleshluhana May 6, 2023
07fe7cf
Apply changes as per Simon comments
kamleshluhana May 6, 2023
687bb87
Apply changes as per Simon comments
kamleshluhana May 6, 2023
fdf9c21
Apply changes as per Simon comments
kamleshluhana May 6, 2023
089841a
Apply changes as per Simon comments
kamleshluhana May 6, 2023
de14b7e
Apply changes as per Simon comments
kamleshluhana May 6, 2023
bd8df14
Apply changes as per Simon comments
kamleshluhana May 6, 2023
ee787da
Apply changes as per Simon comments
kamleshluhana May 6, 2023
0a9e7e0
Apply changes as per Simon comments
kamleshluhana May 6, 2023
f5754e6
Apply changes as per Simon comments
kamleshluhana May 6, 2023
b1dc710
Apply changes as per Simon comments
kamleshluhana May 6, 2023
196d27c
Apply changes as per Simon comments
kamleshluhana May 6, 2023
19ae6a2
Apply changes as per Simon comments
kamleshluhana May 6, 2023
6ca020b
Apply changes as per Simon comments
kamleshluhana May 6, 2023
5a79ea2
Apply changes as per Simon comments
kamleshluhana May 6, 2023
9a1869d
Apply changes as per Simon comments
kamleshluhana May 6, 2023
23ad922
Apply changes as per Simon comments
kamleshluhana May 6, 2023
2c28d81
Apply changes as per Simon comments
kamleshluhana May 6, 2023
547db2e
Apply changes as per Simon comments
kamleshluhana May 6, 2023
bad8cf7
Apply changes as per Simon comments
kamleshluhana May 6, 2023
16d7f0d
Apply changes as per Simon comments
kamleshluhana May 6, 2023
66ca8fe
Apply changes as per Simon comments
kamleshluhana May 6, 2023
2e663f4
Apply changes as per Simon comments
kamleshluhana May 6, 2023
659310a
Apply changes as per Simon comments
kamleshluhana May 6, 2023
3cc58b9
Apply changes as per Simon comments
kamleshluhana May 6, 2023
d7eaefb
Apply changes as per Simon comments
kamleshluhana May 6, 2023
da31665
Apply changes as per Simon comments
kamleshluhana May 6, 2023
0d3b0fd
Apply changes as per Simon comments
kamleshluhana May 6, 2023
56f953e
Apply changes as per Simon comments
kamleshluhana May 6, 2023
1b3e40f
Apply changes as per Simon comments
kamleshluhana May 6, 2023
057ed9d
Reverback code base
kamleshluhana May 8, 2023
65d8aec
Testing of baseline file
kamleshluhana May 18, 2023
23e0176
Testing of baseline file
kamleshluhana May 18, 2023
82c5e3a
Testing of baseline file
kamleshluhana May 18, 2023
4f57aab
Testing of baseline file
kamleshluhana May 18, 2023
6fb151e
Testing of baseline file
kamleshluhana May 18, 2023
372f2dc
Testing of baseline file
kamleshluhana May 18, 2023
5fc1ba8
Testing of baseline file
kamleshluhana May 18, 2023
b62fa5d
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
c03b43b
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
330a4dd
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
a704d0a
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
73e7480
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
34a7f8e
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
27a34c0
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
1986510
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
a541cb5
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
ab34134
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
9e61866
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
803a6b0
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
da47eed
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
913c048
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
7076c43
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
f39bcb5
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
ff00519
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
595d9a9
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
d2e9841
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
1aea775
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
25d3c8e
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
923c0da
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
71798a7
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
8f121dc
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
d2c7600
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
7e55297
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
1863816
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
689b49b
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
b473b56
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
721a886
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
cb94e2c
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
defc916
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
5ebcac4
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
1694e85
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
bb45dad
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
fcef7b8
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
4d7e154
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
bf422d2
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
b5129c7
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
3ee8aae
Fix PHPCS Baseline issues
kamleshluhana May 23, 2023
e7088c6
Fix PHPCS Baseline issues
kamleshluhana May 29, 2023
c55851d
Fix PHPCS Baseline issues
kamleshluhana May 29, 2023
88459f5
Fix PHPCS Baseline issues
kamleshluhana May 29, 2023
be45e8b
Fix PHPCS Baseline issues
kamleshluhana May 30, 2023
82d6c60
Fix PHPCS Baseline issues
kamleshluhana May 30, 2023
edee662
Fix PHPCS Baseline issues
kamleshluhana May 30, 2023
800224b
Fix PHPCS Baseline issues
kamleshluhana May 30, 2023
52a69fc
Fix PHPCS Baseline issues
kamleshluhana May 30, 2023
925110e
Fix PHPCS Baseline issues
kamleshluhana May 30, 2023
af55fda
Fix PHPCS Baseline issues
kamleshluhana May 30, 2023
54fbefe
Fix coding standards
kamleshluhana Jun 19, 2023
de6613c
Fix PHPCS issue - inputs var
kamleshluhana Jun 19, 2023
793be69
Fix PHPCS issue - inputs var
kamleshluhana Jun 19, 2023
f74ed62
Fix PHPCS issue - inputs var
kamleshluhana Jun 19, 2023
9a93d20
Fix PHPCS issue - inputs var
kamleshluhana Jun 19, 2023
18df81d
Fix PHPCS issue - inputs var
kamleshluhana Jun 19, 2023
2b37f36
Fix PHPCS issue - inputs var
kamleshluhana Jun 19, 2023
638c65c
Review PHPCS issue
kamleshluhana Jun 19, 2023
4613b00
Review PHPCS issue
kamleshluhana Jun 19, 2023
0d55095
Review PHPCS issue
kamleshluhana Jun 19, 2023
4a40882
Fix input vars with new folder
kamleshluhana Jun 19, 2023
3164e00
Fix input vars with new folder
kamleshluhana Jun 19, 2023
59df2a8
Fix input vars with new folder
kamleshluhana Jun 19, 2023
45c046d
Fix input vars with new folder
kamleshluhana Jun 19, 2023
95f9037
Fix input vars with new folder
kamleshluhana Jun 19, 2023
c976415
Fix input vars with new folder
kamleshluhana Jun 19, 2023
17ca6b0
Fix input vars with new folder
kamleshluhana Jun 19, 2023
2d2ff1d
Fix input vars with new folder
kamleshluhana Jun 19, 2023
4dd635e
Fix input vars with new folder
kamleshluhana Jun 19, 2023
42667b4
Fix input vars with new folder
kamleshluhana Jun 19, 2023
f1265b3
Fix input vars with new folder
kamleshluhana Jun 19, 2023
39bf679
Fix input vars with new folder
kamleshluhana Jun 19, 2023
4b8273b
Review PHPCS issue - inputs var
kamleshluhana Jun 19, 2023
e2852c3
Merge branch 'mage-os:2.4-develop' into phpcs_baseline
MeetKamal Jul 4, 2023
765bec5
Modify codebase for coding standard baseline
kamleshluhana Jul 4, 2023
7348961
Modify codebase for coding standard baseline
kamleshluhana Jul 4, 2023
46c58ff
Modify codebase for coding standard baseline
kamleshluhana Jul 4, 2023
31e4688
Modify codebase for coding standard baseline
kamleshluhana Jul 4, 2023
9c8126c
Modify codebase for coding standard baseline
kamleshluhana Jul 4, 2023
2831ee8
Modify codebase for coding standard baseline
kamleshluhana Jul 4, 2023
2ddab8b
Modify codebase for coding standard baseline
kamleshluhana Jul 4, 2023
634d55f
Modify codebase for coding standard baseline
kamleshluhana Jul 4, 2023
63d4033
Modify codebase for coding standard baseline
kamleshluhana Jul 4, 2023
900a6e6
Modify codebase for coding standard baseline
kamleshluhana Jul 4, 2023
32fbd31
Merge branch 'mage-os:2.4-develop' into phpcs_baseline
MeetKamal Jul 6, 2023
92be37b
Fix basline changes as per Simon
kamleshluhana Jul 6, 2023
25909a8
Fix basline changes as per Simon
kamleshluhana Jul 6, 2023
3349874
added validation for xml files and html
kamleshluhana Jul 10, 2023
ab59c8b
added validation for xml files and html
kamleshluhana Jul 10, 2023
95fdfb5
added validation for xml files and html
kamleshluhana Jul 10, 2023
f93d01a
Merge branch 'mage-os:2.4-develop' into phpcs_baseline
MeetKamal Jul 31, 2023
acd2a17
Apply new github action for coding standard validation
kamleshluhana Jul 31, 2023
d358b6d
Validate coding standard based on new github action file
kamleshluhana Jul 31, 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
30 changes: 30 additions & 0 deletions .github/coding-standard-baseline/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Magento 2 Coding Standard Action

A Github Action that runs the Magento Coding Standard.

## Inputs

See the [action.yml](./action.yml)

## Usage

```yml
name: Coding Standard

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
coding-standard:
runs-on: ubuntu-latest
steps:
- uses: graycoreio/github-actions-magento2/coding-standard@main
with:
version: 25 # Optional, will use the latest if omitted.
path: app/code # Optional, will be used when event is not a pull request.
```
124 changes: 124 additions & 0 deletions .github/coding-standard-baseline/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: "M2 Coding Standard"
author: "Mage-OS"
description: "A Github Action that runs the Magento Coding Standard."

inputs:
php_version:
type: string
required: true
default: "8.1"
description: "PHP version used to do the coding standard check."

composer_version:
type: string
required: true
default: "2"
description: "The version of composer to use."

path:
type: string
required: true
default: 'app/code'
description: "The directory (relative to the project root) in which the coding standard will be checked. Used when the event is not a pull request."

version:
type: string
required: false
default: "31"
description: "The version of the coding standard to use. If not provided, will use the latest version."

severity:
type: string
required: false
default: "8"
description: "The minimum severity required to display an error or warning (default: 5)"

warning_severity:
type: string
required: false
default: "8"
description: "The minimum severity required to display a warning"

error_severity:
type: string
required: false
default: "8"
description: "The minimum severity required to display an error"

baseline_version:
type: string
required: false
default: "1.1.2"
description: "version of phpcs baseline"

runs:
using: composite
steps:
- name: Checkout Project
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set PHP Version
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php_version }}
tools: composer:v${{ inputs.composer_version }}
coverage: none

- name: Install Coding Standard && Codesniffer baseline
shell: bash
run: |
git config --global advice.detachedHead false
composer require "magento/magento-coding-standard: ${{ github.event.inputs.version || '*' }}" -W
composer config --no-plugins allow-plugins.digitalrevolution/php-codesniffer-baseline true
composer require --dev "digitalrevolution/php-codesniffer-baseline: ${{ github.event.inputs.baseline_version || '*' }}"

- name: Register Coding Standard
shell: bash
run: vendor/bin/phpcs --config-set installed_paths ${{ github.workspace }}/vendor/magento/magento-coding-standard,${{ github.workspace }}/vendor/phpcompatibility/php-compatibility

- name: Get all changed files
uses: tj-actions/changed-files@v37
with:
write_output_files: true
output_dir: ${{ github.workspace }}
separator: " "

- name: Verify the contents of the modified_files.txt file
shell: bash
run: |
sed "s/ /\n/g" ${{ github.workspace }}/modified_files.txt > ${{ github.workspace }}/newline_file.txt
grep -iE "\.php|\.phtml|\.html|\.xml" ${{ github.workspace }}/newline_file.txt > ${{ github.workspace }}/phpcs_files.txt

- name: Checkout - Before Merge
shell: bash
run: |
if ${{ github.event_name == 'pull_request' }}; then
git checkout ${{ github.event.pull_request.base.ref }}
else
git checkout ${{ github.event.before }}
fi

- name: Filter php files and execute phpcs - Before Merge
shell: bash
run: |
php vendor/bin/phpcs --standard=Magento2 \
$([ -n "${{ inputs.severity }}" ] && echo "--severity=${{ inputs.severity }}") \
$([ -n "${{ inputs.warning_severity }}" ] && echo "--warning-severity=${{ inputs.warning_severity }}") \
$([ -n "${{ inputs.error_severity }}" ] && echo "--error-severity=${{ inputs.error_severity }}") \
--report=\\DR\\CodeSnifferBaseline\\Reports\\Baseline --report-file=${{ github.workspace }}/phpcs.baseline.xml --file-list=${{ github.workspace }}/phpcs_files.txt || /bin/true

- name: Checkout after Merge and execute phpcs
shell: bash
run: |
if ${{ github.event_name == 'pull_request' }}; then
git checkout ${{ github.event.pull_request.head.ref }}
else
git checkout ${{ github.event.after }}
fi
php vendor/bin/phpcs --standard=Magento2 \
$([ -n "${{ inputs.severity }}" ] && echo "--severity=${{ inputs.severity }}") \
$([ -n "${{ inputs.warning_severity }}" ] && echo "--warning-severity=${{ inputs.warning_severity }}") \
$([ -n "${{ inputs.error_severity }}" ] && echo "--error-severity=${{ inputs.error_severity }}") \
--file-list=${{ github.workspace }}/phpcs_files.txt
61 changes: 56 additions & 5 deletions .github/workflows/coding-standard.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,52 @@
name: Coding Standard
name: M2 Coding Testing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: M2 Coding Testing
name: Coding Standard

I think "Coding Standard" or "M2 Coding Standard" is the better choice here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bump :)


on:
push:
branches: [ 2.4-develop, develop, phpcs_baseline ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in the end, this only needs to include 2.4-develop, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, for testing purpose I added another branches to review

pull_request:
branches:
- 2.4-develop
branches: [ 2.4-develop, develop, phpcs_baseline ]
workflow_call:
inputs:
php_version:
type: string
required: true
default: "8.1"
description: "PHP version used to do the coding standard check."

composer_version:
type: string
required: true
default: "2"
description: "The version of composer to use."

path:
type: string
required: true
default: 'app/code'
description: "The directory (relative to the project root) in which the coding standard will be checked. Used when the event is not a pull request."

version:
type: string
required: false
description: "The version of the coding standard to use. If not provided, will use the latest version."

severity:
type: string
required: false
default: "8"
description: "The minimum severity required to display an error or warning (default: 5)"

warning_severity:
type: string
required: false
default: "8"
description: "The minimum severity required to display a warning"

error_severity:
type: string
required: false
default: "8"
description: "The minimum severity required to display an error"

permissions:
contents: read
Expand All @@ -12,5 +55,13 @@ jobs:
coding-standard:
runs-on: ubuntu-latest
steps:
- name: Run Coding Standard
uses: mage-os/github-actions/coding-standard@main
- uses: actions/checkout@v1
- uses: mage-os/github-actions/coding-standard-baseline@main
with:
php_version: "8.1" # Optional, will be used for Php version
composer_version: "2"
version: "31" # Optional, will use the latest if omitted.
severity: "8" # Optional, will use phpcs default of 5 if not specified.
warning_severity: "4" # Optional, will use warning severity value if not specified.
error_severity: "7" # Optional, will use error severity value if not specified.
baseline_version: "1.1.2" # Optional, will use for php codesniffer baseline version
1 change: 1 addition & 0 deletions app/code/Magento/Backup/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<system>
<backup>
<functionality_enabled>0</functionality_enabled>
<test>
</backup>
</system>
</default>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<body>
<referenceBlock name="adminhtml.system.backup.container">
<block class="Magento\Backend\Block\Widget\Grid" name="adminhtml.system.backup.grid" as="grid">

<arguments>
<argument name="id" xsi:type="string">backupsGrid</argument>
<argument name="dataSource" xsi:type="object" shared="false">Magento\Backup\Model\Fs\Collection</argument>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public function __construct(
*/
public function execute()
{
echo "1"
echo "2";
if ($this->getRequest()->getPostValue()) {
/** @var \Magento\CatalogRule\Api\CatalogRuleRepositoryInterface $ruleRepository */
$ruleRepository = $this->_objectManager->get(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
*/
-->
<div class="authentication-wrapper" data-block="authentication" data-bind="visible: isActive()">
<?php
eee
?>
<button
type="button"
class="action action-auth-toggle"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Customer\Model\App\FrontController;

use Magento\Framework\App\Response\Http as ResponseHttp;
use Magento\Customer\Model\Session;

/**
* Plugin for delete the cookie when the customer is not exist.
*
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
*/
class DeleteCookieWhenCustomerNotExistPlugin
{
/**
* @var ResponseHttp
*/
private $responseHttp;

/**
* @var Session
*/
private $session;

/**
* Constructor
*
* @param ResponseHttp $responseHttp
* @param Session $session
*/
public function __construct(
ResponseHttp $responseHttp,
Session $session
) {
$this->responseHttp = $responseHttp;
$this->session = $session;
}

/**
* Delete the cookie when the customer is not exist before dispatch the front controller.
*
* @return void
*/
public function beforeDispatch(): void
{
if (!$this->session->getCustomerId()) {
$this->responseHttp->sendVary();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Customer\Test\Unit\Model\App\FrontController;

use Magento\Customer\Model\App\FrontController\DeleteCookieWhenCustomerNotExistPlugin;
use Magento\Framework\App\Response\Http as ResponseHttp;
use Magento\Customer\Model\Session;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

/**
* Tests \Magento\Customer\Model\App\FrontController\DeleteCookieWhenCustomerNotExistPluginTest.
*/
class DeleteCookieWhenCustomerNotExistPluginTest extends TestCase
{
/**
* @var DeleteCookieWhenCustomerNotExistPlugin
*/
protected DeleteCookieWhenCustomerNotExistPlugin $plugin;

/**
* @var ResponseHttp|MockObject
*/
protected ResponseHttp|MockObject $responseHttpMock;

/**
* @var Session|MockObject
*/
protected MockObject|Session $customerSessionMock;

/**
* Set up
*/
protected function setUp(): void
{
$this->customerSessionMock = $this->createMock(Session::class);
$this->responseHttpMock = $this->createMock(ResponseHttp::class);
$this->plugin = new DeleteCookieWhenCustomerNotExistPlugin(
$this->responseHttpMock,
$this->customerSessionMock
);
}

public function testBeforeDispatch()
{
$this->customerSessionMock->expects($this->once())
->method('getCustomerId')
->willReturn(0);
$this->plugin->beforeDispatch();
}
}
Loading