Method testPassAndCriticalCrewDoNotOverlap
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testPassAndCriticalCrewDoNotOverlap(Analyst $analyst)
{
$this->assertNotEmpty($analyst->getCrew());
$analyst->getMissions()->eachAway(
function (Mission $mission) {
- Create a ticketCreate a ticket
Method testCadetCrew
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testCadetCrew(array $crew)
{
$missions = $this->wiki->missions()->get('cadet');
foreach ($crew['cadet'] as $idxCh => $challenge) {
foreach ($challenge as $idxMis => $mission) {
- Create a ticketCreate a ticket
Method testRateStep
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testRateStep()
{
$analyst
= new Analyst($this->wiki->missions(), $this->wiki->crew());
- Create a ticketCreate a ticket
Method testEpisodeCrew
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testEpisodeCrew(array $crew)
{
$missions = $this->wiki->missions()->get('episodes');
foreach ($crew['episodes'] as $idxEpi => $episode) {
foreach ($episode as $idxMis => $mission) {
- Create a ticketCreate a ticket
Function testCadetCrew
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function testCadetCrew(array $crew)
{
$missions = $this->wiki->missions()->get('cadet');
foreach ($crew['cadet'] as $idxCh => $challenge) {
foreach ($challenge as $idxMis => $mission) {
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function testEpisodeCrew
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function testEpisodeCrew(array $crew)
{
$missions = $this->wiki->missions()->get('episodes');
foreach ($crew['episodes'] as $idxEpi => $episode) {
foreach ($episode as $idxMis => $mission) {
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method testRateStepCadet
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testRateStepCadet()
{
$analyst
= new Analyst($this->wiki->missions(), $this->wiki->crew());
- Create a ticketCreate a ticket
Avoid using static access to class '\eidng8\Log\Log' in method 'testCrossRating'. Open
Log::forTest();
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}