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

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from
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
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,24 +326,26 @@ 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`
* Check for code style errors in current branch. Must have zero errors:
* 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 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.
* Check for code style errors and warnings in current branch.
`./bin/composer phpcs-changes-strict`
* Check for PHP lint errors
* Check for PHP lint errors
`./bin/composer php-lint`
* Check for PHP 8.3 compatibility
`./bin/composer php-compatibility`

## Project Restart/Reset

Sometimes, Docker problems arise after an upgrade and a more complete restart is needed. After closing down and destroying the existing containers, networks, and volumes the procedure is the same as the full project setup.


### Docker Cleanup


```
docker compose down
docker system prune
Expand Down
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@
},
"require-dev": {
"drupal/coder": "^8.3",
"php-parallel-lint/php-parallel-lint": "^1.4"
"php-parallel-lint/php-parallel-lint": "^1.4",
"phpcompatibility/php-compatibility": "^9.3",
"rector/rector": "^2.0"
},
"scripts": {
"changed-files": [
Expand All @@ -187,6 +189,9 @@
],
"php-lint": [
"vendor/bin/parallel-lint -e php,module,inc,install,test,profile,theme ./web/modules/custom ./web/themes/custom"
],
"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"
]
}
}
187 changes: 183 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gchi25 Note that this PR will add an attribute to two functions here.

I expect that will be acceptable, but I'm going to hold off on approving this for a bit.

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
Loading
Loading