GithubHelp home page GithubHelp logo

tighten / duster Goto Github PK

View Code? Open in Web Editor NEW
357.0 13.0 13.0 375.11 MB

Automatic configuration for Laravel apps to apply Tighten's standard linting & code standards.

License: MIT License

PHP 99.58% Blade 0.20% JavaScript 0.17% Shell 0.06%
codequality formatter laravel linter php

duster's People

Contributors

arielmejiadev avatar benholmen avatar driftingly avatar gummibeer avatar jerredhurst avatar jonsugar avatar mattstauffer avatar musa11971 avatar rigby90 avatar rissajackson avatar svenluijten avatar tonysm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

duster's Issues

After updating, option --dirty stopped working.

I had updated (in composer.json i have ^2.0) the package and now on every call of the duster with --dirty option, it gives me error that to use that option, Git must exists. However I am running that inside of a docker container, which was working before update issued and which still have the git executable and also the repository is still okay, nothing changed at all, only the composer update was called, and from that time, i cannot use the --dirty switch.

What could be the cause? I would love to believe that this is mistake of mine, but so far as I can see it doesn't seem to. 😞

Multiple errors when running duster

I just installed Duster for the first time in a Laravel 9 + PHP 8.2 app that already has some phpcs rules enforced, so it's quite clean already. First of all phpcs gets through some of the code, but then crashes:

In MailableMethodsInBuild.php line 89:
                                                      
  Undefined property: PhpParser\Node\Stmt\Nop::$expr  
                                                      

format [--diff] [--only ONLY] [--] [<file or directory>]

It then goes on to run PHP_CodeSniffer tasks, but immediately dies again showing many errors and spewing random source snippets. Too many errors to post here, but it starts like this:

                                                                                  Linting using PHP_CodeSniffer                                                                                  

&& $i === $this->tokens[$i]['parenthesis_opener']
) {
$i = $this->tokens[$i]['parenthesis_closer'];
} else if (
In Runner.php line 608:
                                                                                                                                                                                                
  include(phar:///Users/marcus/Sites/myapp/vendor/tightenco/duster/builds/duster/vendor/squizlabs/php_codesniffer/src/Files/File.php): Failed to open stream: phar error: internal corr  
  uption of phar "/Users/marcus/Sites/myapp/vendor/tightenco/duster/builds/duster" (crc32 mismatch on file "vendor/squizlabs/php_codesniffer/src/Files/File.php") in phar:///Users/marc  
  us/Sites/myapp/vendor/tightenco/duster/builds/duster/vendor/squizlabs/php_codesniffer/autoload.php on line 169                                                                         
                                                                                                                                                                                                

kens[$prev]['code'] === T_USE) {

return true;
}
}
}

While that crc mismatch suggests a corrupted file, these problems have persisted even after a composer reinstall '*'. All this happens pretty much the same way with both lint and fix commands.

Any idea why this is breaking?

Re-work bin scripts

Instead of duster-fix and duster-phpcs-fix, let's do duster fix and duster phpcs fix

Teach IDEs to look at our vendor PHPCS file for auto linting?

One of the big benefits of going with PHPCS is getting the thing where the IDE reads it and gives you inline linting that matches up with your spec.

But.. we have to figure out how to make the config files available to the IDEs, since they're in the vendor folder, not root.

I've been trying to avoid a workflow that requires every user to publish config files into their root; is there any other way to do it?

I'd like to solve at least PHPStorm and VS Code, and Sublime would be nice too.

--dirty flag gets stuck

On PHP 8.2.4 and latest Duster, using --dirty seems to get stuck:
Screenshot from 2023-04-08 14-40-05

Not sure if this is related to #96, didn't think so since it's not running at all instead of not processing anything.

I definitely have dirty files in the current context. Running without the dirty flag processes them just fine.

duster with sail ?

Hello,

I used Sail to run localy my projet.
I have install your package but I can't not run duster with Sail.... I try "./vendor/bin/sail duster lint" but is not working : "No such command: duster"

composer dump-autoload - no such file or directory

There seems to be an issue with files line in composer.json:

    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Database\\Factories\\": "database/factories/",
            "Database\\Seeders\\": "database/seeders/"
        },
        "files": [
            "./vendor/squizlabs/php_codesniffer/autoload.php"
        ]
    },

