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

2024 Update #20

Merged
merged 39 commits into from
Feb 14, 2024
Merged

2024 Update #20

merged 39 commits into from
Feb 14, 2024

Conversation

stopfstedt
Copy link
Member

@stopfstedt stopfstedt commented Feb 10, 2024

  • new baseline is PHP 8.2
  • upgrades to PHPUnit 11
  • adds configuration for PHPCS
  • PHP strict mode across the board
  • introduces PHPStan
  • fleshes out code coverage on models
  • integrates with Dependabot
  • increases code coverage on parser

@stopfstedt stopfstedt force-pushed the update_2024 branch 3 times, most recently from 0474e52 to 5fd8fdb Compare February 12, 2024 20:46
PHPUnit 11 requires PHP 8.1 or higher.
staying in lock-step with required min version specified in package
file.
we're specifying everything we need in the new phpcs config file now.
- declare PHP strict mode
- resolves all PHPUnit-related deprecations
- resolves all Faker-related deprecations
- strict mode
- type hints
- ditch pointless comments
according to the DTD, ConceptRelation::RelationName is an "implied"
attribute, which makes it optional.
meld it into Reference class, its only consumer.
…cks.

this will come in handy when testing Models with nullable attrs.
- add type hints where missing
- simplify paths via imports
- An vs a
- drop unnecessary function args where defaults suffice
- fix up code comments
courtesy of PHPStan lvl 5.
explanation: that local variable was never instantiated as a Reference
object, thus remaining NULL throughout parsing, thus the if conditional
was always evaluating to FALSE.
turns out that we don't need to local Referencevariable after all - we want to set concept
id (UI) and name directly on the Concept object. which we've been doing.
in sum - not a bugfix, just cleanup.
@stopfstedt
Copy link
Member Author

stefan@nichtsnutz: ~/dev/projects/mesh-parser on update_2024
$ php -dxdebug.mode=coverage bin/phpunit --coverage-text
PHPUnit 11.0.3 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.2-1+ubuntu22.04.1+deb.sury.org+1 with Xdebug 3.3.1
Configuration: /home/stefan/dev/projects/mesh-parser/phpunit.xml

................................................................. 65 / 65 (100%)


Time: 00:00.254, Memory: 14.00 MB

OK (65 tests, 427 assertions)

Generating code coverage report in HTML format ... done [00:00.065]


Code Coverage Report:       
  2024-02-13 23:17:43       
                            
 Summary:                   
  Classes: 100.00% (10/10)  
  Methods: 100.00% (105/105)
  Lines:   100.00% (331/331)

Ilios\MeSH\Model\AllowableQualifier
  Methods: 100.00% ( 4/ 4)   Lines: 100.00% (  4/  4)
Ilios\MeSH\Model\Concept
  Methods: 100.00% (18/18)   Lines: 100.00% ( 18/ 18)
Ilios\MeSH\Model\ConceptRelation
  Methods: 100.00% ( 6/ 6)   Lines: 100.00% (  6/  6)
Ilios\MeSH\Model\Descriptor
  Methods: 100.00% (34/34)   Lines: 100.00% ( 34/ 34)
Ilios\MeSH\Model\DescriptorSet
  Methods: 100.00% ( 6/ 6)   Lines: 100.00% (  8/  8)
Ilios\MeSH\Model\EntryCombination
  Methods: 100.00% ( 8/ 8)   Lines: 100.00% (  8/  8)
Ilios\MeSH\Model\Identifiable
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% (  2/  2)
Ilios\MeSH\Model\Reference
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% (  2/  2)
Ilios\MeSH\Model\Term
  Methods: 100.00% (20/20)   Lines: 100.00% ( 20/ 20)
Ilios\MeSH\Parser
  Methods: 100.00% ( 5/ 5)   Lines: 100.00% (229/229)

@stopfstedt stopfstedt marked this pull request as ready for review February 13, 2024 23:18
@stopfstedt stopfstedt requested a review from jrjohnson February 13, 2024 23:18
- package-ecosystem: composer
directory: "/"
schedule:
interval: daily
Copy link
Member

Choose a reason for hiding this comment

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

Given our infrequent release here I think weekly may be a better choice with less PRs to manage. I wonder if it's worth pulling in the update-dependencies and maybe adding auto merge as well to keep the number even lower?

Copy link
Member Author

Choose a reason for hiding this comment

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

changed to weekly and deps update workflow added ✔️

@@ -6,7 +6,7 @@
"Ilios",
"MeSH"
],
"homepage": "http://iliosproject.org/",
"homepage": "https://iliosproject.org/",
Copy link
Member

Choose a reason for hiding this comment

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

So secure!

const TREE_NUMBER = 'TreeNumber';
const TREE_NUMBER_LIST = 'TreeNumberList';
const YEAR = 'Year';
public const ABBREVIATION = 'Abbreviation';
Copy link
Member

Choose a reason for hiding this comment

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

I don't know that it matters, but are these public? I searched for a few of them and they seem to only be used in this class.

Copy link
Member Author

@stopfstedt stopfstedt Feb 13, 2024

Choose a reason for hiding this comment

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

PHPCS won't have it any other way. without an accessor, it will emit this warning:

Visibility must be declared on all constants if your project supports PHP 7.1 or later

Copy link
Member

Choose a reason for hiding this comment

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

I was assuming we'd go protected instead, but let's make that a next time problem.

Copy link
Member Author

Choose a reason for hiding this comment

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

this is a lateral shift, as these are public by default/without the accessor. don't see why not, the values can't be tampered with.

}

/**
* @param string $property
Copy link
Member

Choose a reason for hiding this comment

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

docblocks in this file are duplicates of declarations in the code. Just remove them?

Copy link
Member Author

Choose a reason for hiding this comment

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

done. ✔️

@@ -135,6 +135,8 @@ It contains all possible elements defined by the schema.
<CASN1Name>a casn1 name</CASN1Name>
<RegistryNumber>00000AAAAA</RegistryNumber>
<ScopeNote>a scope note</ScopeNote>
<TranslatorsEnglishScopeNote>something in English.</TranslatorsEnglishScopeNote>
<TranslatorsScopeNote>i got nothing</TranslatorsScopeNote>
Copy link
Member

Choose a reason for hiding this comment

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

zero points for creativity!

Copy link
Member Author

Choose a reason for hiding this comment

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

zero point zero

@stopfstedt stopfstedt requested a review from jrjohnson February 14, 2024 00:01
@jrjohnson jrjohnson merged commit 051a015 into ilios:master Feb 14, 2024
4 checks passed
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.

2 participants