php-codesniffer: init at 3.7.2, phpcs: deprecated, phpcbf: deprecated

This commit is contained in:
Pol Dellaiera 2024-02-20 08:12:49 +01:00
parent 5949927f4d
commit 8d0197fe1e
No known key found for this signature in database
GPG Key ID: D476DFE9C67467CA
5 changed files with 1381 additions and 76 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,27 @@
{ fetchFromGitHub
, lib
, php
}:
php.buildComposerProject (finalAttrs: {
pname = "php-codesniffer";
version = "3.7.2";
src = fetchFromGitHub {
owner = "squizlabs";
repo = "PHP_CodeSniffer";
rev = "${finalAttrs.version}";
hash = "sha256-EJF9e8gyUy5SZ+lmyWFPAabqnP7Fy5t80gfXWWxLpk8=";
};
composerLock = ./composer.lock;
vendorHash = "sha256-svkQEKKFa0yFTiOihnAzVdi3oolq3r6JmlugyBZJATA=";
meta = {
changelog = "https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/tag/${finalAttrs.version}";
description = "PHP coding standard tool";
license = lib.licenses.bsd3;
homepage = "https://github.com/PHPCSStandards/PHP_CodeSniffer/";
maintainers = with lib.maintainers; [ javaguirre ] ++ lib.teams.php.members;
};
})

View File

@ -1,35 +0,0 @@
{ mkDerivation, fetchurl, lib, php, makeWrapper }:
let
pname = "phpcbf";
version = "3.7.2";
in
mkDerivation {
inherit pname version;
src = fetchurl {
url = "https://github.com/squizlabs/PHP_CodeSniffer/releases/download/${version}/phpcbf.phar";
sha256 = "sha256-TspzKpl98IpMl+QyZuuBIvkW05uwAqAAYA/dU5P07+E=";
};
dontUnpack = true;
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
install -D $src $out/libexec/phpcbf/phpcbf.phar
makeWrapper ${php}/bin/php $out/bin/phpcbf \
--add-flags "$out/libexec/phpcbf/phpcbf.phar"
runHook postInstall
'';
meta = with lib; {
changelog = "https://github.com/squizlabs/PHP_CodeSniffer/releases/tag/${version}";
description = "PHP coding standard beautifier and fixer";
license = licenses.bsd3;
homepage = "https://squizlabs.github.io/PHP_CodeSniffer/";
maintainers = with maintainers; [ cmcdragonkai ] ++ teams.php.members;
};
}

View File

@ -1,35 +0,0 @@
{ mkDerivation, fetchurl, makeWrapper, lib, php }:
let
pname = "phpcs";
version = "3.7.2";
in
mkDerivation {
inherit pname version;
src = fetchurl {
url = "https://github.com/squizlabs/PHP_CodeSniffer/releases/download/${version}/phpcs.phar";
sha256 = "sha256-IEIUwepbqBT7CyYIwZzKLBC/X/zJ8OPUw0qtwBeVF7c=";
};
dontUnpack = true;
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
install -D $src $out/libexec/phpcs/phpcs.phar
makeWrapper ${php}/bin/php $out/bin/phpcs \
--add-flags "$out/libexec/phpcs/phpcs.phar"
runHook postInstall
'';
meta = with lib; {
changelog = "https://github.com/squizlabs/PHP_CodeSniffer/releases/tag/${version}";
description = "PHP coding standard tool";
license = licenses.bsd3;
homepage = "https://squizlabs.github.io/PHP_CodeSniffer/";
maintainers = with maintainers; [ javaguirre ] ++ teams.php.members;
};
}

View File

@ -198,14 +198,12 @@ lib.makeScope pkgs.newScope (self: with self; {
phive = callPackage ../development/php-packages/phive { };
php-codesniffer = callPackage ../development/php-packages/php-codesniffer { };
php-cs-fixer = callPackage ../development/php-packages/php-cs-fixer { };
php-parallel-lint = callPackage ../development/php-packages/php-parallel-lint { };
phpcbf = callPackage ../development/php-packages/phpcbf { };
phpcs = callPackage ../development/php-packages/phpcs { };
phpmd = callPackage ../development/php-packages/phpmd { };
phpspy = callPackage ../development/php-packages/phpspy { };
@ -215,10 +213,11 @@ lib.makeScope pkgs.newScope (self: with self; {
psalm = callPackage ../development/php-packages/psalm { };
psysh = callPackage ../development/php-packages/psysh { };
} // lib.optionalAttrs config.allowAliases {
phpcbf = throw "`phpcbf` is now deprecated, use `php-codesniffer` instead which contains both `phpcs` and `phpcbf`.";
phpcs = throw "`phpcs` is now deprecated, use `php-codesniffer` instead which contains both `phpcs` and `phpcbf`.";
};
# This is a set of PHP extensions meant to be used in php.buildEnv
# or php.withExtensions to extend the functionality of the PHP
# interpreter.