Skip to content

Add test to check for uppercase letters in dir and file names

What does this MR do and why?

Add a test in lint-doc.sh to check for uppercase letters in directory and file names under the doc/ directory. According to https://docs.gitlab.com/ee/development/documentation/site_architecture/folder_structure.html#work-with-directories-and-files:

When working with directories and files:

  • Do not use special characters and spaces, or capital letters in file names, directory names, branch names, and anything that generates a path.

How to set up and validate locally

  1. Check out this branch.

  2. Create a few test directories:

    mkdir doc/Test{,A,B,C}
  3. Run the script:

    scripts/lint-doc.sh

    The error should be like the following:

    => Checking for directory names containing an uppercase letter...
    
    ✖ ERROR: Found one or more directories with an uppercase letter in their name. Use lowercase instead of uppercase for the directory names.
    https://docs.gitlab.com/ee/development/documentation/site_architecture/folder_structure.html#work-with-directories-and-files
    
    doc/TestB
    doc/TestA
    doc/Test
    doc/TestC
    
    => Checking for file names containing an uppercase letter...
    
    ✖ ERROR: Found one or more file names with an uppercase letter in their name. Use lowercase instead of uppercase for the file names.
    https://docs.gitlab.com/ee/development/documentation/site_architecture/folder_structure.html#work-with-directories-and-files
    
    doc/development/sec/CycloneDX_property_taxonomy.md

    The doc/development/sec/CycloneDX_property_taxonomy.md file is a legit file that should produce an error and fail the job. It was recently added in !118823 (merged), which is why I created this MR 🙂 And here's the failed job to demonstrate that the test works in CI as well https://gitlab.com/gitlab-org/gitlab/-/jobs/4284886495. This is fixed in the second commit !120726 (5d41d891).

  4. To remove the created test directories:

    git clean -df

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Achilleas Pipinellis

Merge request reports

Loading