Skip to content

ci: Enforce Static Code Analyzer #155

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

Merged
merged 7 commits into from
Jan 24, 2019
Merged

Conversation

oakbani
Copy link
Contributor

@oakbani oakbani commented Jan 16, 2019

Summary

  • This enforces static code analyzer PHPCodeSniffer on Travis.
  • phpcs.xml - configuration file added to root which is used by default when no arguments are supplied to phpcs
  • PHPCodeSniffer comes along with PHP Code Beautifier which auto fixes (not all) lint errors.
  • Scripts added to composer.json for easy execution of linter and autofixer.
  • Linting stage separated on Travis as the first pass before Integration Tests and Unit tests are executed.
  • Enforces PSR2 standards. https://www.php-fig.org/psr/psr-2/

Test plan

Issues

  • OASIS-4025

@oakbani oakbani requested a review from a team January 16, 2019 11:51
@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.025% when pulling a450d58 on oakbani/static-code-analyzer into 513039d on master.

4 similar comments
@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.025% when pulling a450d58 on oakbani/static-code-analyzer into 513039d on master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.025% when pulling a450d58 on oakbani/static-code-analyzer into 513039d on master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.025% when pulling a450d58 on oakbani/static-code-analyzer into 513039d on master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.025% when pulling a450d58 on oakbani/static-code-analyzer into 513039d on master.

@coveralls
Copy link

coveralls commented Jan 16, 2019

Coverage Status

Coverage remained the same at 97.952% when pulling 3d426fb on oakbani/static-code-analyzer into c0ad1db on master.

Copy link
Contributor

@aliabbasrizvi aliabbasrizvi left a comment

Choose a reason for hiding this comment

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

This is great. Thank you for doing this.

.travis.yml Outdated

# Integration tests need to run first to reset the PR build status to pending
# Linting and Integration tests need to run first to reset the PR build status to pending
Copy link
Contributor

Choose a reason for hiding this comment

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

nit. integration (lower case i)

@@ -1,6 +1,6 @@
<?php
/**
* Copyright 2017, Optimizely
* Copyright 2017,2019, Optimizely
Copy link
Contributor

Choose a reason for hiding this comment

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

nit. Space after coma before 2019.

@@ -1,6 +1,6 @@
<?php
/**
* Copyright 2016,2018 Optimizely
* Copyright 2016,2018-2019 Optimizely
Copy link
Contributor

Choose a reason for hiding this comment

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

nit. Space after ,

[ 'entity_id' => '$opt_user_agent',
array_unshift(
$this->expectedEventParams['visitors'][0]['attributes'],
[ 'entity_id' => '$opt_user_agent',
'key' => '$opt_user_agent',
Copy link
Contributor

Choose a reason for hiding this comment

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

This indentation seems awkward.

@oakbani
Copy link
Contributor Author

oakbani commented Jan 17, 2019

Failing due to

Your SourceClear trial has expired, so scans cannot be performed.

@mikeproeng37 mikeproeng37 merged commit cc9dd78 into master Jan 24, 2019
@oakbani oakbani deleted the oakbani/static-code-analyzer branch January 25, 2019 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants