Skip to content

Commit 63b4f19

Browse files
authored
Merge pull request #34 from invokable/devin/1733103292-install-laravel-pint
Install Laravel Pint and Setup Code Style Automation
2 parents 5f061e0 + f6967e1 commit 63b4f19

15 files changed

+120
-78
lines changed

.github/workflows/lint.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: linter
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- main
8+
pull_request:
9+
branches:
10+
- develop
11+
- main
12+
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
quality:
18+
runs-on: ubuntu-latest
19+
environment: Testing
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Setup PHP
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: '8.4'
27+
28+
- name: Install Dependencies
29+
run: |
30+
composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
31+
32+
- name: Run Lint
33+
run: vendor/bin/pint --test
34+
35+
# - name: Commit Changes
36+
# uses: stefanzweifel/git-auto-commit-action@v5
37+
# with:
38+
# commit_message: fix code style
39+
# commit_options: '--no-verify'
40+
# file_pattern: |
41+
# **/*
42+
# !.github/workflows/*

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
},
1515
"require-dev": {
1616
"orchestra/testbench": "^10.0",
17-
"pulkitjalan/google-apiclient": "^6.2"
17+
"pulkitjalan/google-apiclient": "^6.2",
18+
"laravel/pint": "^1.22"
1819
},
1920
"autoload": {
2021
"psr-4": {

lib/google/Exceptions/UnknownServiceException.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@
22

33
namespace Revolution\Google\Client\Exceptions;
44

5-
class UnknownServiceException extends \Exception
6-
{
7-
}
5+
class UnknownServiceException extends \Exception {}

lib/google/GoogleApiClient.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ protected function auth(string $userEmail = ''): void
9393
/**
9494
* Determine and use credentials if user has set them.
9595
*
96-
* @param string $userEmail
9796
* @return bool used or not
9897
*/
9998
protected function useAssertCredentials(string $userEmail = ''): bool
@@ -116,8 +115,6 @@ protected function useAssertCredentials(string $userEmail = ''): bool
116115
/**
117116
* Magic call method.
118117
*
119-
* @param string $method
120-
* @param array $parameters
121118
* @return mixed
122119
*
123120
* @throws BadMethodCallException

pint.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"preset": "laravel",
3+
"rules": {
4+
"no_unused_imports": false
5+
}
6+
}

src/Concerns/SheetsValues.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ trait SheetsValues
1919
protected ?string $majorDimension = null;
2020

2121
protected ?string $valueRenderOption = null;
22+
2223
protected ?string $dateTimeRenderOption = null;
2324

2425
public function all(): array
@@ -45,10 +46,10 @@ public function update(array $value, string $valueInputOption = 'RAW'): BatchUpd
4546
{
4647
$range = $this->ranges();
4748

48-
$batch = new BatchUpdateValuesRequest();
49+
$batch = new BatchUpdateValuesRequest;
4950
$batch->setValueInputOption($valueInputOption);
5051

51-
$valueRange = new ValueRange();
52+
$valueRange = new ValueRange;
5253
$valueRange->setValues($value);
5354
$valueRange->setRange($range);
5455

@@ -61,7 +62,7 @@ public function clear(): ?ClearValuesResponse
6162
{
6263
$range = $this->ranges();
6364

64-
$clear = new ClearValuesRequest();
65+
$clear = new ClearValuesRequest;
6566

6667
return $this->serviceValues()->clear($this->getSpreadsheetId(), $range, $clear);
6768
}
@@ -71,7 +72,7 @@ public function append(array $values, string $valueInputOption = 'RAW', string $
7172
$range = $this->ranges();
7273
$orderedValues = $this->orderAppendables($values);
7374

74-
$valueRange = new ValueRange();
75+
$valueRange = new ValueRange;
7576
$valueRange->setValues($orderedValues);
7677
$valueRange->setRange($range);
7778

src/Facades/Sheets.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ class Sheets extends Facade
4848
{
4949
/**
5050
* Get the registered name of the component.
51-
*
52-
* @return string
5351
*/
5452
protected static function getFacadeAccessor(): string
5553
{

src/SheetsClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515

1616
class SheetsClient implements Factory
1717
{
18-
use Concerns\SheetsValues;
18+
use Concerns\SheetsCollection;
1919
use Concerns\SheetsDrive;
2020
use Concerns\SheetsProperties;
21-
use Concerns\SheetsCollection;
21+
use Concerns\SheetsValues;
2222
use Conditionable;
2323
use Macroable {
2424
__call as macroCall;

tests/ClientTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@
1111

1212
class ClientTest extends TestCase
1313
{
14-
public function tearDown(): void
14+
protected function tearDown(): void
1515
{
1616
m::close();
1717

1818
parent::tearDown();
1919
}
2020

21-
public function testClientGetter()
21+
public function test_client_getter()
2222
{
2323
$client = m::mock(GoogleApiClient::class, [[]])->makePartial();
2424

2525
$this->assertInstanceOf('Google\Client', $client->getClient());
2626
}
2727

28-
public function testClientGetterWithAdditionalConfig()
28+
public function test_client_getter_with_additional_config()
2929
{
3030
$client = m::mock(GoogleApiClient::class, [[
3131
'config' => [
@@ -36,14 +36,14 @@ public function testClientGetterWithAdditionalConfig()
3636
$this->assertEquals('test', $client->getClient()->getConfig('subject'));
3737
}
3838

39-
public function testServiceMake()
39+
public function test_service_make()
4040
{
4141
$client = m::mock(GoogleApiClient::class, [[]])->makePartial();
4242

4343
$this->assertInstanceOf('Google\Service\Storage', $client->make('storage'));
4444
}
4545

46-
public function testServiceMakeException()
46+
public function test_service_make_exception()
4747
{
4848
$client = m::mock(GoogleApiClient::class, [[]])->makePartial();
4949

@@ -52,7 +52,7 @@ public function testServiceMakeException()
5252
$client->make('storag');
5353
}
5454

55-
public function testMagicMethodException()
55+
public function test_magic_method_exception()
5656
{
5757
$client = new GoogleApiClient([]);
5858

@@ -61,14 +61,14 @@ public function testMagicMethodException()
6161
$client->getAuthTest();
6262
}
6363

64-
public function testNoCredentials()
64+
public function test_no_credentials()
6565
{
6666
$client = new GoogleApiClient([]);
6767

6868
$this->assertFalse($client->isUsingApplicationDefaultCredentials());
6969
}
7070

71-
public function testDefaultCredentials()
71+
public function test_default_credentials()
7272
{
7373
$client = new GoogleApiClient([
7474
'service' => [

tests/SheetsCollectionTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class SheetsCollectionTest extends TestCase
88
{
9-
public function testCollection()
9+
public function test_collection()
1010
{
1111
$header = ['id', 'name', 'mail'];
1212
$rows = [
@@ -19,7 +19,7 @@ public function testCollection()
1919
$this->assertEquals('name1', $collection->first()['name']);
2020
}
2121

22-
public function testCollection2()
22+
public function test_collection2()
2323
{
2424
$header = ['id', 'name', 'mail'];
2525
$rows = [
@@ -32,7 +32,7 @@ public function testCollection2()
3232
$this->assertNotNull($collection->last()['mail']);
3333
}
3434

35-
public function testCollection3()
35+
public function test_collection3()
3636
{
3737
$rows = collect([
3838
['id', 'name', 'mail'],

tests/SheetsDriveTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class SheetsDriveTest extends TestCase
2121
*/
2222
protected $files;
2323

24-
public function setUp(): void
24+
protected function setUp(): void
2525
{
2626
parent::setUp();
2727

@@ -32,7 +32,7 @@ public function setUp(): void
3232
Sheets::setDriveService($this->service);
3333
}
3434

35-
public function testList()
35+
public function test_list()
3636
{
3737
$file = new DriveFile([
3838
'id' => 'id',
@@ -50,7 +50,7 @@ public function testList()
5050
$this->assertSame(['id' => 'name'], $list);
5151
}
5252

53-
public function testNull()
53+
public function test_null()
5454
{
5555
Google::shouldReceive('make')->andReturn($this->service);
5656

tests/SheetsMacroTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class SheetsMacroTest extends TestCase
88
{
9-
public function testMacro()
9+
public function test_macro()
1010
{
1111
Sheets::macro('test', function () {
1212
return 'test';
@@ -19,7 +19,7 @@ public function testMacro()
1919
$this->assertSame('test', $test);
2020
}
2121

22-
public function testMacroException()
22+
public function test_macro_exception()
2323
{
2424
$this->expectException(\BadMethodCallException::class);
2525

0 commit comments

Comments
 (0)