dbudwin/RoboHome-Web

View on GitHub

Showing 76 of 76 total issues

Avoid unused parameters such as '$schedule'.
Open

protected function schedule(Schedule $schedule): void
Severity: Minor
Found in app/Console/Kernel.php by phpmd

The method testDevices_GivenUserLoggedIn_EditsDevice_DevicesUpdatedOnPage() has 34 lines of code. Current threshold is set to 25. Avoid really long methods.
Open

public function testDevices_GivenUserLoggedIn_EditsDevice_DevicesUpdatedOnPage(): void
{
$this->browse(function (Browser $browser) {
$deviceName = self::$faker->word();
$deviceDescription = self::$faker->sentence();
Severity: Minor
Found in tests/Browser/DevicesTest.php by phpmd

The method testMqtt_GivenUserWithInfoScope_ReturnsMqttSettings() has 31 lines of code. Current threshold is set to 25. Avoid really long methods.
Open

public function testMqtt_GivenUserWithInfoScope_ReturnsMqttSettings(): void
{
$user = factory(User::class)->make();
$publicUserId = $user->public_id;
 
 

The method testHtmlDataAttributesForSpecificDeviceProperties_GivenDeviceAddedToDatabase_AttributesMatchNameAndValueOfAddedDevice() has 25 lines of code. Current threshold is set to 25. Avoid really long methods.
Open

public function testHtmlDataAttributesForSpecificDeviceProperties_GivenDeviceAddedToDatabase_AttributesMatchNameAndValueOfAddedDevice(): void
{
foreach ($this->deviceTypeConstants() as $specificDeviceType) {
$addedDevice = $this->addDeviceToDatabase($specificDeviceType);
$specificDevice = $this->addSpecificDevice($addedDevice->id, $specificDeviceType);
Severity: Minor
Found in tests/Unit/Model/DeviceTest.php by phpmd

The method assertDiscoverAppliancesResponse() has 30 lines of code. Current threshold is set to 25. Avoid really long methods.
Open

private function assertDiscoverAppliancesResponse(TestResponse $response, Collection $devices): void
{
$appliances = [];
 
for ($i = 0; $i < $devices->count(); $i++) {

The method testDevices_GivenUserLoggedIn_ViewContainsUsersDevices() has 30 lines of code. Current threshold is set to 25. Avoid really long methods.
Open

public function testDevices_GivenUserLoggedIn_ViewContainsUsersDevices(): void
{
$user = $this->makeUser();
$deviceName = self::$faker->word();
$deviceDescription = self::$faker->sentence();

The method testDevices_GivenUserLoggedIn_ClicksEditDeviceButton_OpensEditDeviceModal() has 30 lines of code. Current threshold is set to 25. Avoid really long methods.
Open

public function testDevices_GivenUserLoggedIn_ClicksEditDeviceButton_OpensEditDeviceModal(): void
{
$this->browse(function (Browser $browser) {
$deviceName = self::$faker->word();
$deviceDescription = self::$faker->sentence();
Severity: Minor
Found in tests/Browser/DevicesTest.php by phpmd

Avoid using App\Http\Controllers\API\count() function in for loops.
Open

for ($i = 0; $i < count($devicesForCurrentUser); $i++) {
$appliance = [
'actions' => $actions,
'additionalApplianceDetails' => (object)[],
'applianceId' => $devicesForCurrentUser[$i]->id,

Avoid using Tests\Unit\Model\sizeof() function in for loops.
Open

for ($i = 0; $i < sizeof($attributeNames); $i++) {
$this->assertEquals($specificDeviceProperties[$i], $attributeNames[$i]);
$this->assertEquals($specificDevice->{$attributeNames[$i]}, $attributeValues[$i]);
}
Severity: Minor
Found in tests/Unit/Model/DeviceTest.php by phpmd

Line exceeds 120 characters; contains 134 characters
Open

return $this->redirectToDevicesWithMessage($request, FlashMessageLevels::SUCCESS, "Device '$name' was successfully deleted!");

Line exceeds 120 characters; contains 136 characters
Open

$this->mockDeviceRepository->shouldReceive('getForPublicId')->with(Mockery::on(function (Uuid $argument) use ($publicDeviceId) {

Line exceeds 120 characters; contains 128 characters
Open

$this->mockDeviceRepository->shouldReceive('getForPublicId')->with(Mockery::on(function (Uuid $argument) use ($device) {

Line exceeds 120 characters; contains 126 characters
Open

Route::post('/devices/info', 'API\DevicesController@info')->name('info')->middleware('scope:info', 'apiVerifyUserOwnsDevice');
Severity: Minor
Found in routes/api.php by phpcodesniffer

Line exceeds 120 characters; contains 144 characters
Open

->whenAvailable('#edit-device-modal', function ($modal) use ($deviceName, $deviceDescription, $onCode, $offCode, $pulseLength) {

Line exceeds 120 characters; contains 148 characters
Open

return $this->redirectToDevicesWithMessage($request, FlashMessageLevels::DANGER, "Encountered an error while deleting device '$name'!");

Line exceeds 120 characters; contains 122 characters
Open

$mockDeviceRepository->shouldReceive('getForPublicId')->with(Mockery::on(function (Uuid $argument) use ($device) {

Line exceeds 120 characters; contains 128 characters
Open

$attributeName = substr($htmlAttributePieces[0], strlen($htmlAttributeDataPrefix), $htmlAttributeRawNameLength);

Line exceeds 120 characters; contains 154 characters
Open

public function __construct(IDeviceRepository $deviceRepository, IDeviceActionInfoBroker $deviceInformationBroker, MessagePublisher $messagePublisher)

Line exceeds 120 characters; contains 122 characters
Open

return $this->redirectToDevicesWithMessage($request, FlashMessageLevels::DANGER, 'Error controlling device!');

Line exceeds 120 characters; contains 121 characters
Open

->shouldReceive('getAttribute')->with('public_id')->atLeast()->once()->andReturn(self::$faker->randomDigit())
Severity
Category
Status
Source
Language