after composer i or composer dump-autoload I get an error:


  require(/var/www/html/vendor/composer/../tightenco/duster/vendor/squizlabs/php_codesniffer/autoload.php): Failed to open stream: No such file or directory  

Drop PHP-CS-Fixer?

It seems that PHPCBF has come a long way since Tighten decided to use PHPCS for sniffing and PHP-CS-Fixer for fixing.

Maintaining two standards has been a pain in the butt.

I've been hearing more and more people say that they've been happy with just PHPCS and PHPCBF.

Thoughts:

  • Only upholding and supporting one standard would make Duster and Tighten projects much simpler
  • Having our main sniffer and our main fixer be the same tool and standard would be lovely
  • If we discover that there are lints that are missing from PHPCS/PHPCBF that PHP-CS-Fixer offer, I could be a part of helping making them available to the PHPCS world
  • I hate XML for config and the fact that PHP-CS-Fixer uses PHP is one of the best things about it, but we can't pick a tool JUST because I hate XML

Any strong opinions?

Additional script is timing out (Symfony\Component\Process\Process 60 sec. timeout)

Upon execution in the GitLab CI pipeline, the Symfony\Component\Process\Process is timing out with an additional linting script (PHPStan).

Terminal output:

                             Linting using phpstan                              
Note: Using configuration file /builds/namespace/app/app/phpstan.neon.
   0/298 [β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘]   0%
  20/298 [β–“β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘]   6%
In Process.php line 1152:
                                                                               
  The process "'./vendor/bin/phpstan' 'analyse' '--memory-limit=512M'" exceeded the timeout of 60 seconds.       

duster.json:

{
	"scripts": {
		"lint": {
			"phpstan": ["./vendor/bin/phpstan", "analyse", "--xdebug", "--memory-limit=512M"]
		}
	}
}

Is there anyway to disable or overwrite this timeout? Some linting may take a while, especially with a huge codebase running in a low capacity CI runner.

Husky hook fail

Husky hook fail

Hi I followed all the instruction from the following article:

Maybe it could be something pretty simple in the configuration from my side, so I share my files content:

.husky/pre-commit

#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install lint-staged

package.json

{
    "private": true,
    "type": "module",
    "scripts": {
        "dev": "vite",
        "build": "vite build",
        "prepare": "husky install"
    },
    "devDependencies": {
        "axios": "^1.1.2",
        "laravel-vite-plugin": "^0.7.5",
        "vite": "^4.0.0",
        "husky": "^8.0.0"
    },
    "lint-staged": {
        "**/*.php*": [
            "vendor/bin/duster lint"
        ]
    }
}

The output on the command line is:

husky - pre-commit hook exited with code 1 (error)

Exclude parameter in duster.json not working with GLOB pattern

Hi All,

First of all, very nice tool. Combining all of the various PHP code stylers together is awesome.

Problem

I've been trying to migrate our old setup to duster but can't get our GLOB pattern matching to work.

Let's say I have these files:
path/to/folderToExclude/index.php
path/to/folderToExclude/helper.php
path/to/folderToExclude/db.php

With the following exclude block (including glob), I'd expect all files to be excluded from duster:

// snippet from duster.json in root of project
"exclude": [
        "**/folderToExclude/**"
    ],

When I run duster, however, it runs over all of the files listed above. I've tried a couple of variations and only the following seems to work (with exact path to a folder):

// snippet from duster.json in root of project
"exclude": [
        "path/to/folderToExclude/"
    ],

Question

Is this behaviour intended or am I doing something wrong?

Look into adding JS and CSS dusting

The readme mentions the possibility of adding these in the future.
Both could be accomplished by Prettier.

Need to decide on defaults and add easy overrides.

[HELP] I don't understand how to customize and configure PhpStorm.

Hi, thanks for the tool, it's very handy!

I'm following the docs and trying to add some customizations as well as configuring my IDE (PhpStorm) to with with PhpCodeSniffer and PHP-CS-Fixer but I'm having some trouble.

