-
Notifications
You must be signed in to change notification settings - Fork 14
Adding basic linting. #47
Conversation
@fmizzell the way I imagined it when I wrote the original ticket was the options except for the path should be default, and it should default to current dir so you should be able to just type |
@dafeder The problem with the approach you are proposing is that it makes it really hard to get out of the constraints you are imposing. For example if I have a library that I wan to lint that uses PSR2, it would be very hard for us to return that power to the user. |
@fmizzell can't we have the arguments get default values and then you just set them differently if you want to? |
The final decision is to make the commands work with some defaults, but also expose phpcs directly. |
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.
@fmizzell made some suggestions but would accept "let's do another PR for cleanup," lmk how you want to handle.
src/Command/TestCommands.php
Outdated
*/ | ||
public function phpcbf(array $args) { | ||
$dktl_dir = Util::getDktlDirectory(); | ||
$phpcs_command = "{$dktl_dir}/vendor/bin/phpcbf"; |
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.
can we make this $phpcbf_command
?
src/Command/TestCommands.php
Outdated
$dktl_dir = Util::getDktlDirectory(); | ||
$project_dir = Util::getProjectDirectory(); | ||
|
||
$phpcs_command = "{$dktl_dir}/vendor/bin/phpcs"; |
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.
Maybe create a class property or get method for phpcs_command so we don't have this redundant code?
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.
...although actually, wouldn't it make more sense to re-use $this->phpcs
?
Connects #13
QA
dktl phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info /var/www/dkan/modules/dkan/<some_module>
dktl phpcbf --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info /var/www/dkan/modules/dkan/<some_module>
dktl test:lint dkan/modules/dkan/dkan_datastore dkan/modules/dkan/dkan_dataset
dktl test:lint-fix dkan/modules/dkan/dkan_datastore dkan/modules/dkan/dkan_dataset