Giter VIP home page Giter VIP logo

drupal-quality-checker's People

Contributors

bthirietcap avatar happy047 avatar hussainweb avatar jashish24 avatar mohit-rocks avatar rajeshreeputra avatar sbrindle avatar skippednote avatar vishalkhode1 avatar woredeyonas avatar zeshanziya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

drupal-quality-checker's Issues

Should we overwrite config files and .dist files?

After the discussion here, I am reconsidering the decision to only output .dist files and overwrite them with every install. Does it feel very confusing and potentially fragile? What do you think of writing non-dist files and then having users own them. We could build tooling to let users diff and update their config once we roll out updates (it's tricky to do that but we can discuss this later).

Cannot use root namespace classes/interfaces/traits

Coder recently added a sniff to check if root namespace classes (or interfaces or traits) are fully namespaced. As a consequence, the following code does not pass the sniff.

use Twig_Extension;
use Twig_SimpleFilter;

new Twig_Extension();

The new sniffs check that the code references classes in the root namespace use the full name and not get imported.

new \Twig_Extension();

However, this causes an issue with phpmd: the above example will not pass phpmd's cleancode rules.

There is no workaround to this situation except bypassing checks (git commit -n).

We should adhere to Drupal's coding standards, or at least, coder's interpretation of Drupal's coding standards in this case. The fix would be to exclude this specific rule from phpmd.

Move all task dependencies to suggestions

We require the following dependencies:

        "dealerdirect/phpcodesniffer-composer-installer": "*",
        "drupal/coder": "^8.3.7",
        "friendsoftwig/twigcs": "^4.0 || ^5.0 || ^6.0",
        "php-parallel-lint/php-parallel-lint": "^1.2",
        "phpcompatibility/php-compatibility": "^9.0",
        "phpmd/phpmd": "^2.8",
        "sebastian/phpcpd": "^3.0 || ^4.0 || ^5.0 || ^6.0"

There is always a possibility that these dependencies could introduce conflicts in some projects. Consider moving them to composer.json suggested rather than require so that the dependencies are not locked.

The problem is if we remove all the dependencies, then our default grumphp config will fail. We will need to make it clear in the documentation that the user is responsible for installing the relevant packages.

Consider using Phive to bring in dependencies

Some of the tools we use require conflicting dependencies which makes it difficult to use the latest or even supported versions of these tools. For example, the latest release of PHPCPD is version 6 but only PHPCPD 4 may be installed on a Drupal 8 site (because of Symfony dependencies). This is even more of a problem because GrumPHP has broken support for PHPCPD 4. This means that the version of PHPCPD that gets installed for Drupal 8 does not work at all. We can't change the constraints or this entire package will stop working for Drupal 8. The only options are to ignore the error or remove the dependency on PHPCPD.

Phive lets us avoid all of these problems by installing the PHAR versions of the tools rather than through composer. This keeps the project free of these dependencies. The problem is that this requires users to install another tool (Phive) and also an extra step to run phive install after installing dependencies through composer.

Add TwigCS

GrumPHP supports TwigCS, so we don't have to do much. We should just put it in our default template.

Copy configuration files to the project root

It turns out that there are various issues with using drupal/core-composer-scaffold to copy the files. The most obvious one is that someone has to remember to add this package to composer.json extra section. It's documented, but it's not typical and people are likely to forget.

Another problem is that GrumPHP generates a configuration file on installation as well and there is no clear way to disable this. Fortunately, it checks if a configuration file is already present before generating one. So, if we generate our configuration file before, GrumPHP won't create one. However, the drupal/core-composer-scaffold plugin copies files at the very end which means we can't create the file before.

We should figure out a way to copy the file before events in GrumPHP are fired. The current solution in my mind is to write our own composer plugin which executes before GrumPHP and copies the files. The benefit with this approach is that we no longer have to rely on drupal/core-composer-scaffold to copy files either. So, it's a win-win except that we now have to maintain a plugin just for this.

PHP Warning: preg_match(): Unknown modifier 't'

I have noticed that when paths in ignore_patterns have a / at the end, it generates the following warning while running GrumPHP:

PHP Warning: preg_match(): Unknown modifier 't' in phar:///var/www/html/vendor/phpro/grumphp-shim/grumphp.phar/vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php on line 53

Solutions:
Fix paths for ignore_patterns in grumphp.yml.dist

Update to the 1.0 release of GrumPHP

There is a 1.0 release of GrumPHP. We should determine if we need to change our config file and then update to the new version.

One issue I noticed so far is that GrumPHP is now prompting for creating a config on installation. We should find an option to disable that.

Upgrade to grumphp v2

As per the changelog, there is no change in usage of GrumPHP. However, the task extension system has changed but this does not affect this repository.

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.