• Stars
    star
    409
  • Rank 105,709 (Top 3 %)
  • Language
    PHP
  • License
    MIT License
  • Created almost 4 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

Project Banner

Duster

Automatically apply Tighten's default code style for Laravel apps.

Duster is built on top of the following tools:

  • TLint: lints Laravel and PHP code for issues not covered by other tools
    • using the default Tighten preset
  • PHP_CodeSniffer: sniffs issues that can't be fixed automatically
    • using the Tighten preset which is mostly PSR1 with some Tighten-specific rules
  • PHP CS Fixer: adds custom rules not supported by Laravel Pint
    • CustomOrderedClassElementsFixer Tighten-specific order of class elements
  • Pint: Laravel's code style rules (with a few Tighten specific customizations)
    • using the default Laravel preset with some Tighten-specific rules

You can view a list of the compiled rules and examples of what they do in the style guide.

Installation

You can install the package via composer:

composer require tightenco/duster --dev

Optionally you can publish a GitHub Actions config:

./vendor/bin/duster github-actions

Usage

To lint everything at once:

./vendor/bin/duster lint

To fix everything at once:

./vendor/bin/duster fix

To dust only files that have uncommitted changes according to Git, you may use the --dirty option:

./vendor/bin/duster lint --dirty
#or
./vendor/bin/duster fix --dirty

To view all available commands:

./vendor/bin/duster
#or
./vendor/bin/duster commands

Usage with Sail

./vendor/bin/sail php ./vendor/bin/duster

Alternatively, Sail has a bin script that eases the execution of package binaries, so you do the same thing like this:

./vendor/bin/sail bin duster

Customizing

If you need to include or exclude files or directories for each tool you can create a duster.json config file in your project root:

{
    "include": [
        "bin",
        "scripts",
        "src",
        "tests"
    ],
    "exclude": [
        "tests/fixtures"
        "**/folderToExclude/**"
    ]
}

To run additional scripts as part of Duster first add them to duster.json as part of scripts separated into lint and fix.

The key is the name of the command (used with the --using flag), and the value is an array of arguments passed to Symfony\Component\Process\Process.

{
    "scripts": {
        "lint": {
            "phpstan": ["./vendor/bin/phpstan", "analyse"]
        }
    },
    "processTimeout": 120
}

Duster will pick these up automatically when running either lint or fix. By default, additional scripts timeout after 60 seconds. You can overwrite this setting using the processTimeout key.

To customize which tools Duster runs, or the order in which they are executed you can use the --using flag and supply a comma-separated list of commands:

./vendor/bin/duster lint --using="phpstan,tlint,pint"

TLint

Create a tlint.json file in your project root. Learn more in the TLint documentation.

PHP_CodeSniffer

Create a .phpcs.xml.dist file in your project root with the following:

<?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"/>
</ruleset>

Now you can add customizations below the <rule ref="Tighten"/> line or even disable the Tighten rule to use your own ruleset. Learn more in this introductory article.

PHP CS Fixer

Create a .php-cs-fixer.dist.php file in your project root with the contents from Duster's .php-cs-fixer.dist.php file. Learn more in the PHP CS Fixer documentation.

Pint

Create a pint.json file in your project root, you can use Duster's pint.json file as a starting point. Learn more in the Pint documentation.

GitHub Action

There's a GitHub Action you use to clean-up your workflows.

Warning Heads Up! Workflows that commit to your repo will stop any currently running workflows and not trigger another workflow run.

One solution is to run your other workflows after Duster has completed by updating the trigger on those workflows:

on:
  # Commits made in Duster Fix will not trigger any workflows
  # This workflow is configured to run after Duster finishes
  workflow_run:
    workflows: ["Duster Fix"]
    types:
      - completed

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

More Repositories

1

ziggy

Use your Laravel routes in JavaScript.
JavaScript
3,816
star
2

jigsaw

Simple static sites with Laravel’s Blade.
PHP
2,115
star
3

takeout

Docker-based development-only dependency manager. macOS, Linux, and WSL2-only and installs via PHP's Composer... for now.
PHP
1,590
star
4

collect

A Collections-only split from Laravel's Illuminate Support
PHP
1,506
star
5

parental

Use single table inheritance in your Laravel app
PHP
1,327
star
6

mailthief

A fake mailer for Laravel Applications for testing mail.
PHP
685
star
7

lambo

Quick new application creation with Laravel and Valet
PHP
612
star
8

tlint

Tighten linter for Laravel conventions.
PHP
517
star
9

novapackages

PHP
334
star
10

quicksand

Easily schedule regular cleanup of old soft-deleted Eloquent data.
PHP
294
star
11

gistlog

GistLog - simple, easy blogging based on GitHub gists
CSS
274
star
12

symposium

Management of proposals, bios, photos, etc. for conference speakers.
PHP
177
star
13

nova-google-analytics

Google Analytics integration with Laravel Nova
PHP
161
star
14

onramp

Easing the onramp for new or non-PHP developers to become Laravel devs.
PHP
157
star
15

overload

Method overloading in PHP
PHP
115
star
16

nova-stripe

Easily show information about Stripe charges and balances in your Nova dashboard
JavaScript
103
star
17

giscus

Notifications for Gist Comments
PHP
103
star
18

laravelversions

PHP
94
star
19

jigsaw-blog-template

