Skip to content

Fix/fix various linting errors#337

Merged
John-Holt-Tessella merged 22 commits intopre-release/2022-R4.3-PHP-upgradefrom
fix/fix-various-linting-errors
Dec 7, 2022
Merged

Fix/fix various linting errors#337
John-Holt-Tessella merged 22 commits intopre-release/2022-R4.3-PHP-upgradefrom
fix/fix-various-linting-errors

Conversation

@morybc
Copy link
Contributor

@morybc morybc commented Sep 16, 2022

The Psalm linter that was added in the previous pull request flagged about 40 errors. The changes here get this down to 5.

Some of these errors were just style/warning type things, however there are some genuine bugs in there too - so I think this has been a worthwhile exercise.

$dc['FILETEMPLATE'] = preg_replace('/.*\/'.$this->arg('prop').'-'.$dc['VN'].'\//', '', $dc['FILETEMPLATE']);

$nf = array(2 => array('EXPOSURETIME'), 2 => array('AXISSTART', 'RESOLUTION', 'TRANSMISSION'));
$nf = array(1 => array('EXPOSURETIME'), 2 => array('AXISSTART', 'RESOLUTION', 'TRANSMISSION'));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know if this is correct! But what was there was not correct (EXPOSURETIME is just lost due to the second, repeat definition, of '2'). @JPHall-DLS can you double check this, please?

Copy link
Contributor

@stufisher stufisher Sep 17, 2022

Choose a reason for hiding this comment

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

It's inverted, the keys represent the precision to round to (read down a bit). Right now that means EXPOSURETIME is not rounded. 1 sig fig is too small for EXPOSURETIME, add it to the 2 array. (only for energy scans, data collections are fine)

foreach ($nf as $nff => $cols) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, that's helpful - thanks, Stuart!

private function configExitIfNoMicroscopes()
{
if (count($this->_get_beamlines_from_type('em')) == 0) {
if (count($this->_get_beamlines_from_type('em', false)) == 0) {
Copy link
Contributor Author

@morybc morybc Sep 16, 2022

Choose a reason for hiding this comment

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

Not sure why, but the linter didn't seem happy this was a missing optional input - so to get rid of the error, just set it directly.

@morybc morybc changed the base branch from master to pre-release/2022-R4.3-PHP-upgrade October 4, 2022 15:39
@morybc morybc requested review from JPHall-DLS and vonvick October 4, 2022 15:39
@John-Holt-Tessella John-Holt-Tessella merged commit 4d85172 into pre-release/2022-R4.3-PHP-upgrade Dec 7, 2022
@John-Holt-Tessella John-Holt-Tessella deleted the fix/fix-various-linting-errors branch December 7, 2022 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants