Check the Symfony docs code blocks

Overview

Symfony Code Block Checker

Makes sure that code blocks have valid syntax and can actually run.

$ php ./code-block-checker.php verify:docs /path/to/docs cache.rst controller.rst --env=dev

::error file=cache,line=377::[Invalid syntax] PHP Parse error:  syntax error, unexpected token "}"

 [ERROR] Build completed with 1 errors


$ php ./code-block-checker.php verify:docs /path/to/docs cache.rst controller.rst --env=dev --generate-baseline=baseline.json
$ php ./code-block-checker.php verify:docs /path/to/docs cache.rst controller.rst --env=dev --baseline=baseline.json

 [OK] Build completed successfully!

This project is considered an internal tool and therefore, you shouldn't use this project in your application. Unlike the rest of the Symfony projects, this repository doesn't provide any support and it doesn't guarantee backward compatibility either. Any or the entire project can change, or even disappear, at any moment without prior notice.

Comments
  • Make sure one can run XML config examples

    Make sure one can run XML config examples

    XML is currently disabled. I got errors on every code block when testing. It is probably me missing something, because I don't think every XML code block is wrong.

    opened by Nyholm 9
  • Bunch of fixes for PHP and Twig parsing

    Bunch of fixes for PHP and Twig parsing

    Summary of my attempt to run the script locally against 4.4 version of the docs:

    • ~99e66e28390efa39043f2f88e0cf11f33beb42b3: temporary commits error logs (134 in total)~ // Removed
    • 13be7acc3bc82dd3d6add239b52388c81631126e: fix PHP code that is inlined in class { ... } context (only 2 errors fixed)
    • c7164fb89744f05c661e2a162add4899e409d89b: add missing Twig features (21 errors fixed!)
    • 25945c2175f03a5c18c622603549559529771e7d + https://github.com/symfony/symfony-docs/pull/16868/commits/f396e09371718847f54994d32182b3fb0f96ea91: fix ellipsis (9 erros fixed)
    opened by HeahDude 8
  • Critical error related to RouteCollectionBuilder

    Critical error related to RouteCollectionBuilder

    Hi! Currently, all PRs in symfony/symfony-docs are failing because of this error:

    Executing script cache:clear [KO]
     [KO]
    Script cache:clear returned with error code 255
    !!  
    !!   // Clearing the cache for the dev environment with debug                       
    !!   // true                                                                        
    !!  
    !!  10:12:55 CRITICAL  [php] Uncaught Error: Class "Symfony\Component\Routing\RouteCollectionBuilder" not found ["exception" => Error { …}]
    !!  
    !!  In MicroKernelTrait.php line 216:
    !!                                                                                 
    !!    Attempted to load class "RouteCollectionBuilder" from namespace "Symfony\Co  
    !!    mponent\Routing".                                                            
    !!    Did you forget a "use" statement for another namespace?                      
    !!                                                                                 
    !!  
    !!  cache:clear [--no-warmup] [--no-optional-warmers]
    !!  
    !!  
    Script @auto-scripts was called via post-update-cmd
    Error: Process completed with exit code 255.
    

    See for example: https://github.com/symfony/symfony-docs/runs/4442393145?check_suite_focus=true

    Anybody has any clue about how to fix this? Thanks!

    opened by javiereguiluz 2
  • For now, mark this tool as internal

    For now, mark this tool as internal

    I think @javiereguiluz great changes to the https://github.com/weaverryan/docs-builder README also apply to this project (at least for now). Let's be explicit and not cause too much unintended work for us.

    opened by wouterj 2
  • feat: add Mercure Twig helper

    feat: add Mercure Twig helper

    Needed by https://github.com/symfony/symfony-docs/pull/15924.

    ~~Also, I wonder how to fix the [Missing class] Class, interface or trait with name "ApiPlatform\Core\Annotation\ApiResource" does not exist error. Should I add API Platform as a dependency of this project?~~ See https://github.com/symfony-tools/symfony-application/pull/7.

    opened by dunglas 1
  • Speed up things by using nikic/php-parser

    Speed up things by using nikic/php-parser

    On my machine I verified symfony/symfony-docs in 4m8s before. When using this patch time went down to 1m38s.

    This is because we dont start a new process for every code block to actually run the PHP code.

    opened by Nyholm 0
  • Verify PHP classes

    Verify PHP classes

    Make sure that each reference to a PHP class (in a PHP code block) is to a class that exists.

    This code is not pretty. One could extend this to verify PHP classes referenced in XML code blocks too.

    opened by Nyholm 0
Releases(0.2.0)
Owner
Symfony tools
Tools used by the Symfony organization
Symfony tools
EXPERIMENTAL plugin extending WPGraphQL to support querying (Gutenberg) Blocks as data, using Server Side Block registries to map Blocks to the GraphQL Schema.

