uuf6429 / elder-brother Goto Github PK
View Code? Open in Web Editor NEWSet up and manage contribution policies for you PHP-based projects.
License: MIT License
Set up and manage contribution policies for you PHP-based projects.
License: MIT License
Come up with a better name and more useful documentation.
Things to note:
Would be nice to use an existing system instead of building own one, something like symfony/finder.
Make sure that the results can be cached (similar to what I did already)
Instead of spawning php-cs-fixer for every file to be fixed, create a fixer instance, configure it and run it for the set of files to be fixed.
The main disadvantage is lack of isolation, but we can live with it.
Current approach is messy and too tied to the console.
Ideally, progress should be handled by one class, performing things like falling back to simple list / log approach etc.
Also, the current approach is a bit buggy depending on things like progress count etc.
ConfigAwareInterface
(with a setConfig()
method)ConfigInterface
Right now, if we want to force installation via composer scripts, the package has to be always required
in composer, so one can't limit ElderBrother installation to just for developers.
This leaves the following options:
elder-brother
packageif (exists('/path/to/bin')) /path/to/bin install
Example use:
new PhpCsFixer(glob('src/*.php'), 'cfg/.php_cs');
Properly check that directory is a git repo by running git status
and git hook path using git rev-parse --git-dir
Use errors, warnings and notices instead of (Runtime|Recoverable) exceptions in actions.
This means:
Using an sql parser, (eg; greenlion/PHP-SQL-Parser or phpmyadmin/sql-parser), extend FileList fluent interface with sql rules.
Usage Examples:
new ForbiddenFiles(
$fileList
->name('*.sql')
->sqlWithDDL()
->sqlWithDML()
,
'Mixing DML and DDL is not allowed.'
);
new ForbiddenFiles(
$fileList
->name('*.sql')
->sqlWithDDL('CREATE TABLE')
->sqlWithDQL('SELECT')
,
'Not allowed due to GTID being enabled.'
);
new RiskyFiles(
$fileList
->name('*.sql')
->sqlWithDDL()
->sqlTable('products', 'users')
,
'Possibly slow query that may block concurrent queries.'
);
A few proposed methods:
sqlWithDCL(...$allowedDCL)
sqlWithDDL(...$allowedDDL)
sqlWithDML(...$allowedDML)
sqlWithDQL(...$allowedDQL)
sqlWithDCL(...$allowedTCL)
sqlWithoutDCL(...$disallowedDCL)
sqlWithoutDDL(...$disallowedDDL)
sqlWithoutDML(...$disallowedDML)
sqlWithoutDQL(...$disallowedDQL)
sqlWithoutTCL(...$disallowedTCL)
sqlTable(...$allowedTables)
sqlNotTable(...$disallowedTables)
sqlFilter($callback($parsedSql))
sqlNotFilter($callback($parsedSql))
The main reason why PHP could be used is that configuration can be easily written and documentation automatically provided through PHPDoc.
Note: See PHP-CS-Fixer config for inspiration.
Two commands for installing VCS (git, svn etc) hooks to point to this tool.
sort
sortByName
sortByType
sortByAccessedTime
sortByChangedTime
sortByModifiedTime
Document the various filtering methods in file finder.
An action that takes a callback and executes it. The callback should receive $config
and $output
as arguments.
Example uses:
// named function
new ExecuteCustomCode(
'doSomething'
);
// closure
new ExecuteCustomCode(
function ($config, $output) { }
);
// static method
new ExecuteCustomCode(
[\Vendor\Product\Something::class, 'doSomething']
);
// regular method
new ExecuteCustomCode(
[new \Vendor\Product\Something(), 'doSomething']
);
Returning a non-falsy value should break the process. Throw an exception to break process.
Remove old version of php-cs-fixer action (together with test).
Objective is to have most methods available in [symfony/finder] also available in changeset.
In particular: notName()
and toIterator()
Usage:
new ExecuteProgram(
'/usr/bin/php -f test.php', // program to run
'/home/user', // current directory (optional, default is project dir)
true, // break on failure (optional, default is true)
)
Action lists should be bound to an event. Ideally, events should be grouped by a type and the actual event, for example various git hooks would look like: git:pre-commit
or git:commit-msg
.
ExpressionBuilder
)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.