smmccabe / phpdebt

Technical Debt Calculator
GNU General Public License v3.0
19 stars 9 forks source link

Install and run from composer not working #1

Closed joshmiller83 closed 5 years ago

joshmiller83 commented 6 years ago

Hey Shawn. Not sure if this is meant to work but I tried running this with composer and fails started happening.

$ composer require smccabe/phpdebt
  - Installing squizlabs/php_codesniffer (2.9.1): Loading from cache
  - Installing dealerdirect/phpcodesniffer-composer-installer (v0.4.4): Loading from cache
  - Installing drupal/coder (8.2.12): Cloning 984c54a7b1 from cache
  - Installing sebastian/version (2.0.1): Loading from cache
  - Installing theseer/fdomdocument (1.6.6): Loading from cache
  - Installing sebastian/finder-facade (1.2.2): Loading from cache
  - Installing phploc/phploc (4.0.1): Loading from cache
  - Installing smccabe/phpdebt (0.1.6): Loading from cache
dealerdirect/phpcodesniffer-composer-installer suggests installing dealerdirect/qa-tools (All the PHP QA tools you'll need)
Writing lock file
Generating optimized autoload files
PHP CodeSniffer Config installed_paths set to ../../drupal/coder/coder_sniffer/
$ ls bin
drush             drush.launcher    pdepend           phpcbf            phpdebt           phpmd
drush.complete.sh drush.php         php-parse         phpcs             phploc            psysh
$ bin/phpdebt wwwroot/sites/all/modules/clientname/clientname_api 
phpmd cleancode:       16
phpmd codesize:       11
phpmd design:        7
phpmd naming:        5
phpmd unusedcode:        7
bin/phpdebt: line 34: /Users/josh/git/gitlab/accounts/clientname/vendor/bin/phpcs: No such file or directory
sed: illegal option -- r
usage: sed script [-Ealn] [-i extension] [file ...]
       sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]
phpcs Drupal: 
bin/phpdebt: line 39: /Users/josh/git/gitlab/accounts/clientname/vendor/bin/phpcs: No such file or directory
sed: illegal option -- r
usage: sed script [-Ealn] [-i extension] [file ...]
       sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]
phpcs DrupalPractice: 
bin/phpdebt: line 44: /Users/josh/git/gitlab/accounts/clientname/vendor/bin/phploc: No such file or directory
sed: illegal option -- r
usage: sed script [-Ealn] [-i extension] [file ...]
       sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]
(standard_in) 1: parse error
sed: illegal option -- r
usage: sed script [-Ealn] [-i extension] [file ...]
       sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]
Total Faults: 46
Total Lines: 
Quality Score: 0 faults per 100 lines
joshmiller83 commented 6 years ago

Reading this over a few weeks removed, it looks like you're hardcoding where the bin directory is located. In normal Drupal 8 composer based land, it's outside of the vendor directory and in the app root as "/bin"

joshmiller83 commented 6 years ago

And confirmed by reading the code:

https://github.com/smmccabe/phpdebt/blob/master/phpdebt#L10

There is a commented out attempt at making the bin call dynamic and the static bin definition doesn't unfortunately fit my use case. Maybe just a quick note or alternative flag for the command to let it know where the bin is? I'd be happy to provide it as a parameter.

cornifex commented 5 years ago

@joshmiller83 #3 aims to fix this. Feel free to check it out and give it a whirl.