docksal: PHP Codesniffer ERROR: the "Drupal" coding standard is not installed.

Description

Since updating fin from 1.104 to the latest 1.106 I can no longer run phpcs with Drupal as the coding standard.

Steps to reproduce the issue:

  1. Create a drupal project that includes drupal coder and drupal 9
  2. Attempt to run phpcs or phpcbf and target Drupal standards

e.g.

fin exec phpcs \
  --standard="Drupal,DrupalPractice" -n \
  --extensions="php,module,inc,install,test,profile,theme,info,txt,md,yml" \
  --ignore="*.js,*.css,*.scss,*.jpg,*.png,*.svg,*.ttf" \
  web/modules/custom

Describe the results you received:

Receive error:

ERROR: the "Drupal" coding standard is not installed. The installed coding standards are MySource, PEAR, PSR1, PSR12, PSR2, Squiz and Zend

Describe the results you expected:

phpcs or phpcbf would work as normal.

Output of fin config:

fin config output
Docker Compose configuration
---------------------
services:
  cli:
    dns:
    - 192.168.64.100
    - 8.8.8.8
    environment:
      BLACKFIRE_CLIENT_ID: null
      BLACKFIRE_CLIENT_TOKEN: null
      COMPOSER_ALLOW_XDEBUG: '0'
      COMPOSER_DEFAULT_VERSION: '1'
      COMPOSER_DISABLE_XDEBUG_WARN: '0'
      DOCROOT: web
      DRUSH_ALLOW_XDEBUG: '0'
      DRUSH_OPTIONS_URI: apartmentbuildings.docksal.site
      GIT_USER_EMAIL: gconry@openboxsoftware.com
      GIT_USER_NAME: Gareth Conry
      HOST_GID: '1000'
      HOST_UID: '1000'
      MYSQL_DATABASE: default
      MYSQL_HOST: db
      MYSQL_PASSWORD: user
      MYSQL_ROOT_PASSWORD: root
      MYSQL_USER: user
      PHP_IDE_CONFIG: null
      SECRET_ACAPI_EMAIL: gconr*****e.com
      SECRET_ACAPI_KEY: 3rfo/*****whTIq
      SECRET_ACQUIACLI_KEY: null
      SECRET_ACQUIACLI_SECRET: null
      SECRET_PLATFORMSH_CLI_TOKEN: null
      SECRET_SSH_PRIVATE_KEY: null
      SECRET_TERMINUS_TOKEN: null
      SSH_AUTH_SOCK: /.ssh-agent/proxy-socket
      VIRTUAL_HOST: apartmentbuildings.docksal.site
      XDEBUG_CONFIG: client_host=192.168.64.1 remote_host=192.168.64.1
      XDEBUG_ENABLED: '0'
    healthcheck:
      interval: 10s
    hostname: cli
    image: docksal/cli:php7.3
    labels:
      io.docksal.shell: bash
      io.docksal.user: docker
    logging:
      options:
        max-file: '10'
        max-size: 1m
    volumes:
    - docksal_ssh_agent:/.ssh-agent:ro
    - cli_home:/home/docker:rw
    - /tmp/.docksal/apartmentbuildings:/tmp/.docksal/apartmentbuildings:ro
    - project_root:/var/www:rw,nocopy,cached
  db:
    dns:
    - 192.168.64.100
    - 8.8.8.8
    environment:
      MYSQL_ALLOW_EMPTY_PASSWORD: null
      MYSQL_DATABASE: default
      MYSQL_INITDB_SKIP_TZINFO: null
      MYSQL_ONETIME_PASSWORD: null
      MYSQL_PASSWORD: user
      MYSQL_RANDOM_ROOT_PASSWORD: null
      MYSQL_ROOT_PASSWORD: root
      MYSQL_USER: user
    healthcheck:
      interval: 10s
    hostname: db
    image: docksal/mysql:5.7-1.4
    logging:
      options:
        max-file: '10'
        max-size: 1m
    ports:
    - published: 0
      target: 3306
    volumes:
    - db_data:/var/lib/mysql:rw
    - project_root:/var/www:ro,nocopy,cached
  mail:
    dns:
    - 192.168.64.100
    - 8.8.8.8
    healthcheck:
      interval: 10s
    hostname: mail
    image: mailhog/mailhog
    labels:
      io.docksal.cert-name: none
      io.docksal.virtual-host: mail.apartmentbuildings.docksal.site,mail.apartmentbuildings.docksal.site.*
      io.docksal.virtual-port: '8025'
    logging:
      options:
        max-file: '10'
        max-size: 1m
    volumes:
    - project_root:/var/www:ro,nocopy,cached
  web:
    depends_on:
      cli:
        condition: service_started
    dns:
    - 192.168.64.100
    - 8.8.8.8
    environment:
      APACHE_BASIC_AUTH_PASS: null
      APACHE_BASIC_AUTH_USER: null
      APACHE_DOCUMENTROOT: /var/www/web
      APACHE_FCGI_HOST_PORT: cli:9000
    healthcheck:
      interval: 10s
    hostname: web
    image: docksal/apache:2.4-2.3
    labels:
      io.docksal.cert-name: none
      io.docksal.permanent: "false"
      io.docksal.project-root: /c/Users/gconry/DocksalSites/apartmentbuildings
      io.docksal.virtual-host: apartmentbuildings.docksal.site,*.apartmentbuildings.docksal.site,apartmentbuildings.docksal.site.*
    logging:
      options:
        max-file: '10'
        max-size: 1m
    volumes:
    - project_root:/var/www:ro,nocopy,cached
version: '2.1'
volumes:
  cli_home: {}
  db_data: {}
  docksal_ssh_agent:
    external: true
    name: docksal_ssh_agent
  project_root:
    driver: local
    driver_opts:
      device: /host_mnt/c/Users/gconry/DocksalSites/apartmentbuildings
      o: bind
      type: none

Output of fin sysinfo:

fin sysinfo output
███  FIN
fin version: 1.106.0

███  OS
WSL Ubuntu 18.04
Linux ZA-NB038 4.4.0-19041-Microsoft #488-Microsoft Mon Sep 01 13:43:00 PST 2020 x86_64 x86_64 x86_64 GNU/Linux

███  ENVIRONMENT
MODE : Docker Desktop
DOCKER_HOST : 127.0.0.1:2375

███  DOCKER
EXPECTED CLIENT VERSION: 20.10.7
EXPECTED SERVER VERSION: 20.10.7

Client:
Version:           20.10.7
API version:       1.41
Go version:        go1.13.15
Git commit:        f0df350
Built:             Wed Jun  2 11:51:04 2021
OS/Arch:           linux/amd64
Context:           default
Experimental:      true

Server: Docker Engine - Community
Engine:
Version:          20.10.7
API version:      1.41 (minimum version 1.12)
Go version:       go1.13.15
Git commit:       b0f5bc3
Built:            Wed Jun  2 11:54:58 2021
OS/Arch:          linux/amd64
Experimental:     false
containerd:
Version:          1.4.6
GitCommit:        d71fcd7d8303cbf684402823e425e9dd2e99285d
runc:
Version:          1.0.0-rc95
GitCommit:        b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
docker-init:
Version:          0.19.0
GitCommit:        de40ad0

███  DOCKER COMPOSE
EXPECTED VERSION: 1.29.2
docker-compose version 1.29.2, build 5becea4c
docker-py version: 5.0.0
CPython version: 3.7.10
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019

███  DOCKSAL: PROJECTS
project                    STATUS                    virtual host                                                                                                            project root
apartmentbuildings         Up 46 minutes (healthy)   apartmentbuildings.docksal.site,*.apartmentbuildings.docksal.site,apartmentbuildings.docksal.site.*                     /c/Users/gconry/DocksalSites/apartmentbuildings
relatedcorporateffw        Exited (0) 3 hours ago    related.docksal.site,*.related.docksal.site,related.docksal.site.*                                                      /c/Users/gconry/DocksalSites/RelatedCorporate.FFW
relatedacsf                Exited (0) 2 weeks ago    relatedacsf.docksal.site,*.relatedacsf.docksal.site,relatedacsf.docksal.site.*                                          /c/Users/gconry/DocksalSites/relatedacsf
relatedrentals             Exited (0) 2 weeks ago    relatedrentals.docksal.site,*.relatedrentals.docksal.site,relatedrentals.docksal.site.*                                 /c/Users/gconry/DocksalSites/relatedrentals
apartmentbuildingsdeploy   Exited (0) 8 weeks ago    apartmentbuildingsdeploy.docksal.site,*.apartmentbuildingsdeploy.docksal.site,apartmentbuildingsdeploy.docksal.site.*   /c/Users/gconry/DocksalSites/apartmentbuildings.deploy
rosemarysquare             Exited (0) 6 weeks ago    rosemarysquare.docksal.site,*.rosemarysquare.docksal.site,rosemarysquare.docksal.site.*                                 /c/Users/gconry/DocksalSites/RosemarySquare
d9contrib                  Exited (0) 4 months ago   d9contrib.docksal.site,*.d9contrib.docksal.site,d9contrib.docksal.site.*                                                /c/Users/gconry/DocksalSites/d9contrib
d9standard                 Exited (0) 4 months ago   d9standard.docksal.site,*.d9standard.docksal.site,d9standard.docksal.site.*                                             /c/Users/gconry/DocksalSites/d9standard

███  DOCKSAL: VIRTUAL HOSTS
*.apartmentbuildings.docksal.site
apartmentbuildings.docksal.site.*
apartmentbuildings.docksal.site
mail.apartmentbuildings.docksal.site.*
mail.apartmentbuildings.docksal.site

███  DOCKSAL: NETWORKING

DOCKSAL_IP: 192.168.64.100
DOCKSAL_HOST_IP: 192.168.64.1
DOCKSAL_VHOST_PROXY_IP: 0.0.0.0
DOCKSAL_DNS_IP: 0.0.0.0
DOCKSAL_DNS_DISABLED: 0
DOCKSAL_NO_DNS_RESOLVER: 1
DOCKSAL_DNS_UPSTREAM:
DOCKSAL_DNS_DOMAIN: docksal.site

███  DOCKSAL: CONNECTIVITY

Host to 192.168.64.100:         PASS
Container to 192.168.64.100:    PASS
Container to 192.168.64.1:      PASS

Checking connectivity to http://dns-test.docksal.site...
Host: PASS
Containers: PASS

███  DOCKER: RUNNING CONTAINERS
CONTAINER ID   IMAGE                     COMMAND                  CREATED          STATUS                    PORTS                                                    NAMES
c009757e3f3f   docksal/apache:2.4-2.3    "httpd-foreground"       46 minutes ago   Up 46 minutes (healthy)   80/tcp, 443/tcp                                          apartmentbuildings_web_1
1305aca6aa98   docksal/mysql:5.7-1.4     "docker-entrypoint.s…"   46 minutes ago   Up 46 minutes (healthy)   33060/tcp, 0.0.0.0:55006->3306/tcp, :::55006->3306/tcp   apartmentbuildings_db_1
5bfe07027203   mailhog/mailhog           "MailHog"                46 minutes ago   Up 46 minutes             1025/tcp, 8025/tcp                                       apartmentbuildings_mail_1
8e81708e2681   docksal/cli:php7.3        "/opt/startup.sh sup…"   46 minutes ago   Up 46 minutes (healthy)   22/tcp, 3000/tcp, 9000/tcp                               apartmentbuildings_cli_1
2b867da040c9   docksal/ssh-agent:1.3     "docker-entrypoint.s…"   2 days ago       Up 2 days (healthy)                                                                docksal-ssh-agent
bc8480c4b6fd   docksal/dns:1.1           "docker-entrypoint.s…"   2 days ago       Up 2 days (healthy)       0.0.0.0:53->53/udp                                       docksal-dns
2dcc6106cc44   docksal/vhost-proxy:1.7   "docker-entrypoint.s…"   2 days ago       Up 2 days (healthy)       0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp                 docksal-vhost-proxy

███  DOCKER: NETWORKS
NETWORK ID     NAME                         DRIVER    SCOPE
f0affd118f99   _default                     bridge    local
ebe4a021fbe2   apartmentbuildings_default   bridge    local
d2d68ba55119   bridge                       bridge    local
7a3f8ea26ef4   host                         host      local
72c5a1015bcc   none                         null      local

███  DOCKER DESKTOP
EXPECTED VERSION: 3.4.0
DETECTED VERSION: 3.4.0

███  HDD Usage
Caption  FreeSpace     Size
C:       249788694528  506333229056

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 24 (11 by maintainers)

Most upvoted comments

The reason why it doesn’t work is that codesniffer is installed twice: global and local. And local codesniffer overrides global. Coding standards are added to global codesnivver by this command: https://github.com/docksal/service-cli/blob/develop/8.0/Dockerfile#L334 So solution is to execute this command for local codesniffer. Just run the following to repair this:

fin exec phpcs --config-set installed_paths \
/home/docker/.composer/vendor/drupal/coder/coder_sniffer/,\
/home/docker/.composer/vendor/wp-coding-standards/wpcs/,\
/home/docker/.composer/vendor/phpcompatibility/php-compatibility/PHPCompatibility/,\
/home/docker/.composer/vendor/phpcompatibility/phpcompatibility-wp/PHPCompatibilityWP,\
/home/docker/.composer/vendor/phpcompatibility/phpcompatibility-paragonie/PHPCompatibilityParagonieRandomCompat;

The reason why it doesn’t work is that codesniffer is installed twice: global and local.

If anyone comes up with an automatic and straightforward fix for this, please let me know.

Otherwise, please (pick one):

Closing as there is nothing else we can do here on the Docksal side.