Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usagov 2122 update custom code #2126

Merged
merged 14 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ jobs:

lint:
docker:
- image: cimg/php:8.1.27-node
- image: cimg/php:8.3-node
steps:
- checkout
- run:
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,15 +243,17 @@ PHPCodesniffer and the parallel linting tools should be installed automatically
The following composer scripts are aliases for running these tools.

* Check for code style errors across all project files. Must have zero errors:
`./bin/composer phpcs-errors`:
* Check for code style errors and warnings across all project files.
`./bin/composer phpcs-strict`
`./bin/composer phpcs-errors`
* Check for code style errors and warnings across all project file
`./bin/composer phpcs-strict`
* Check for code style errors in current branch. Must have zero errors:
`./bin/composer phpcs-changes`
* Check for code style errors and warnings in current branch.
`./bin/composer phpcs-changes-strict`
* Check for PHP lint errors
`./bin/composer php-lint`
* Check for PHP 8.3 compatibility
`./bin/composer php-compatibility`

## Checking code with PHPStan

Expand Down
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,10 @@
},
"require-dev": {
"drupal/coder": "^8.3",
"mglaman/phpstan-drupal": "*",
"php-parallel-lint/php-parallel-lint": "^1.4",
"phpcompatibility/php-compatibility": "^9.3",
"rector/rector": "^2.0",
"mglaman/phpstan-drupal": "*",
"phpstan/phpstan": "*",
"phpstan/phpstan-deprecation-rules": "*"
},
Expand All @@ -195,6 +197,9 @@
],
"phpstan": [
"vendor/bin/phpstan --memory-limit=1G"
],
"php-compatibility": [
"vendor/bin/phpcs -pn --runtime-set testVersion 8.3- web/modules/custom web/themes/custom -d memory_limit=2G --standard=.phpcs.xml.dist"
]
}
}
70 changes: 66 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\SetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/web/modules/custom/',
__DIR__ . '/web/themes/custom/',
]);

// Other configurations, such as rule sets
$rectorConfig->sets([
SetList::PHP_83,
]);
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public function getFormId() {
/**
* {@inheritdoc}
*/
#[\Override]
public function buildForm(array $form, FormStateInterface $form_state) {
$entityTypeManager = \Drupal::service('entity_type.manager');

Expand Down Expand Up @@ -77,6 +78,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
/**
* {@inheritdoc}
*/
#[\Override]
public function validateForm(array &$form, FormStateInterface $form_state) {
// foreach ($form['#entity_reference'] as $index => $entity_reference) {

Expand All @@ -96,6 +98,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
/**
* {@inheritdoc}
*/
#[\Override]
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this->config('orphaned_entities.settings');
foreach ($form['#entity_reference'] as $index => $entity_reference) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ class TaxonomyDatalayerBuilder {
public const HOME_TITLE_ES = "Página principal";
public const HOME_URL_ES = "/es/";

private const ABOUT_GOVT_EN = "About the U.S. and its government";
private const ABOUT_URL_EN = "/about-the-us";
private const string ABOUT_GOVT_EN = "About the U.S. and its government";
private const string ABOUT_URL_EN = "/about-the-us";

private const ABOUT_GOVT_ES = "Acerca de EE. UU. y su Gobierno";
private const ABOUT_URL_ES = "/es/acerca-de-estados-unidos";
private const string ABOUT_GOVT_ES = "Acerca de EE. UU. y su Gobierno";
private const string ABOUT_URL_ES = "/es/acerca-de-estados-unidos";

private const AGENCY_INDEX_URL_EN = '/agency-index';
private const AGENCY_INDEX_URL_ES = '/es/indice-agencias';
private const string AGENCY_INDEX_URL_EN = '/agency-index';
private const string AGENCY_INDEX_URL_ES = '/es/indice-agencias';

private const STATE_INDEX_URL_EN = '/state-governments';
private const STATE_INDEX_URL_ES = '/es/gobiernos-estatales';
private const string STATE_INDEX_URL_EN = '/state-governments';
private const string STATE_INDEX_URL_ES = '/es/gobiernos-estatales';

/**
* Language code for entity.
Expand Down
akf marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public function getFormId() {
/**
* {@inheritdoc}
*/
#[\Override]
public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::buildForm($form, $form_state);

Expand All @@ -35,6 +36,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
/**
* {@inheritdoc}
*/
#[\Override]
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->config('usagov_benefit_finder.settings')
->set('automate_json_data_file_generating', $form_state->getValue('automate_json_data_file_generating'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
/**
* {@inheritdoc}
*/
#[\Override]
public function validateForm(array &$form, FormStateInterface $form_state) {
$all_files = $this->getRequest()->files->get('files', []);
$file = $all_files['acronym_file'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
/**
* {@inheritdoc}
*/
#[\Override]
public function validateForm(array &$form, FormStateInterface $form_state) {
$all_files = $this->getRequest()->files->get('files', []);
$file = $all_files['synonym_file'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
/**
* {@inheritdoc}
*/
#[\Override]
public function validateForm(array &$form, FormStateInterface $form_state) {
$all_files = $this->getRequest()->files->get('files', []);
$file = $all_files['toggle_map_file'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public function __construct(ConfigFactoryInterface $config_factory, StateInterfa
/**
* {@inheritdoc}
*/
#[\Override]
public static function create(ContainerInterface $container) {
return new static(
$container->get('config.factory'),
Expand All @@ -60,6 +61,7 @@ protected function getEditableConfigNames() {
/**
* {@inheritdoc}
*/
#[\Override]
public function buildForm(array $form, FormStateInterface $form_state) {
$form['sso_login_path'] = [
'#type' => 'textfield',
Expand Down Expand Up @@ -89,6 +91,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
/**
* {@inheritdoc}
*/
#[\Override]
public function submitForm(array &$form, FormStateInterface $form_state) {

$this->state->set('usagov_login_local_form', $form_state->getValue('display_local'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
)]
class SidebarFirstBlock extends AbstractMenuBlock {

private const AGENCIES_NID_EN = 629;
private const AGENCIES_NID_ES = 1696;
private const STATES_NID_EN = 1885;
private const STATES_NID_ES = 1870;
private const int AGENCIES_NID_EN = 629;
private const int AGENCIES_NID_ES = 1696;
private const int STATES_NID_EN = 1885;
private const int STATES_NID_ES = 1870;

/**
* {@inheritdoc}
Expand Down
Loading