Starter template for a blog, using Jigsaw by Tighten
Blade
91
star
20

confomo

ConFOMO is a simple tool that makes it easy to track your friends at conferences.
JavaScript
74
star
21

ozzie

Open source project monitor for Tighten
PHP
56
star
22

nova-package-development

A forum for talking about the process of Nova Package Development
52
star
23

jigsaw-docs-template

Starter template for a documentation site, using Jigsaw by Tighten
Blade
44
star
24

craft-build-query

A plugin for Craft CMS, demonstrating how to build complex or optimized queries by modifying an ElementCriteriaModel.
PHP
39
star
25

liftoff

A quick start for Laravel development in a new environment
Shell
38
star
26

builtwithjigsaw

A list of sites built with Jigsaw
Blade
35
star
27

react-gif-search-engine

React GIF Search Engine
JavaScript
33
star
28

react-gif-search-engine-old

JavaScript
32
star
29

jigsaw-site

Jigsaw Documentation Site
Blade
30
star
30

blink-my-lights

Quick proof-of-concept for flashing/blinking lights with Laravel and IFTTT
PHP
26
star
31

laravelm1

Tracking what works and doesn't in the Laravel ecosystem on M1
Blade
25
star
32

configs

Standard config files for Tighten projects
PHP
24
star
33

built-with-laravel

Real organizations and companies building with Laravel.
PHP
24
star
34

nova-releases

A package to provide a card and a tool giving information about Nova releases, including whether you're current
Vue
20
star
35

consoles

Quick shortcut list to API developer consoles
PHP
19
star
36

json-api-examples

Implementing JSON:API in laravel
18
star
37

laravel-react-demo

Demo of how to include React components in a Laravel project with Elixir
PHP
17
star
38

laravel-mix-jigsaw

Laravel Mix plugin for Jigsaw.
JavaScript
16
star
39

nova-package-discovery

Nova card for showing stats from novapackages.com
PHP
16
star
40

simplecast-php

Simplecast PHP SDK
PHP
15
star
41

php-package-skeleton

Tighten's PHP Package skeleton -- inspired by & some source from spatie/skeleton-php
Shell
15
star
42

checkmate

Check the version of all your Laravel apps and notify if they're out of date
PHP
14
star
43

tighten-coding-standard

A PHP Code_Sniffer configuration for Tighten's coding standard.
PHP
14
star
44

saasaas

SaaSaaS - create your next "AirBnB for ___" idea
PHP
14
star
45

laravel-elixir-webpack-react

A package to provide support for compiling React JSX files in Laravel Elixir 6
JavaScript
13
star
46

podcast-subscriber

Easy podcast subscriber app
PHP
10
star
47

laravel-mix-react

Easy alternative Laravel Mix configuration for projects using React
JavaScript
10
star
48

laravel-preset-jest

Front-end presets that include Jest for React and Vue
PHP
9
star
49

laraveldrivers

List all third-party Laravel drivers
PHP
9
star
50

blade-style-guide

"PSR-Blade"--style guide for Laravel Blade
9
star
51

easy-embeddable-polls

easy-static-polls
Vue
8
star
52

valet-fallback

Fallback web site for Valet
PHP
8
star
53

phpreleases-action

GitHub action that integrates with the PHP Releases API.
7
star
54

dev-battle-1-react

Tighten Co. Senior Dev Battle - React app
PHP
7
star
55

dev-battle-1-vue

Tighten Co. Senior Dev Battle - Vue app[
JavaScript
6
star
56

duster-action

Dockerfile
6
star
57

react-native-time-input

A simple time input component with autoformatting.
TypeScript
6
star
58

jigsaw-collections-demo

CSS
5
star
59

tlint-plugin

TLint PHPStorm Plugin
Kotlin
4
star
60

gif-gif-vue

Samantha Geitz Jest testing in Vue Laracon talk
PHP
4
star
61

hyperspoon

Lua
4
star
62

gif-gif-react

React version of Samantha Geitz's Jest Testing Laracon talk
PHP
4
star
63

postit

PHP
3
star
64

laravel-elixir-elm

JavaScript
3
star
65

pickr-api

PHP
3
star
66

laravel-tricks

Laravel Tricks rewrite
PHP
3
star
67

tallstack

The new web site for tallstack.dev
PHP
2
star
68

jazz

JavaScript-inspired development utilities
PHP
2
star
69

nova-tighten-themes

Tighten's Nova Themes
CSS
2
star
70

learnwebdevelopment

LearnWebDevelopment.org
CSS
2
star
71

tlint-sublime-plugin

tlint-sublime-plugin
Python
2
star
72

intro-to-react

Intro to React workshop given by Samantha Geitz at PeersConf 2018
JavaScript
2
star
73

omgphp

OMGPHP.com
CSS
1
star
74

borsh-php

1
star
75

phpreleases

API endpoints with support information for PHP major/minor versions and releases 5.6 and later
PHP
1
star
76

pickr-nativescript

NativeScript version of Pickr for Tighten Dev Battle 2
CSS
1
star
77

automation-scripts

Lua
1
star
78

pickr-reactnative

JavaScript
1
star
79

mon-petit

PHP
1
star
80

whyphp

CSS
1
star
81

laravelstar

Vue
1
star
82

dev-battle-landing

Landing page for the Tighten Dev Battle
PHP
1
star