Giter Club home page Giter Club logo

drupal-dev-tools's Introduction

Brainsum dev tools for Drupal 10

Build Status

About

Package / Composer plugin for standardizing development tools.

Setup

Preparation

If you already have a grumphp.yml and/or phpcs.xml file in your project, you should rename them. E.g. mv grumphp.yml grumphp.yml.backup If you want to add new tasks and rules on a case-by-case basis, check the files in the distfiles folder of this package. Note: This package is not going to overwrite existing ones, but it might not work with them either.

Installation

In your project, simply use

composer require --dev brainsum/drupal-dev-tools:^5.0.0

Settings

Extend

In the grumphp.yml file in your project, add the following:

imports:
    - { resource: vendor/brainsum/drupal-dev-tools/convention/grumphp.yml }

This will signal grumphp to import everything from this package.

You can customize the rules when needed, too:

parameters:
    convention.git_commit_message_whitelist: ['/^([A-Z]+-[\d]+ )+\| [A-Za-z\d\s\.]+([^.])+\.{1}$/s']

For more information, see:

Override

The files grumphp.yml and phpcs.xml should now be created in your project root. They should be good to go, but you should take a look at them and customize them for the current project as necessary. E.g, phpcs.xml descriptions, namings, checked folders, etc.; grumphp.yml php version, etc.

If they, for some reason, don't get created, you can copy their contents from the files from vendor/brainsum/drupal-dev-tools/distfiles as needed.

If you just want to use some settings from grumphp.yml, not the whole thing, see convention/grumphp.yml, as distfiles/grumphp.yml is only an import file and doesn't contain any other directives.

GrumPHP

Settings

For the pre-defined settings see distfiles/grumphp.yml and convention/grumphp.yml.

Note, we are also trying to create a phpcs.xml file in the project root. The source for that file is also in the distfiles folder.

drupal-dev-tools's People

Contributors

dj1999 avatar mhavelant avatar szatom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

balu-ertl

drupal-dev-tools's Issues

Add tests

We should add test coverage for our custom features.

This includes:

  • custom regexes
  • twig lint task for grumphp
  • smoke tests
  • etc.

Move twig lint to a separate package

Others using GrumPHP would benefit from a separate twig lint package, so we should move it. Maybe even try collaborating with GrumPHP so it gets added as a default task there (TBD).

[Support request] "The option show_warnings does not exist"

After installation with Composer within a project (EL) I wanted to test how the checks run by trying to commit with an obviously fault message:
$ git commit -m "DAM-00 - Ez most nem lenne szabad beengednie"
However I stumbled upon into an issue when checking process arrives to Phpcs (occuring both in- and outside of the Docker container):

[email protected]:/var/www/html $ php ./vendor/bin/grumphp git:pre-commit
GrumPHP detected a pre-commit command.
GrumPHP is sniffing your code!
Running task 1/3: Composer... โœ”
Running task 2/3: Phpcs...
In OptionsResolver.php line 747:
The option "show_warnings" does not exist. Defined options are: "encoding", "error_severity",
"ignore_patterns", "report", "report_width", "severity", "sniffs", "standard", "tab_width",
"triggered_by", "warning_severity", "whitelist_patterns".

After reading about how GrumPHP utilizes Git hooks and how to configure Code_Sniffer to handle warnings, I managed to track back the source of the message which is probably sent by Symfony's OptionsResolver component.

But from this point I can't proceed further with figuring out how to make it properly working.

Grumphp.yml not getting created

As written in #3 :

I expected a new grumphp.yml to automatically appear beside the original one, but by some reason it did not happen.

Installation guide

After reading about Composer's plugin system, first I added these two package resources to the composer.json file in my COMPOSER_HOME directory (as read here):

  "drupal": {
    "type": "composer",
    "url": "https://packages.drupal.org/8"
  },
  "brainsum/drupal-dev-tools": {
    "type": "vcs",
    "url": "https://github.com/brainsum/drupal-dev-tools"
  }
}

Then tried to install with this command:
$ composer global require brainsum/drupal-dev-tools:'^0.2.0'
Here I got the following result:

Problem 1
    - Installation request for brainsum/drupal-dev-tools ^0.2.0 -> satisfiable by brainsum/drupal-dev-tools[0.2.0].
    - brainsum/drupal-dev-tools 0.2.0 requires drupal-composer/drupal-security-advisories 8.x-dev -> satisfiable by drupal-composer/drupal-security-advisories[8.x-dev] but these conflict with your requirements or minimum-stability.

So I started to append all the nagged packages to the end of the command, like this:

$ composer global require brainsum/drupal-dev-tools:'^0.2.0' drupal-composer/drupal-security-advisories:'8.x-dev' drupal/examples:'1.x-dev' symfony/debug:'3.0.0' symfony/console:'2.8.27'

However, as it still not led to success, I'm quite doubted whether it's the proper way to do so...

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.