Skip to content

Commit f48577e

Browse files
authored
Merge pull request #399 from gsteel/mago-support
Initial support for Mago
2 parents 8dd945b + 228ae41 commit f48577e

10 files changed

Lines changed: 79 additions & 17 deletions

File tree

‎Makefile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ test: build-container ## Tests
2222
.PHONY: test
2323

2424
shell: build-container
25-
docker run -it -w /app -v ${PWD}:/app --rm ${NODE_IMG} sh
26-
.PHONY:
25+
docker run --entrypoint /bin/sh -it -w /app -v ${PWD}:/app --rm ${NODE_IMG}
26+
.PHONY: shell

‎README.md‎

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,21 @@ It identifies jobs to run based on presence or absence of configuration files in
2727

2828
The following tools are automatically detected based on their configuration files:
2929

30-
| Tool | Configuration Files | Notes |
31-
|------|---------------------|-------|
32-
| PHPUnit | `phpunit.xml.dist`, `phpunit.xml` | Runs against all supported PHP versions with lowest/latest dependencies |
33-
| PHP_CodeSniffer | `phpcs.xml.dist`, `phpcs.xml` | |
34-
| PHP CS Fixer | `.php-cs-fixer.php`, `.php-cs-fixer.dist.php` | |
35-
| Psalm | `psalm.xml.dist`, `psalm.xml` | |
36-
| PHPStan | `phpstan.neon`, `phpstan.neon.dist`, `phpstan.dist.neon` | |
37-
| Infection | `infection.json`, `infection.json.dist` | Uses `roave/infection-static-analysis-plugin` if installed |
38-
| Codeception | `codeception.yml.dist`, `codeception.yml` | |
39-
| Composer Require Checker | `composer-require-checker.json` | |
40-
| Composer Dependency Analyser | `composer-dependency-analyser.php` | |
41-
| PHPBench | `phpbench.json` | |
42-
| Twig-CS-Fixer | `.twig-cs-fixer.php`, `.twig-cs-fixer.dist.php` | |
43-
| Backward Compatibility Check | — | Optional; requires configuration in `.laminas-ci.json` |
30+
| Tool | Configuration Files | Notes |
31+
|------------------------------|----------------------------------------------------------|---------------------------------------------------------------------------------------------------|
32+
| PHPUnit | `phpunit.xml.dist`, `phpunit.xml` | Runs against all supported PHP versions with lowest/latest dependencies |
33+
| PHP_CodeSniffer | `phpcs.xml.dist`, `phpcs.xml` | |
34+
| PHP CS Fixer | `.php-cs-fixer.php`, `.php-cs-fixer.dist.php` | |
35+
| Psalm | `psalm.xml.dist`, `psalm.xml` | |
36+
| PHPStan | `phpstan.neon`, `phpstan.neon.dist`, `phpstan.dist.neon` | |
37+
| Infection | `infection.json`, `infection.json.dist` | Uses `roave/infection-static-analysis-plugin` if installed |
38+
| Codeception | `codeception.yml.dist`, `codeception.yml` | |
39+
| Composer Require Checker | `composer-require-checker.json` | |
40+
| Composer Dependency Analyser | `composer-dependency-analyser.php` | |
41+
| PHPBench | `phpbench.json` | |
42+
| Twig-CS-Fixer | `.twig-cs-fixer.php`, `.twig-cs-fixer.dist.php` | |
43+
| Backward Compatibility Check | — | Optional; requires configuration in `.laminas-ci.json` |
44+
| Mago | `mago.toml` | Runs `lint`, `analyse` and `format --check`. Use `exclude[]` via `.laminas-ci.json` if necessary. |
4445

4546
### Documentation Linting
4647

