Skip to content

Commit

Permalink
VACMS-15954 Add phpcs baselines (#16109)
Browse files Browse the repository at this point in the history
* Add PHP Codesniffer Baselines

- This prevents phpcs from failing due to existing errors
- Bulk fix use ordering with phpcbf
- Add php-codesniffer-baseline as dev requirement and regenerate baseline file
  • Loading branch information
JunTaoLuo authored Nov 14, 2023
1 parent 1d578b4 commit 531ad7f
Show file tree
Hide file tree
Showing 98 changed files with 248 additions and 143 deletions.
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"require-dev": {
"behat/mink": "^1.10",
"behat/mink-browserkit-driver": "^2.1",
"digitalrevolution/php-codesniffer-baseline": "^1.1",
"drupal/devel": "^5.0",
"drupal/html_tag_usage": "^1.0@beta",
"drupal/media_entity_generic": "^1.0"
Expand Down Expand Up @@ -289,7 +290,8 @@
"dealerdirect/phpcodesniffer-composer-installer": true,
"php-http/discovery": true,
"cweagans/composer-patches": true,
"orakili/composer-drupal-info-file-patch-helper": true
"orakili/composer-drupal-info-file-patch-helper": true,
"digitalrevolution/php-codesniffer-baseline": true
}
},
"extra": {
Expand Down
53 changes: 52 additions & 1 deletion composer.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "08f620d95b73058a67aed476a9070dae",
"content-hash": "782d00549944f970d02bb65812fd711b",
"packages": [
{
"name": "alchemy/zippy",
Expand Down Expand Up @@ -27578,6 +27578,57 @@
},
"time": "2022-03-28T14:33:51+00:00"
},
{
"name": "digitalrevolution/php-codesniffer-baseline",
"version": "v1.1.2",
"source": {
"type": "git",
"url": "https://github.com/123inkt/php-codesniffer-baseline.git",
"reference": "00d7cd414cc0fc12e88ee3321d92fe3d2313a9e7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/123inkt/php-codesniffer-baseline/zipball/00d7cd414cc0fc12e88ee3321d92fe3d2313a9e7",
"reference": "00d7cd414cc0fc12e88ee3321d92fe3d2313a9e7",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0 || ^2.0",
"php": ">=7.4",
"squizlabs/php_codesniffer": "^3.6"
},
"require-dev": {
"composer/composer": "^2.0",
"micheh/phpcs-gitlab": "^1.1",
"mikey179/vfsstream": "1.6.10",
"phpmd/phpmd": "@stable",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.4",
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-strict-rules": "^1.1",
"phpunit/phpunit": "^9.5",
"roave/security-advisories": "dev-latest"
},
"type": "composer-plugin",
"extra": {
"class": "DR\\CodeSnifferBaseline\\Plugin\\Plugin"
},
"autoload": {
"psr-4": {
"DR\\CodeSnifferBaseline\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Digital Revolution PHP_Codesniffer baseline extension",
"support": {
"issues": "https://github.com/123inkt/php-codesniffer-baseline/issues",
"source": "https://github.com/123inkt/php-codesniffer-baseline/tree/v1.1.2"
},
"time": "2022-05-31T08:26:56+00:00"
},
{
"name": "drupal/html_tag_usage",
"version": "1.0.0-beta4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

namespace Drupal\va_gov_api\Resources;

use Drupal\jsonapi\ResourceResponse;
use Drupal\jsonapi_resources\Resource\EntityResourceBase;
use Symfony\Component\HttpFoundation\Request;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Entity\EntityInterface;
Expand All @@ -13,8 +10,11 @@
use Drupal\Core\Path\PathValidatorInterface;
use Drupal\jsonapi\JsonApiResource\ResourceObject;
use Drupal\jsonapi\JsonApiResource\ResourceObjectData;
use Drupal\jsonapi\ResourceResponse;
use Drupal\jsonapi\ResourceType\ResourceType;
use Drupal\jsonapi_resources\Resource\EntityResourceBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;

/**
* The BannerAlerts JSON:API resource.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Drupal\va_gov_backend\EventSubscriber;

use Drupal\Core\Config\Entity\ConfigEntityType;
use Drupal\Core\Entity\EntityTypeManager;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\core_event_dispatcher\EntityHookEvents;
use Drupal\core_event_dispatcher\Event\Entity\EntityPresaveEvent;
use Drupal\core_event_dispatcher\Event\Entity\EntityTypeBuildEvent;
use Drupal\core_event_dispatcher\Event\Form\FormIdAlterEvent;
use Drupal\Core\Config\Entity\ConfigEntityType;
use Drupal\Core\Entity\EntityTypeManager;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\field_event_dispatcher\Event\Field\WidgetSingleElementFormAlterEvent;
use Drupal\field_event_dispatcher\FieldHookEvents;
use Drupal\node\NodeInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Drupal\va_gov_backend\EventSubscriber;

use Drupal\Core\Render\RendererInterface;
use Drupal\Core\Link;
use Drupal\Core\Render\RendererInterface;
use Drupal\Core\Url;
use Drupal\node\NodeInterface;
use Drupal\va_gov_backend\Service\VaGovUrlInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace Drupal\va_gov_backend\EventSubscriber;

use Drupal\Core\Render\Element;
use Drupal\core_event_dispatcher\Event\Theme\ThemeSuggestionsAlterEvent;
use Drupal\core_event_dispatcher\ThemeHookEvents;
use Drupal\core_event_dispatcher\Event\Form\FormAlterEvent;
use Drupal\core_event_dispatcher\Event\Theme\ThemeSuggestionsAlterEvent;
use Drupal\core_event_dispatcher\FormHookEvents;
use Drupal\core_event_dispatcher\ThemeHookEvents;
use Drupal\field_event_dispatcher\Event\Field\WidgetSingleElementFormAlterEvent;
use Drupal\field_event_dispatcher\FieldHookEvents;
use Drupal\image\Plugin\Field\FieldWidget\ImageWidget;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Drupal\va_gov_backend\Form;

use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
* Class ExclusionTypesAdminForm.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Drupal\va_gov_backend\Plugin\field_group\FieldGroupFormatter;

use Drupal\field_group\Plugin\field_group\FieldGroupFormatter\HtmlElement;
use Drupal\Component\Utility\Html;
use Drupal\field_group\Plugin\field_group\FieldGroupFormatter\HtmlElement;

/**
* Tooltip field group formatter.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Drupal\va_gov_backend\Plugin\views\access;

use Drupal\views\Plugin\views\access\AccessPluginBase;
use Drupal\Core\Session\AccountInterface;
use Drupal\views\Plugin\views\access\AccessPluginBase;
use Symfony\Component\Routing\Route;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\va_gov_user\Service\UserPermsService;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
* Validates the RequireScope constraint.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Drupal\va_gov_build_trigger\Commands;

use Drush\Commands\DrushCommands;
use Drupal\va_gov_build_trigger\SiteStatus\SiteStatusInterface;
use Drush\Commands\DrushCommands;

/**
* A Drush interface to the Site Status service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace Drupal\va_gov_build_trigger\Controller;

use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Response;
use Drupal\va_gov_build_trigger\Service\ReleaseStateManager;
use Drupal\va_gov_build_trigger\Service\ReleaseStateManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Response;

/**
* Handles content release notifications.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\State\StateInterface;
use Drupal\va_gov_build_trigger\Plugin\MetricsCollector\ContentReleaseInterval;
use Drupal\va_gov_build_trigger\Event\ReleaseStateTransitionEvent;
use Drupal\va_gov_build_trigger\Plugin\MetricsCollector\ContentReleaseInterval;
use Drupal\va_gov_build_trigger\Service\ReleaseStateManager;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Drupal\va_gov_build_trigger\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\OpenModalDialogCommand;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\node\NodeInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use Drupal\Core\Logger\LoggerChannelTrait;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\va_gov_build_trigger\Environment\EnvironmentDiscovery;
use Drupal\va_gov_build_trigger\Service\ReleaseStateManager;
use Drupal\va_gov_build_trigger\Service\ReleaseStateManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\va_gov_build_trigger\Environment\EnvironmentDiscovery;

/**
* AdvancedQueue queue processor plugin for content release dispatch.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace Drupal\va_gov_build_trigger\Plugin\MetricsCollector;

use Drupal\Component\Datetime\TimeInterface;
use Drupal\va_gov_build_trigger\Service\ReleaseStateManager;
use Drupal\Core\State\StateInterface;
use Drupal\va_gov_build_trigger\Service\ReleaseStateManager;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace Drupal\va_gov_build_trigger\Plugin\MetricsCollector;

use Drupal\Component\Datetime\TimeInterface;
use Drupal\va_gov_build_trigger\Service\ReleaseStateManager;
use Drupal\Core\State\StateInterface;
use Drupal\va_gov_build_trigger\Service\ReleaseStateManager;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Drupal\va_gov_bulk\Service;

use Drupal\Core\Session\AccountProxyInterface;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Session\AccountProxyInterface;
use Drupal\node\NodeInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Drupal\va_gov_clone\CloneEntityFinder;

use Drupal\Core\Plugin\DefaultPluginManager;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;

/**
* Provides the Clone handler plugin manager.
Expand Down
2 changes: 1 addition & 1 deletion docroot/modules/custom/va_gov_clone/src/CloneManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace Drupal\va_gov_clone;

use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\entity_clone\Event\EntityCloneEvent;
use Drupal\entity_clone\Event\EntityCloneEvents;
use Drupal\va_gov_clone\CloneEntityFinder\CloneEntityFinderDiscovery;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;

/**
* The Clone Manager to clone content.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Drupal\va_gov_content_release\EntityEvent\Strategy\Resolver;

use Drupal\va_gov_environment\Discovery\DiscoveryInterface;
use Drupal\va_gov_content_release\Exception\CouldNotDetermineStrategyException;
use Drupal\va_gov_environment\Discovery\DiscoveryInterface;

/**
* The strategy resolver service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Drupal\va_gov_content_release\Form\Resolver;

use Drupal\va_gov_content_release\Exception\CouldNotDetermineFormException;
use Drupal\va_gov_content_release\Form\GitForm;
use Drupal\va_gov_content_release\Form\SimpleForm;
use Drupal\va_gov_content_release\Exception\CouldNotDetermineFormException;
use Drupal\va_gov_environment\Discovery\DiscoveryInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Drupal\va_gov_content_release\GitHub;

use Drupal\va_gov_github\Api\Client\ApiClientInterface;
use Drupal\va_gov_content_release\Exception\ContentReleaseInProgressException;
use Drupal\va_gov_content_release\Exception\GitHubRepositoryDispatchException;
use Drupal\va_gov_github\Api\Client\ApiClientInterface;

/**
* The GitHub repository dispatch service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Drupal\va_gov_content_release\LocalFilesystem;

use Drupal\Core\File\FileSystemInterface;
use Drupal\Core\File\Exception\FileException;
use Drupal\Core\File\FileSystemInterface;
use Drupal\va_gov_content_release\Exception\StrategyErrorException;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Drupal\va_gov_content_release\Plugin\EntityEventStrategy;

use Drupal\va_gov_content_release\Exception\StrategyErrorException;
use Drupal\va_gov_content_release\EntityEvent\Strategy\Plugin\StrategyPluginBase;
use Drupal\va_gov_content_release\Exception\StrategyErrorException;
use Drupal\va_gov_content_types\Entity\VaNodeInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Drupal\va_gov_content_release\Request;

use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\advancedqueue\Job;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\va_gov_content_release\Exception\RequestException;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
use Drupal\Core\Url;
use Drupal\field\Entity\FieldConfig;
use Drupal\smart_date\Plugin\Field\FieldWidget\SmartDateWidgetBase;
use Drupal\va_gov_events\Controller\Instances;
use Drupal\smart_date_recur\Entity\SmartDateOverride;
use Drupal\va_gov_events\Controller\Instances;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Drupal\va_gov_flags\Controller;

use Drupal\va_gov_flags\FeatureFlagDataBuilder;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\va_gov_flags\FeatureFlagDataBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Drupal\va_gov_git\BranchSearch;

use Drupal\va_gov_git\Repository\RepositoryInterface;
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use Drupal\va_gov_git\Repository\RepositoryInterface;

/**
* The branch search service.
Expand Down
Loading

0 comments on commit 531ad7f

Please sign in to comment.