@@ -30,13 +30,10 @@ function usage(string $script): string
3030 OPTIONS:
3131 -h, --help Display this help and exit.
3232 --gersemi Run gersemi.
33- --cmakelint Run cmakelint.
34- --cmakelang-cmake-format Run cmake-format by cmakelang project.
35- --cmakelang-cmake-lint Run cmake-lint by cmakelang project.
3633
3734 FEATURES:
3835 - Reports missing and unused CMake find and utility modules
39- - Runs codespell, normalizator, gersemi, and cmakelang tools if found
36+ - Runs codespell, normalizator, and gersemi tools if found
4037 EOL ;
4138}
4239
@@ -66,9 +63,6 @@ function options(array $overrides = [], array $argv = []): array
6663 $ longOptions = [
6764 'help ' ,
6865 'gersemi ' ,
69- 'cmakelint ' ,
70- 'cmakelang-cmake-format ' ,
71- 'cmakelang-cmake-lint ' ,
7266 ];
7367
7468 $ optionsIndex = null ;
@@ -79,9 +73,6 @@ function options(array $overrides = [], array $argv = []): array
7973 'path ' => null ,
8074 'script ' => pathinfo ($ argv [0 ], PATHINFO_BASENAME ),
8175 'gersemi ' => false ,
82- 'cmakelint ' => false ,
83- 'cmakelang-cmake-format ' => false ,
84- 'cmakelang-cmake-lint ' => false ,
8576 ];
8677
8778 foreach ($ cliOptions as $ option => $ value ) {
@@ -93,15 +84,6 @@ function options(array $overrides = [], array $argv = []): array
9384 case 'gersemi ' :
9485 $ options ['gersemi ' ] = true ;
9586 break ;
96- case 'cmakelint ' :
97- $ options ['cmakelint ' ] = true ;
98- break ;
99- case 'cmakelang-cmake-format ' :
100- $ options ['cmakelang-cmake-format ' ] = true ;
101- break ;
102- case 'cmakelang-cmake-lint ' :
103- $ options ['cmakelang-cmake-lint ' ] = true ;
104- break ;
10587 }
10688 }
10789
@@ -634,105 +616,6 @@ function runGersemi(): int
634616 return $ status ;
635617}
636618
637- /**
638- * Check and run CMakeLint.
639- */
640- function runCMakeLint (Iterator $ files ): int
641- {
642- if (!checkCommand ('cmakelint ' )) {
643- output (<<<EOL
644-
645- The 'cmakelint' tool not found.
646- For checking CMake code style, install cmakelint:
647- https://github.com/cmake-lint/cmake-lint
648-
649- EOL );
650-
651- return 0 ;
652- }
653-
654- $ argument = implode (' ' , iterator_to_array ($ files ));
655- exec (
656- 'cmakelint --filter=-linelength,-whitespace/indent,-convention/filename,-package/stdargs ' . $ argument ,
657- $ output ,
658- $ status ,
659- );
660-
661- $ output = implode ("\n" , $ output );
662- if ('' !== $ output ) {
663- output ($ output );
664- output ();
665- }
666-
667- return $ status ;
668- }
669-
670- /**
671- * Check and run cmake-format by cmakelang project.
672- */
673- function runCMakeLangCMakeFormat (Iterator $ files ): int
674- {
675- if (!checkCommand ('cmake-format ' )) {
676- output (<<<EOL
677-
678- The 'cmake-format' tool not found.
679- For checking CMake code style, install cmakelang:
680- https://cmake-format.readthedocs.io
681-
682- EOL );
683-
684- return 0 ;
685- }
686-
687- $ argument = implode (' ' , iterator_to_array ($ files ));
688- exec (
689- 'cmake-format --config-files bin/check-cmake/cmake-format.json --check -- ' . $ argument ,
690- $ output ,
691- $ status ,
692- );
693-
694- $ output = implode ("\n" , $ output );
695- if ('' !== $ output ) {
696- output ($ output );
697- output ();
698- }
699-
700- return $ status ;
701- }
702-
703- /**
704- * Check and run cmake-lint by the cmakelang project.
705- */
706- function runCMakeLangCMakeLint (Iterator $ files ): int
707- {
708- if (!checkCommand ('cmake-lint ' )) {
709- output (<<<EOL
710-
711- The 'cmake-lint' tool not found.
712- For checking CMake code style, install cmakelang:
713- https://cmake-format.readthedocs.io
714-
715- EOL );
716-
717- return 0 ;
718- }
719-
720- $ argument = implode (' ' , iterator_to_array ($ files ));
721- exec (
722- 'cmake-lint --config-files bin/check-cmake/cmake-format.json --suppress-decorations -- ' . $ argument ,
723- $ output ,
724- $ status ,
725- );
726-
727- $ output = implode ("\n" , $ output );
728- if ('' !== $ output ) {
729- output ($ output );
730- output ();
731- }
732-
733- return $ status ;
734- }
735-
736619/**
737620 * Run all checks.
738621 */
@@ -777,24 +660,6 @@ function checkAll(array $options): int
777660 $ status = (0 === $ status ) ? $ newStatus : $ status ;
778661 }
779662
780- if ($ options ['cmakelint ' ]) {
781- output ($ options ['script ' ] . ': Running cmakelint ' );
782- $ newStatus = runCMakeLint ($ allCMakeFiles );
783- $ status = (0 === $ status ) ? $ newStatus : $ status ;
784- }
785-
786- if ($ options ['cmakelang-cmake-format ' ]) {
787- output ($ options ['script ' ] . ': Running cmakelang \'s cmake-format ' );
788- $ newStatus = runCMakeLangCMakeFormat ($ allCMakeFiles );
789- $ status = (0 === $ status ) ? $ newStatus : $ status ;
790- }
791-
792- if ($ options ['cmakelang-cmake-lint ' ]) {
793- output ($ options ['script ' ] . ': Running cmakelang \'s cmake-lint ' );
794- $ newStatus = runCMakeLangCMakeLint ($ allCMakeFiles );
795- $ status = (0 === $ status ) ? $ newStatus : $ status ;
796- }
797-
798663 if (0 === $ status ) {
799664 output ("\n" . $ options ['script ' ] . ': Done ' );
800665 }
0 commit comments