-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
221 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,23 @@ | ||
# HydeStan - Experimental Custom Static Analysis Tool for the HydePHP Monorepo | ||
# HydeStan - Internal Custom Static Analysis for the HydePHP Monorepo | ||
|
||
## About | ||
|
||
HydeStan is a custom static analysis tool in the HydePHP monorepo, designed to provide additional static analysis and code quality checks for the HydePHP framework. | ||
It is in continuous development and is highly specialized, and cannot be relied upon for any outside this repository. | ||
|
||
## Usage | ||
|
||
The analyser is called through the `run.php` script, and is automatically run on all commits through the GitHub Actions CI/CD pipeline. | ||
|
||
### Running HydeStan | ||
|
||
It can also be run manually from the monorepo root: | ||
|
||
```bash | ||
php ./monorepo/HydeStan/run.php | ||
``` | ||
|
||
### GitHub Integration | ||
|
||
A subset of HydeStan is also run on the Git patches sent to our custom [CI Server](https://ci.hydephp.com) to provide near-instant immediate feedback on commits. | ||
Example: https://ci.hydephp.com/api/hydestan/status/e963e2b1c8637ed5d1114e98b32ee698a821c74f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
interface FileAnalyserContract | ||
{ | ||
public function __construct(string $file, string $contents); | ||
|
||
public function run(string $file, string $contents): void; | ||
} | ||
|
||
interface LineAnalyserContract | ||
{ | ||
public function __construct(string $file, int $lineNumber, string $line); | ||
|
||
public function run(string $file, int $lineNumber, string $line): void; | ||
} | ||
|
||
abstract class Analyser | ||
{ | ||
protected function fail(string $error): void | ||
{ | ||
HydeStan::getInstance()->addError($error); | ||
} | ||
} | ||
|
||
abstract class FileAnalyser extends Analyser implements FileAnalyserContract | ||
{ | ||
public function __construct(protected string $file, protected string $contents) | ||
{ | ||
// | ||
} | ||
} | ||
|
||
abstract class LineAnalyser extends Analyser implements LineAnalyserContract | ||
{ | ||
public function __construct(protected string $file, protected int $lineNumber, protected string $line) | ||
{ | ||
// | ||
} | ||
} |
Oops, something went wrong.