WPGraphQL Block Editor This is an experimental plugin to work toward compatiblity between the WordPress Gutenberg Block Editor and WPGraphQL, based on

WPGraphQL 29 Nov 18, 2022
Converts any PocketMine-MP 3.0 extended blocks into PM4 native blocks!

ExtendedBlocksConverter Converts any PocketMine-MP 3.0 extended blocks into PM4 native blocks! Yes, you heard right, this plugin can convert any lefto

Covered123 6 Jun 4, 2022
This tool check syntax of PHP files faster than serial check with fancier output.

PHP Parallel Lint This application checks syntax of PHP files in parallel. It can output in plain text, colored text, json and checksyntax formats. Ad

PHP Parallel lint 202 Dec 22, 2022
CRUD php application to check in and check out employees and show daily building occupation

CRUD php application to check in and check out employees and show daily building occupation. Employees are required to self check their temperature and tick a checkbox to specify whether their temperature is below 38°C else they are invited to stay home. (Implemented in php with bootstrap4 for styling and datatable jquery plugin for table formatting and additional features).

null 2 Feb 20, 2022
PHP Parallel Lint - This tool check syntax of PHP files faster than serial check with fancier output

PHP Parallel Lint This application checks syntax of PHP files in parallel. It can output in plain text, colored text, json and checksyntax formats. Ad

PHP Parallel lint 156 Apr 24, 2022
Kirby docs search workflow for Alfred

Kirby Docs search workflow for Alfred 4 An ultra-fast Kirby Docs search workflow for Alfred 4 Installation Download the latest version Install the wor

Adam Kiss 30 Dec 29, 2022
Automatically Create professional ready to use Laravel REST API for MySQL Database With Postman Docs and JWT Authentication

Laravel Simple Rest API Generator An API Boilerplate to create a ready-to-use REST API in seconds with Laravel 8.x Install with Composer $ curl -s

null 5 Mar 12, 2022
Basic PHP app with Composer used in Microsoft Docs examples

page_type languages products description urlFragment sample php azure This sample demonstrates a tiny PHP app with Composer. php-basic-composer PHP sm

Azure Samples 3 Jul 14, 2022
Removes whitelisted unnecessary files (like tests/docs etc.) from vendor directory

Composer vendor cleanup This is a simple script for the Composer to remove unnecessary files (documentation/examples/tests etc.) from included vendor

Chris 2 Nov 14, 2022
An ultra-fast Laravel docs search workflow for Alfred 3+.

Laravel Docs Workflow for Alfred An ultra-fast Laravel docs search workflow for Alfred 3+. Installation Download the latest version Install the workfl

Till Krüss 317 Dec 21, 2022
Vagrant-boxes - Setup scripts and docs for my vagrant boxes, primarily aimed at Web/SilverStripe developement

zauberfisch's vagrant boxes zauberfisch/silverstripe-debian64 Debian 10 x86_64 LAMP Box with many extra features, pre-configured for SilverStripe Sour

null 6 Jan 24, 2020
A tool for diff'ing this and OpenTHC lab metrics, creating their objects, and docs.

wcia-analytes-tool Consumes OpenTHC Lab Metrics and WCIA Analytes, and produces diff objects and docs for use in WA State interop. version 0.9.8 Getti

Confidence Analytics 1 Jan 15, 2022
Drupal / Eleventy Docs Site for the Design System

Drupal / Eleventy Docs Site for the Design System

University of Michigan Library 2 Oct 31, 2022
A fast Directus docs search workflow for Alfred

Directus Docs Workflow for Alfred A fast Directus docs search workflow for Alfred. Adapted from Tailwind CSS Docs, which is adapted from Alfred VueJS

null 2 Aug 28, 2022
UpToDocs scans a Markdown file for PHP code blocks, and executes each one in a separate process.

UpToDocs UpToDocs scans a Markdown file for PHP code blocks, and executes each one in a separate process. Include this in your CI workflows, to make s

Mathias Verraes 56 Nov 26, 2022
Highlight code blocks with league/commonmark and Shiki

Highlight code blocks with league/commonmark and Shiki This package contains a block renderer for league/commonmark to highlight code blocks using Shi

Spatie 55 Aug 27, 2022
A minimal library that defines primitive building blocks of PHP code.

Jungi Common A minimal library that defines primitive building blocks of PHP code. It combines the advantages of functional and object-oriented progra

Piotr Kugla 28 Jul 15, 2022
A minimal library that defines primitive building blocks of PHP code.

A minimal library that defines primitive building blocks of PHP code. It combines the advantages of functional and object-oriented programming. All of this makes code easier to understand and less prone to errors.

Jungi 28 Jul 15, 2022
Symfony Health Check Bundle Monitoring Project Status

Symfony Health Check Bundle Version Build Status Code Coverage master develop Installation Step 1: Download the Bundle Open a command console, enter y

MacPaw Inc. 27 Jul 7, 2022