For PhpCodeSniffer I went ahead and created the .phpcs.xml.dist file as the docs says but when I enable PhpCodeSniffer for PhpStorm I get the error: phpcs: ERROR: Referenced sniff "Tighten" does not exist.

For PHP-CS-Fixer I also created the file .php-cs-fixer.dist.php as the docs says but then I get all sorts of errors since classes like App\Support\PhpCsFixer and App\Fixer\ClassNotation\CustomPhpUnitOrderFixer don't exist.

I wonder what am I doing wrong and if you can share some light?

Thanks!

GitHub Action can't find Tighten sniff

I keep getting the following error for my PHPCS GitHub Action.

ERROR: Referenced sniff "Tighten" does not exist

I've only made minor changes to the files. (Update to PHP 8.0, adding composer auth.json, ignoring a few rules)

Here is my liny.yml and my .phpcs.xml.dist files:

lint.yml
name: Lint

on:
    push:
        branches: [ main ]
    pull_request:

jobs:
    phpcs:
        name: PHPCS

        runs-on: ubuntu-latest

        steps:
            - uses: actions/checkout@v2

            - name: Setup PHP
              uses: shivammathur/setup-php@v2
              with:
                  php-version: '8.0'
                  extensions: posix, dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
                  coverage: none

            - name: Add HTTP basic auth credentials
              run: echo '${{ secrets.COMPOSER_AUTH_JSON }}' > $GITHUB_WORKSPACE/auth.json

            - name: Install dependencies
              run: composer install --no-interaction --no-suggest --ignore-platform-reqs

            - name: PHPCS lint
              uses: chekalsky/phpcs-action@v1
              with:
                phpcs_bin_path: './vendor/bin/phpcs'

    tlint:
        name: TLint

        continue-on-error: false

        runs-on: ubuntu-latest

        steps:
            - uses: actions/checkout@v1

            - name: Setup PHP
              uses: shivammathur/setup-php@v2
              with:
                  php-version: '8.0'
                  extensions: posix, dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
                  coverage: none

            - name: Add HTTP basic auth credentials
              run: echo '${{ secrets.COMPOSER_AUTH_JSON }}' > $GITHUB_WORKSPACE/auth.json

            - name: Install dependencies
              run: composer install --no-interaction --no-suggest --ignore-platform-reqs

            - name: Tlint Lint
              run: vendor/bin/tlint
.phpcs.xml.dist
<?xml version="1.0"?>
<ruleset>
    <file>app</file>
    <file>config</file>
    <file>database</file>
    <file>public</file>
    <file>resources</file>
    <file>routes</file>
    <file>tests</file>

    <rule ref="Tighten"/>

    <rule ref="PSR1.Files.SideEffects">
        <exclude-pattern>public/index.php</exclude-pattern>
    </rule>
    <rule ref="PSR1.Methods.CamelCapsMethodName">
        <exclude-pattern>*</exclude-pattern>
    </rule>
    <rule ref="Squiz.Classes.ValidClassName">
        <exclude-pattern>REDACTED.php</exclude-pattern>
    </rule>

</ruleset>

No worries if you guys can't help. Been hacking on this for a while and can't seem to figure out the issue.

Thanks in advance!

Tlint configuration is ignored on fix

I am currently facing an issue while trying to run Duster with a specific Tlint configuration. I have noticed that this configuration only seems to work during Lint operations and does not display any errors. However, when running fix, it ignores the configuration and changes all views from $view->with('var', $foo) to view(..., ['var' => $foo]). Although I prefer the latter, I have a challenge with this approach since it adds all the parameters on a single line, making it difficult to read when dealing with more than four-ish variables, is there any way to make a new line instead?

The Tlint configuration:

tlint.json
{
    "preset": "laravel",
    "disabled": ["ArrayParametersOverViewWith"]
}

Could you please provide guidance on how to resolve this issue?

Thanks in advance.

Whitespace around re-ordered class properties and constants is incorrect

Anecdotally I'm noticing that this:

class Foo
{
    protected $foo = 'bar';
    public $bar = 'baz';
    public const FOO = 'bar';
    protected $bar = 'baz';
}

Is formatted to this:

class Foo
{
    public const FOO = 'bar';
    public $bar = 'baz';

