Giter Site home page Giter Site logo

mnapoli / pretty Goto Github PK

View Code? Open in Web Editor NEW
107.0 9.0 5.0 28 KB

✨ CLI command with sane defaults to simplify CodeSniffer and PHP-CS-Fixer

Home Page: https://prettyci.com

License: MIT License

PHP 100.00%
php psr-1 psr-2 coding-standards code-formatter coding-style

pretty's Issues

Windows

Due to an undisclosed need, i had to run pretty on Windows.
When running pretty i got:

ERROR: PHP CodeSniffer does not seem to be installed because the 'phpcs' program cannot be found.

It was strange because i had phpcs installed and i could run it just fine. After looking trough this code i noticed that the error message comes from:

function commandExists($command)
{
    $return = shell_exec('which ' . escapeshellarg($command));
    return !empty($return);
}

which cannot be installed on Windows, so i just changed the above code to

function commandExists($command)
{
   return true;
}

And poof everthing started working just fine :)
Hope this will help somebody else.

Running "pretty" on brefphp/bref

> pretty fix
PHP CodeSniffer configuration file found, running CodeSniffer with version
ERROR: PHP CodeSniffer does not seem to be installed because the 'phpcbf' program cannot be found.
You can install it by following the instructions here: https://github.com/squizlabs/PHP_CodeSniffer#installation
> composer global require "squizlabs/php_codesniffer=*"
(successfully installed)
>  pretty fix                                           
PHP CodeSniffer configuration file found, running CodeSniffer with version
PHP_CodeSniffer version 3.4.2 (stable) by Squiz (http://www.squiz.net)

ERROR: Referenced sniff "Doctrine" does not exist

Run "phpcbf --help" for usage information

Errors were found, run 'pretty fix' to fix them.

I have to somehow figure out that I must run composer global require doctrine/coding-standard. (Or maybe there is another way?)

We are now a long way from php-fixer fix which was something I liked with pretty ci.

Anyhow, I maybe should have opened this issue on Bref. I just wanted to share some frustration.

No configuration file found

I get this error when running pretty:

No configuration file found, running PHP CodeSniffer with PSR-2

I have a .phpcs.xml file in the project and I have also tried renaming it to .phpcs.xml.dist but I get the same result and it defaults to PSR-2. When I execute phpcs using vendor/bin/phpcs . it runs fine.

Is there something else I am missing?

Getting error, when using "PHP CS Fixer version 0.3-DEV"

→ pretty fix
PHP-CS-Fixer configuration file found, running PHP-CS-Fixer with version
PHP CS Fixer version 0.3-DEV by Fabien Potencier



                                              
  [RuntimeException]                          
  The "--allow-risky" option does not exist.  
                                              


fix [--config="..."] [--dry-run] [--level="..."] [--fixers="..."] [--diff] [--format="..."] path


Errors were found, run 'pretty fix' to fix them.

Force --no-colors in PHP_CodeSniffer CLI

PHP_CodeSniffer currently doesn't support autodetection of whether STDOUT is a TTY, so projects (e.g. doctrine/dbal) specify colors in their configuration for developer’ convenience. If PHP_CodeSniffer with such settings runs on Travis, it’s fine because interprets ANSI output.

At the same time, it doesn't seem to be the case for GitHub Checks. So the colored output is displayed as control characters (example).

Would it make sense to force --no-colors in the phpcs command line arguments? It seems to suppress the color argument from the XML configuration.

False positives for PSR12 on PHP 7.4.2

PrettyCI is returning errors from PHPCS when running PHPCS locally with the same .phpcs.xml file reports no errors so I don't believe this is a PHPCS issue.

The errors themselves reported aren't issues, and if changed, would actually introduce changes no longer compliant with PSR12.

Here are the results of my latest run showing the two issues:
https://github.com/aran112000/Form-Generator/runs/418127387

Specifically, these are the issues being flagged:

Expected at least 1 space after "?"; 0 found

protected ?string $value = null;

Expected at least 1 space before ":"; 0 found

public function getId(): string

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.