tighten / tlint Goto Github PK
View Code? Open in Web Editor NEWTighten linter for Laravel conventions.
License: MIT License
Tighten linter for Laravel conventions.
License: MIT License
$factory->define(App\SavedVehicle::class, function (Faker\Generator $faker) {
return [
'user_id' => factory(App\User::class),
'version_id' => factory(\App\JATO\Version::class),
];
});
No need to be dependant on these:
Using PHP 7.1.11
If you need any other info, let me know. This is a great package, will look to send you some PRs soon!
PHP Fatal error: Uncaught Error: Call to undefined method PhpParser\Node\Expr\Variable::toString() in /Users/macbook/.composer/vendor/loganhenson/tlint/src/Linters/NoParensEmptyInstantiations.php:24
Stack trace:
#0 /Users/macbook/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php(41): Tighten\Linters\NoParensEmptyInstantiations->Tighten\Linters\{closure}(Object(PhpParser\Node\Expr\New_))
#1 /Users/macbook/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(115): PhpParser\NodeVisitor\FindingVisitor->enterNode(Object(PhpParser\Node\Expr\New_))
#2 /Users/macbook/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(197): PhpParser\NodeTraverser->traverseNode(Object(PhpParser\Node\Stmt\Return_))
#3 /Users/macbook/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(108): PhpParser\NodeTraverser->traverseArray(Array)
#4 /Users/macbook/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(197): PhpParser\NodeTraverser->traverseNode(Object(PhpParser\Node in /Users/macbook/.composer/vendor/loganhenson/tlint/src/Linters/NoParensEmptyInstantiations.php on line 24
Fatal error: Uncaught Error: Call to undefined method PhpParser\Node\Expr\Variable::toString() in /Users/macbook/.composer/vendor/loganhenson/tlint/src/Linters/NoParensEmptyInstantiations.php on line 24
Error: Call to undefined method PhpParser\Node\Expr\Variable::toString() in /Users/macbook/.composer/vendor/loganhenson/tlint/src/Linters/NoParensEmptyInstantiations.php on line 24
Call Stack:
0.0003 357824 1. {main}() /Users/macbook/.composer/vendor/loganhenson/tlint/bin/tlint:0
0.0315 1606216 2. Symfony\Component\Console\Application->run() /Users/macbook/.composer/vendor/loganhenson/tlint/bin/tlint:34
0.0511 1855152 3. Symfony\Component\Console\Application->doRun() /Users/macbook/.composer/vendor/symfony/console/Application.php:148
0.0515 1857944 4. Symfony\Component\Console\Application->doRunCommand() /Users/macbook/.composer/vendor/symfony/console/Application.php:240
0.0515 1857944 5. Tighten\Commands\LintCommand->run() /Users/macbook/.composer/vendor/symfony/console/Application.php:938
0.0517 1859352 6. Tighten\Commands\LintCommand->execute() /Users/macbook/.composer/vendor/symfony/console/Command/Command.php:252
12.7301 9493792 7. Tighten\Commands\LintCommand->lintFile() /Users/macbook/.composer/vendor/loganhenson/tlint/src/Commands/LintCommand.php:203
12.7699 10092120 8. Tighten\TLint->lint() /Users/macbook/.composer/vendor/loganhenson/tlint/src/Commands/LintCommand.php:89
12.7699 10092816 9. Tighten\Linters\NoParensEmptyInstantiations->lint() /Users/macbook/.composer/vendor/loganhenson/tlint/src/TLint.php:27
12.7730 10085784 10. PhpParser\NodeTraverser->traverse() /Users/macbook/.composer/vendor/loganhenson/tlint/src/Linters/NoParensEmptyInstantiations.php:30
12.7730 10085784 11. PhpParser\NodeTraverser->traverseArray() /Users/macbook/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:85
12.7730 10086208 12. PhpParser\NodeTraverser->traverseNode() /Users/macbook/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:197
12.7730 10086304 13. PhpParser\NodeTraverser->traverseArray() /Users/macbook/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:108
12.7731 10087784 14. PhpParser\NodeTraverser->traverseNode() /Users/macbook/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:197
12.7732 10087984 15. PhpParser\NodeTraverser->traverseArray() /Users/macbook/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:108
12.7732 10088408 16. PhpParser\NodeTraverser->traverseNode() /Users/macbook/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:197
12.7732 10088792 17. PhpParser\NodeTraverser->traverseArray() /Users/macbook/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:108
12.7734 10090496 18. PhpParser\NodeTraverser->traverseNode() /Users/macbook/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:197
12.7734 10090520 19. PhpParser\NodeVisitor\FindingVisitor->enterNode() /Users/macbook/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:115
12.7734 10090520 20. Tighten\Linters\NoParensEmptyInstantiations->Tighten\Linters\{closure}() /Users/macbook/.composer/vendor/nikic/php-parser/lib/PhpParser/NodeVisitor/FindingVisitor.php:41
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class Purchase extends Model
{
public const CASH = 'cash';
public const FINANCE = 'finance';
public const LEASE = 'lease';
protected $guarded = [
'id',
];
class Purchase extends Model
{
public const CASH = 'cash';
public const FINANCE = 'finance';
public const LEASE = 'lease';
protected $guarded = [
'id',
];
Working as intended (triggers lint)
echo "$a";
Not working as intended (does not trigger lint)
echo "$object->prop";
Is it possible to specify rules to check for (via config file or parameters, like other lint tools do)?
values missing or unused
{{-- This comment will not be present in the rendered HTML --}}
If embedded in a string and is not the first part of a string sequence, the lint is not triggered.
Review: ! You should not mix restful and non-restful methods in a controller
Should have another rule to limit actions to <= 4 for non-restful (restful is limited to 7 by REST method count)
general default is (but this is not hard and fast rules)
Definite rule of “never use interpolation without braces”
The argument against interpolation without braces being that it’s just not very clear.
example: /public/mix-manifest.json
git diff --name-only --diff-filter=ACMRTUXB
Needs opinion:
$thing = '';
echo "a $thing";
echo "a " . $thing;
echo "a {$thing}";
The linter throws the following exception when running:
PS D:\Users\projects\abc> tlint
In ClassThingsOrder.php line 79:
Unknown statement
lint [--diff] [--json] [--] [<file or directory>]
PS D:\Users\Shantanu\projects\abc>
1 space between render braces and their content
{{ $x }}
{!! $x !!}
PHP Fatal error: Uncaught Error: Call to undefined function Tighten\Linters\str_contains() in /Users/jose/.composer/vendor/tightenco/tlint/src/Linters/NoStringInterpolationWithoutBraces.php:26
https://laravel.com/docs/5.8/upgrade#string-and-array-helpers
You should not mix restful and non-restful methods in a controller
<?php
namespace App\Http\Controllers;
use App\Data\Models\Profession;
class ProfessionController extends Controller
{
public function show($slug)
{
return view('professions.show')
->with('profession', Profession::where('slug', $slug)->firstOrFail())
->with('professions', Profession::all());
}
}
Makes global installation easier.
Cache::has("{$this->user_id}.accessed.{$slug}");
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.