    protected $foo = 'bar';
    protected $bar = 'baz';
}

The whitespace around/between properties and constants that get reordered isn't always consistent. Happy to work on this myself when I have time next week.

Custom rules?

Is there any support nearby for add custom rules?
Because I want to create new rule that can add missing type hints to functions and arguments like the ones that I was using in Rector

Duster Tlint & PHP Code sniffer are working in Gihub action but not on terminal

Config

  • PHP - 8.1.18
  • Composer - 2.5.5

Problem

In the terminal, it looks like Tlint and PHP Code sniffer simply skip all the files. But in the Gihub action, it shows all the linting errors.

Here is a terminal screenshot. Check the 1st two commands. Empty run no errors.

image

Here is Github Action. You can see that there are lint errors

image

I tried to run it on another 2 Macs. It is working on 1 Mac and the same empty things as me on another Mac. Configuration is the same across systems. Do let me know if you need more information.

Installed the package but unable to configure phpcs on PHPStorm.

I've installed the package and it works great!

I understand it comes with phpcs and other tools so I've trying to integrate those into my IDE (PHPStorm).

I've configured phpcs but unabled to set/find the ruleset.xml file under the vendor/tightenco directory.

One of the things I've tried was to copy the ruleset.xml under https://github.com/tighten/duster/blob/2.x/standards/Tighten/ruleset.xml but I believe that's not the idean solution I most likely have to be doing something wrong.

Any help is much appreciated!

Thanks!
Jose

Screenshot 2023-07-12 at 10 20 03 PM
Screenshot 2023-07-12 at 10 19 22 PM
Screenshot 2023-07-12 at 10 19 13 PM

Duster execution error

Hello everybody.

I'm starting with duster, I installed it in my application as explained on github, but when I run any duster action in the terminal, I get an error, like the print below:

image

Already tried :
.\duster github-actions
It gives error saying it is not a cmlet

.\vendor\bin\duster github-actions
says there is no file or directory.

image

can you help me?

Duster ignring configuration added in .php-cs-fixer.dist.php

Thanks for building this tool.

I wanted to disable the no_superfluous_phpdoc_tags rule of PhpCsFixer.

As per the docs, I created a .php-cs-fixer.dist.php file in the root of the project, with the contents from Duster's .php-cs-fixer.dist.php, making it something like:

<?php

use App\Fixer\ClassNotation\CustomControllerOrderFixer;
use App\Fixer\ClassNotation\CustomOrderedClassElementsFixer;
use App\Fixer\ClassNotation\CustomPhpUnitOrderFixer;
use App\Support\PhpCsFixer;
use PhpCsFixer\Config;

return (new Config())
    ->setFinder(PhpCsFixer::getFinder())
    ->setUsingCache(false)
    ->registerCustomFixers([
        new CustomControllerOrderFixer(),
        new CustomOrderedClassElementsFixer(),
        new CustomPhpUnitOrderFixer(),
    ])
    ->setRules([
        'Tighten/custom_controller_order' => true,
        'Tighten/custom_ordered_class_elements' => [
            'order' => [
                'use_trait',
                'case',
                'property_public_static',
                'property_protected_static',
                'property_private_static',
                'constant_public',
                'constant_protected',
                'constant_private',
                'property_public',
                'property_protected',
                'property_private',
                'construct',
                'method:__invoke',
                'method_public_static',
                'method_protected_static',
                'method_private_static',
                'method_public',
                'method_protected',
                'method_private',
                'magic',
            ],
        ],
        'Tighten/custom_phpunit_order' => true,
        'no_superfluous_phpdoc_tags' => false,
    ]);

However, ./vendor/bin/duster fix or ./vendor/bin/duster lint seems to ignore the 'no_superfluous_phpdoc_tags' => false, or perhaps ignoring the .php-cs-fixer.dist.php file completely.

Am I missing something? Do I need to specify the path of .php-cs-fixer.dist.php anywhere so Duster picks up the customization?

Error when pre-commit checking with php-cs-fixer + lint-staged

Hey, thanks for Duster! I'm swapping out a tightenco/tlint / friendsofphp/php-cs-fixer / symplify/easy-coding-standard setup that includes lint-staged set up on our precommit hook. Here's the setup:

