andreypostal/cli

View on GitHub
Update README.md #8
Andrey Postal authored a655711c
complete00:00:18
Your first build completed successfully!

Congratulations

Your first build completed successfully!

See the Results

1
git clone
2
codeclimate validate-config
View output
codeclimate validate-config
WARNING: unknown engine or channel <codescan:stable>
WARNING: unknown engine or channel <cody:stable>
WARNING: unknown engine or channel <isort:stable>
WARNING: unknown engine or channel <proselint:stable>
WARNING: unknown engine or channel <protobuf:stable>
WARNING: unknown engine or channel <rustfmt:stable>
WARNING: unknown engine or channel <tfsec:stable>
3
codeclimate prepare
View output
codeclimate prepare
4
builder pull-engines
View output
determining required images
5
structure
View output
12
Parser process id: 12
codeclimate-parser socket not present
waiting 1s...
W, [2024-10-17T23:18:06.087865 #1]  WARN -- : Skipping examples/Complete/MyCommand.php due to CC::Parser::Client::HTTPError
W, [2024-10-17T23:18:06.087898 #1]  WARN -- : Response status: 422
W, [2024-10-17T23:18:06.123901 #1]  WARN -- : Skipping src/App.php due to CC::Parser::Client::HTTPError
W, [2024-10-17T23:18:06.123932 #1]  WARN -- : Response status: 422
W, [2024-10-17T23:18:06.157561 #1]  WARN -- : Skipping src/Types/Context.php due to CC::Parser::Client::HTTPError
W, [2024-10-17T23:18:06.157591 #1]  WARN -- : Response status: 422
W, [2024-10-17T23:18:06.159261 #1]  WARN -- : Skipping src/Types/Param.php due to CC::Parser::Client::HTTPError
W, [2024-10-17T23:18:06.159286 #1]  WARN -- : Response status: 422
6
duplication
View output
12
Parser process id: 12
codeclimate-parser socket not present
waiting 1s...
W, [2024-10-17T23:18:09.596924 #1]  WARN -- : Skipping ./examples/Complete/MyCommand.php due to CC::Parser::Client::HTTPError
W, [2024-10-17T23:18:09.602015 #1]  WARN -- : Response status: 422
W, [2024-10-17T23:18:09.614071 #1]  WARN -- : Skipping ./src/App.php due to CC::Parser::Client::HTTPError
W, [2024-10-17T23:18:09.614309 #1]  WARN -- : Response status: 422
W, [2024-10-17T23:18:09.644379 #1]  WARN -- : Skipping ./src/Types/Context.php due to CC::Parser::Client::HTTPError
W, [2024-10-17T23:18:09.644580 #1]  WARN -- : Response status: 422
W, [2024-10-17T23:18:09.646179 #1]  WARN -- : Skipping ./src/Types/Param.php due to CC::Parser::Client::HTTPError
W, [2024-10-17T23:18:09.646204 #1]  WARN -- : Response status: 422
7
codescan
codescan engine documentation
SkippedView output
Channel stable not found for codescan, available channels: ["beta"]
8
phan
phan engine documentation
9
phpmd
phpmd engine documentation
10
sonar-php
sonar-php engine documentation
View output
INFO: Java 1.8.0_322 Amazon.com Inc. (64-bit)
INFO: Linux 4.4.0-1128-aws amd64
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/src/app/build/libs/sonarlint-core-2.17.0.899.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/src/app/build/libs/sonarlint-cli-2.1.0.566.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
INFO: Index files
INFO: Invalid character encountered in file '/code/assets/initial.gif' at line 1 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
INFO: Invalid character encountered in file '/code/assets/help.jpg' at line 1 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
INFO: Invalid character encountered in file '/code/assets/progress-bars.gif' at line 1 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
INFO: Invalid character encountered in file '/code/assets/centralized.jpg' at line 1 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
INFO: Invalid character encountered in file '/code/assets/progress-bar.png' at line 1 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.
INFO: 36 files indexed
INFO: 16 source files to be analyzed
ERROR: Unable to parse file: /code/examples/BooleanFlag/Service.php
ERROR: Parse error at line 21 column 9:

11: 
12:     public function process(Context $context): void
13:     {
14:         $watch = $context->get('watch');
15: 
16:         self::console('Should we watch it?');
17: 
18:         self::console(
19:             $watch ? 'Yep' : 'Nope',
20:             $watch ? ConsoleLevel::SUCCESS : ConsoleLevel::ERROR,
21:         );
            ^
22:     }
23: }
24: 

ERROR: Unable to parse file: /code/examples/Complete/MyCommand.php
ERROR: Parse error at line 9 column 10:

 1: <?php
 2: namespace Andrey\Cli\Examples\Complete;
 3: 
 4: use Andrey\Cli\App;
 5: use Andrey\Cli\Types\Command;
 6: use Andrey\Cli\Types\Context;
 7: use Andrey\Cli\Types\Param;
 8: 
 9: readonly class MyCommand extends App
             ^
10: {
11:     public function __construct()
12:     {
13:         parent::__construct(
14:             appName: 'Amazing App',
15:             description:
16:                 'This is an amazing app that showcases how easy  it is to create a CLI application.',
17:             cmd: 'php app',
18:             params: [
19:                 new Param(

ERROR: Unable to parse file: /code/examples/Complete/MyService.php
ERROR: Parse error at line 47 column 9:

37: 
38:             return;
39:         }
40: 
41:         self::console('Successfully logged in!', ConsoleLevel::SUCCESS);
42: 
43:         self::center("Welcome {$user}", ConsoleLevel::HIGHLIGHT);
44:         self::center(
45:             'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ' .
46:                     'Aliquam condimentum velit sit amet lacus interdum venenatis. Suspendisse potenti.',
47:         );
            ^
48: 
49:         self::newLine();
50: 
51:         self::console('This is just a warning, cool progress bar below: ', ConsoleLevel::WARNING);
52: 
53:         $this->initInfiniteBar();
54:         for ($i = 0; $i < 5; $i++) {
55:             $this->loopInfiniteBar();
56:         }
57:         $this->endInfiniteBar();

ERROR: Unable to parse file: /code/src/App.php
ERROR: Parse error at line 14 column 10:

 4: use InvalidArgumentException;
 5: use Andrey\Cli\Exceptions\CliException;
 6: 
 7: use Andrey\Cli\Types\Command;
 8: use Andrey\Cli\Types\ConsoleLevel;
 9: use Andrey\Cli\Types\Context;
10: use Andrey\Cli\Types\Param;
11: 
12: use Andrey\Cli\Utils\Output;
13: 
14: readonly class App
             ^
15: {
16:     use Output;
17: 
18:     private const HELP_CMD = 'help';
19: 
20:     /**
21:      * @throws CliException
22:      */
23:     public function __construct(
24:         private string $appName,

ERROR: Unable to parse file: /code/src/Components/InfiniteProgressBar.php
ERROR: Parse error at line 6 column 13:

 1: <?php
 2: namespace Andrey\Cli\Components;
 3: 
 4: trait InfiniteProgressBar
 5: {
 6:     private int $barSize;
                ^
 7:     private int $startedProgressAt;
 8: 
 9:     public function initInfiniteBar(int $barSize = 30): void
10:     {
11:         $this->barSize = $barSize;
12:         $this->startedProgressAt = (int) microtime(true);
13:     }
14: 
15:     public function loopInfiniteBar(int $totalSteps = 20, int $blockSize = 3): void
16:     {

ERROR: Unable to parse file: /code/src/Components/ProgressBar.php
ERROR: Parse error at line 7 column 13:

 1: <?php
 2: namespace Andrey\Cli\Components;
 3: 
 4: trait ProgressBar
 5: {
 6:     private const MAX_MESSAGE_SIZE = 50;
 7:     private int $totalItems;
                ^
 8:     private int $barSize;
 9:     private int $currentProgress;
10:     private int $startedProgressAt;
11: 
12:     public function initProgressBar(int $total, int $barSize = 30): void
13:     {
14:         $this->totalItems = $total;
15:         $this->barSize = $barSize;
16:         $this->currentProgress = 0;
17:         $this->startedProgressAt = (int) microtime(true);

ERROR: Unable to parse file: /code/src/Types/Command.php
ERROR: Parse error at line 7 column 9:

 1: <?php
 2: namespace Andrey\Cli\Types;
 3: 
 4: class Command
 5: {
 6:     public function __construct(
 7:         public string $key,
            ^
 8:         public string $description,
 9:         /** @var array{instance:string|callable, entrypoint:string} */
10:         public array $service,
11:         /** @var Param[] */
12:         public array $params = [],
13:     ) { }
14: }
15: 

ERROR: Unable to parse file: /code/src/Types/ConsoleLevel.php
ERROR: Parse error at line 4 column 6:

 1: <?php
 2: namespace Andrey\Cli\Types;
 3: 
 4: enum ConsoleLevel
         ^
 5: {
 6:     case NORMAL;
 7:     case INFO;
 8:     case WARNING;
 9:     case ERROR;
10:     case SUCCESS;
11:     case HIGHLIGHT;
12: 
13:     public function getColor(): string
14:     {

ERROR: Unable to parse file: /code/src/Types/Context.php
ERROR: Parse error at line 4 column 10:

 1: <?php
 2: namespace Andrey\Cli\Types;
 3: 
 4: readonly class Context
             ^
 5: {
 6:     public function __construct(private array $params)
 7:     { }
 8: 
 9:     public function get(string $key): string|bool|null
10:     {
11:         return ($this->params[$key] ?? null)?->value;
12:     }
13: }
14: 

ERROR: Unable to parse file: /code/src/Types/Param.php
ERROR: Parse error at line 4 column 10:

 1: <?php
 2: namespace Andrey\Cli\Types;
 3: 
 4: readonly class Param
             ^
 5: {
 6:     public mixed $value;
 7: 
 8:     public function __construct(
 9:         public string $key,
10:         public string $flag,
11:         public bool $required = false,
12:         public ?string $defaultValue = null,
13:         public ?string $helpText = null,
14:         public bool $isBool = false,

ERROR: Unable to parse file: /code/src/Utils/Output.php
ERROR: Parse error at line 23 column 9:

13:     protected const STYLE_RED = "\e[91m";
14:     protected const STYLE_GRAY = "\e[37m";
15: 
16:     public static function console(string $message, ConsoleLevel $level = ConsoleLevel::NORMAL): void
17:     {
18:         echo sprintf(
19:             "\e[1m\e[36m[%s]: %s%s\e[0m\n",
20:             date('d/m/Y H:i:s'),
21:             $level->getColor(),
22:             $message,
23:         );
            ^
24: 
25:         flush();
26:     }
27: 
28:     public static function center(string $message, ConsoleLevel $level = ConsoleLevel::NORMAL, int $columns = 60): void
29:     {
30:         $messageOriginal = $message;
31:         $nChars = floor($columns * .8);
32: 
33:         $message = substr($message, 0, $nChars);

INFO: 16/16 source files have been analyzed
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 0.669s
INFO: Final Memory: 8M/94M
INFO: ------------------------------------------------------------------------