‎src/tools.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import {CodeceptionTool} from './tools/codeception';
1212
import {PhpCsFixerTool} from './tools/phpCsFixer';
1313
import {PHPStanTool} from './tools/phpstan';
1414
import {TwigCsFixerTool} from './tools/twigCsFixer';
15+
import {MagoAnalyzeTool} from './tools/mago-analyze';
16+
import {MagoFormatTool} from './tools/mago-format';
17+
import {MagoLintTool} from './tools/mago-lint';
1518
import {ToolExecutionType} from './enum/toolExecutionType';
1619
import {ToolType} from './enum/toolType';
1720

@@ -89,6 +92,9 @@ export default function createTools(config: Config): Array<Tool> {
8992
PHPStanTool,
9093
TwigCsFixerTool,
9194
backwardCompatibilityCheckTool(config),
95+
MagoAnalyzeTool,
96+
MagoLintTool,
97+
MagoFormatTool,
9298
].filter((tool) => tool !== null) as Tool[];
9399

94100
return tools
@@ -110,4 +116,4 @@ export function removeNonExistentFilesToCheck(tool: Tool): Tool {
110116

111117
export function isToolRunningContainerDefaultPhpVersion(tool: Tool): tool is ToolRunningContainerDefaultPhpVersion {
112118
return (tool as ToolRunningContainerDefaultPhpVersion).php === CONTAINER_DEFAULT_PHP_VERSION;
113-
}
119+
}

‎src/tools/mago-analyze.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import {ToolExecutionType} from '../enum/toolExecutionType';
2+
import {ToolType} from '../enum/toolType';
3+
4+
export const MagoAnalyzeTool = {
5+
executionType : ToolExecutionType.STATIC,
6+
name : 'Mago Analyze',
7+
command : './vendor/bin/mago analyze --reporting-format=github',
8+
filesToCheck : [ 'mago.toml' ],
9+
toolType : ToolType.CODE_CHECK,
10+
}

‎src/tools/mago-format.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import {ToolExecutionType} from '../enum/toolExecutionType';
2+
import {ToolType} from '../enum/toolType';
3+
4+
export const MagoFormatTool = {
5+
executionType : ToolExecutionType.STATIC,
6+
name : 'Mago Format',
7+
command : './vendor/bin/mago format --check',
8+
filesToCheck : [ 'mago.toml' ],
9+
toolType : ToolType.CODE_CHECK,
10+
}

‎src/tools/mago-lint.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import {ToolExecutionType} from '../enum/toolExecutionType';
2+
import {ToolType} from '../enum/toolType';
3+
4+
export const MagoLintTool = {
5+
executionType : ToolExecutionType.STATIC,
6+
name : 'Mago Lint',
7+
command : './vendor/bin/mago lint --reporting-format=github',
8+
filesToCheck : [ 'mago.toml' ],
9+
toolType : ToolType.CODE_CHECK,
10+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"stablePHP": "8.4"
3+
}

‎tests/code-check-mago/mago.toml‎

Whitespace-only changes.

‎tests/code-check-mago/matrix.json‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"include": [
3+
{
4+
"name": "Mago Analyze [8.4, latest]",
5+
"job": "{\"command\":\"./vendor/bin/mago analyze --reporting-format=github\",\"php\":\"8.4\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
6+
"operatingSystem": "ubuntu-latest",
7+
"action": "laminas/laminas-continuous-integration-action@v1"
8+
},
9+
{
10+
"name": "Mago Lint [8.4, latest]",
11+
"job": "{\"command\":\"./vendor/bin/mago lint --reporting-format=github\",\"php\":\"8.4\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
12+
"operatingSystem": "ubuntu-latest",
13+
"action": "laminas/laminas-continuous-integration-action@v1"
14+
},
15+
{
16+
"name": "Mago Format [8.4, latest]",
17+
"job": "{\"command\":\"./vendor/bin/mago format --check\",\"php\":\"8.4\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
18+
"operatingSystem": "ubuntu-latest",
19+
"action": "laminas/laminas-continuous-integration-action@v1"
20+
}
21+
]
22+
}

‎tests/code-check-mago/test.env‎

Whitespace-only changes.

0 commit comments

Comments
 (0)