.git/pre-commit:

#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install lint-staged

package.json:

    "lint-staged": {
        "**/*.php*": [
            "vendor/bin/duster --lint"
        ]
    },

When attempting to commit two files I got the following error - I increased the verbosity for troubleshooting:

> git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file -
[STARTED] Preparing lint-staged...
[SUCCESS] Preparing lint-staged...
[STARTED] Running tasks for staged files...
[STARTED] package.json β€” 2 files
[STARTED] **/*.php* β€” 2 files
[STARTED] vendor/bin/duster --lint -vvv
[FAILED] vendor/bin/duster --lint -vvv [FAILED]
[FAILED] vendor/bin/duster --lint -vvv [FAILED]
[FAILED] vendor/bin/duster --lint -vvv [FAILED]
[STARTED] Applying modifications from tasks...
[SKIPPED] Skipped because of errors from tasks.
[STARTED] Reverting to original state because of errors...
[SUCCESS] Reverting to original state because of errors...
[STARTED] Cleaning up temporary files...
[SUCCESS] Cleaning up temporary files...

βœ– vendor/bin/duster --lint -vvv:

Box Requirements Checker
========================

> Using PHP 8.2.1
> PHP is using the following php.ini file:
  /opt/homebrew/etc/php/8.2/php.ini

> Checking Box requirements:
  βœ” The application requires the version "^8.0" or greater.
  βœ” The application requires the extension "zlib".
  
                                                                                
 [OK] Your system is ready to run the application.                              
                                                                                

                              Linting using TLint                               
LGTM!
LGTM!
                         Linting using PHP_CodeSniffer                          
.. 2 / 2 (100%)


Time: 233ms; Memory: 27.13MB

                           Linting using PHP CS Fixer                           

In ConfigurationResolver.php line 559:
                                                                          
  [PhpCsFixer\ConfigurationException\InvalidConfigurationException (16)]  
  For multiple paths config parameter is required.                        
                                                                          

Exception trace:
  at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/friendsofphp/php-cs-fixer/src/Console/ConfigurationResolver.php:559
 PhpCsFixer\Console\ConfigurationResolver->computeConfigFiles() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/friendsofphp/php-cs-fixer/src/Console/ConfigurationResolver.php:249
 PhpCsFixer\Console\ConfigurationResolver->getConfig() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/friendsofphp/php-cs-fixer/src/Console/ConfigurationResolver.php:871
 PhpCsFixer\Console\ConfigurationResolver->resolveFinder() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/friendsofphp/php-cs-fixer/src/Console/ConfigurationResolver.php:500
 PhpCsFixer\Console\ConfigurationResolver->getFinder() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/app/Support/PhpCsFixer.php:76
 App\Support\PhpCsFixer->process() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/app/Support/PhpCsFixer.php:45
 App\Support\PhpCsFixer->lint() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/app/Actions/Clean.php:22
 App\Actions\Clean->App\Actions\{closure}() at n/a:n/a
 array_filter() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/illuminate/collections/Arr.php:795
 Illuminate\Support\Arr::where() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/illuminate/collections/Collection.php:388
 Illuminate\Support\Collection->filter() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/app/Actions/Clean.php:22
 App\Actions\Clean->execute() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/app/Commands/DusterCommand.php:24
 App\Commands\DusterCommand->handle() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/app/Providers/DusterServiceProvider.php:55
 App\Providers\DusterServiceProvider->App\Providers\{closure}() at n/a:n/a
 call_user_func() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/illuminate/container/Container.php:348
 Illuminate\Container\Container->callMethodBinding() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/illuminate/container/BoundMethod.php:90
 Illuminate\Container\BoundMethod::callBoundMethod() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/illuminate/container/BoundMethod.php:35
 Illuminate\Container\BoundMethod::call() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/illuminate/container/Container.php:663
 Illuminate\Container\Container->call() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/illuminate/console/Command.php:182
 Illuminate\Console\Command->execute() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/symfony/console/Command/Command.php:291
 Symfony\Component\Console\Command\Command->run() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/illuminate/console/Command.php:151
 Illuminate\Console\Command->run() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/symfony/console/Application.php:1014
 Symfony\Component\Console\Application->doRunCommand() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/illuminate/console/Application.php:102
 Illuminate\Console\Application->run() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/laravel-zero/foundation/src/Illuminate/Foundation/Console/Kernel.php:155
 Illuminate\Foundation\Console\Kernel->handle() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/laravel-zero/framework/src/Kernel.php:96
 LaravelZero\Framework\Kernel->handle() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/app/DusterKernel.php:19
 App\DusterKernel->handle() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/duster:34
 require() at /Users/ben/hubventory/vendor/tightenco/duster/builds/duster:14
 include() at /Users/ben/hubventory/vendor/bin/duster:120

husky - pre-commit hook exited with code 1 (error)

indenting class operator and object operator(s)

Hi, is there a specific cs-fixer rule (or other similar tools) to align scope resolution operator / class operator :: (the legendary Paamayim Nekudotayim) bound to object operator β†’ on multiple lines ?

I'd like to have:
class definition and class operator on the same first line
object operators in following lines, indented 1 tab

example:

Route::get('home', MyController::class)
	->middleware('home.access');
	->name('home');

Is there anything out there?

--dirty does not work on Windows

Duster appears to make use of the Project & GitPathsRepository classes from Laravel Pint to build up the array of 'dirty' files from Git.

However as Duster pins Laravel Pint to version 1.5 it does not include the fix from Pint which resolves the --dirty flag working on Windows due to the differences in slashes in directory paths.

laravel/pint#150
https://github.com/laravel/pint/releases/tag/v1.6.0

Unfortunately this doesn't look like a straight forward change from 1.5 to 1.6 due to the fact that Laravel Pint requires both PHP 8.1 (at a minimum) and Laravel Zero 10.

Unsure whether it would be easier in the short term to bring the GitPathRepository class into Duster itself to resolve the issue until such a time that Duster is updated in line with Laravel Pint.

Add option to update stubs

Not sure on the best way to offer this, but the stubs will continue to create files that may contain linting issues.

One thought is you publish all stubs to a temp directory, lint the stubs, then copy the contents back over the original.

Graceful dirty linting exit

Would it be possible to gracefully kill the dirty linting script when there are no dirty files in your repository, with an extra flag/option?

I wanna add Duster as pre-commit hook to my project. With the dirty flag enabled, to not scan my complete project all the time. But at the moment, the command (and thus my hook) fails when there are no dirty PHP-files, when I only update the readme for example. So my question is, can we add an extra flag to the lint command, which will show the "no dirty flags" message (maybe as info instead of error in this case), but exits with exit code 0?

Tighten/custom_ordered_class_elements ordering question

For the Tighten/custom_ordered_class_elements rule is it just supposed to order the element types together? Or should it also be ordering/sorting the elements within a type as well?

Ran Duster on some code and it moved all the "public function"s together as well the "protected function"s together. While the element types got ordered together they kept the original ordering they had before the "fix". For example, the code had a "public function flush()" towards the bottom of the code. When it was ordered/moved to be with the other "public function"s, it was placed at the end of them. Kind of expected the "public function"s to be ordered by name.

Thanks for any feedback on this.

End-user controlled ~/.duster extension point

This issue overlaps/expands on #2, which was closed as it was too vague.

Would a ~/.duster directory be useful as a user-controlled extension point for Duster? Duster would look in ~/.duster for shell scripts named lint, fix, lint-name, or fix-name files and run them if appropriate. It would allow the user to add their own tooling easily.

To be figured out: what would happen if there was a lint-phpcs file in ~/.duster? Should it be run as well as, or in place of, the one provided in the main Duster installation?

Use case

I'm pretty much using TLint and Tightens PHPCS as my baselines but I'd like to use Duster to run ESLint, the PHP security check and node audits as well. Previously, I had hacked the Duster installation, adding lint-eslint in vendor/tightenco/duster/bin/actions, and this worked well but my changes were overridden on composer update.

@mattstauffer, Re: #1 and #26, I totally get that you are not decided on whether to add security checks or ESLint yet but an extension mechanism like this would allow flexibility for the end-user. It would also help when spiking a new lint before possible inclusion as a main standard.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.